diff --git a/bitbake/lib/toaster/toastergui/templates/layers.html b/bitbake/lib/toaster/toastergui/templates/layers.html index 864e15683b..c35a299333 100644 --- a/bitbake/lib/toaster/toastergui/templates/layers.html +++ b/bitbake/lib/toaster/toastergui/templates/layers.html @@ -52,12 +52,15 @@ {% endif %} - {% if o.branch %} - {{o.branch}} - {% else %} - {{o.up_branch.name}} - - {% endif %} + {% with vcs_ref=o.get_vcs_reference %} + {% if vcs_ref|is_shaid %} + + {{vcs_ref|truncatechars:10}} + + {% else %} + {{vcs_ref}} + {% endif %} + {% endwith %} {% with ods=o.dependencies.all%} diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 276c6eb098..e66910cd9d 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py @@ -295,3 +295,15 @@ def format_build_date(completed_on): if delta.days >= 1: return True + +@register.filter +def is_shaid(text): + """ return True if text length is 40 characters and all hex-digits + """ + try: + int(text, 16) + if len(text) == 40: + return True + return False + except ValueError: + return False