[Toaster] [PATCH] layers: Use the new get_vcs_reference to get the "revision" of a layer

Barros Pena, Belen belen.barros.pena at intel.com
Thu Mar 5 06:46:23 PST 2015



On 04/03/2015 21:25, "Lerner, Dave" <dave.lerner at windriver.com> wrote:

>Belen, Michael
>
>The patch that Michael has sent does NOT implement the same logic.  I
>have tested it after looking at the code and my suspicions were
>confirmed.  Perhaps the original logic had a bug but here is the end
>result.
>
>With original logic and my patch:
>    All layers page, meta-gumstix layer 'dora' DOES NOT have a help icon.
>With Michaels patch below:
>    All layers page, meta-gumstix layer 'dora' DOES have a help icon.
>
>You can see this from the diff of Michael's version versus original
>master:
>         </td>
>             <td class="branch">
>-                {% if o.branch %}
>-                    {{o.branch}}
>-                {% else %}
>-                    {{o.up_branch.name}}
><<<< NOTE Original: help icon only if o.branch is null, the case for
>'master' but not for 'dora'
>-                    <i class="icon-question-sign get-help hover-help"
>title="Your builds will use the tip of the branch you have cloned or
>downloaded to your computer, so
>-                {% endif %}
>+                {% with vcs_ref=o.get_vcs_reference %}
>+                  {% if vcs_ref|is_shaid %}
>+                    <a class="btn" data-content="<ul class='unstyled'>
><li>{{o.branch}}</li> </ul>">
>+                      {{vcs_ref|truncatechars:10}}
>+                    </a>
>+                  {% else %}
>+                    {{vcs_ref}}
>+                  {% endif %}
>+                {% endwith %}
><<<< NOTE Michaels' patch: there is always a help icon, for 'dora' and
>'master'
>+                <i class="icon-question-sign get-help hover-help"
>title="Your builds will use the tip of the branch you have cloned or
>downloaded to your computer, so noth
>             </td>
>             <td class="dependencies">
>         {% with ods=o.dependencies.all%}
>
>
>Belen,
>Which way do you want the logic, only when no 'branch' but only upstream
>branch?

Right, sorry for the confusion. The help text there was supposed to appear
only when the revision says "HEAD", as a way to explain what that means.
That's obsolete at this point, I think, so I think we can safely ignore
it. 

Thanks!

Belén



>Dave
>
>> -----Original Message-----
>> From: Michael Wood [mailto:michael.g.wood at intel.com]
>> Sent: Wednesday, March 04, 2015 12:12 PM
>> To: Lerner, Dave
>> Cc: BARROS PENA, BELEN; WOOD, MICHAEL
>> Subject: [PATCH] layers: Use the new get_vcs_reference to get the
>>"revision" of a layer
>>
>> We now use get_vcs_reference so that we get the most appropriate
>> layer revision to display to the user.
>>
>> Signed-off-by: Michael Wood <michael.g.wood at intel.com>
>> ---
>>  .../lib/toaster/toastergui/templates/layers.html   | 24
>>++++++++--------------
>>  .../toaster/toastergui/templatetags/projecttags.py |  3 +--
>>  2 files changed, 9 insertions(+), 18 deletions(-)
>>
>> diff --git a/bitbake/lib/toaster/toastergui/templates/layers.html
>> b/bitbake/lib/toaster/toastergui/templates/layers.html
>> index aeaeb9a..7fc0fd3 100644
>> --- a/bitbake/lib/toaster/toastergui/templates/layers.html
>> +++ b/bitbake/lib/toaster/toastergui/templates/layers.html
>> @@ -52,24 +52,16 @@
>>                  {% endif %}
>>          </td>
>>              <td class="branch">
>> -                {% if o.branch %}
>> -                    {% if o.branch|is_shaid %}
>> -                    <a class="btn" data-content="<ul class='unstyled'>
>> <li>{{o.branch}}</li> </ul>">
>> -                        {{o.branch|truncatechars:10}}
>> +              {% with vcs_ref=o.get_vcs_reference %}
>> +                {% if vcs_ref|is_shaid %}
>> +                    <a class="btn" data-content="<ul class='unstyled'>
>> <li>{{vcs_ref}}</li> </ul>">
>> +                        {{vcs_ref|truncatechars:10}}
>>                      </a>
>> -                    {% else %}
>> -                        {{o.branch}}
>> -                    {% endif %}
>> -                {% else %}
>> -                    {% if o.branch|is_shaid %}
>> -                    <a class="btn" data-content="<ul class='unstyled'>
>> <li>{{o.branch}}</li> </ul>">
>> -                        {{o.up_branch.name|truncatechars:10}}
>> -                    </a>
>> -                    {% else %}
>> -                        {{o.up_branch.name}}
>> -                    {% endif %}
>> -                    <i class="icon-question-sign get-help hover-help"
>>title="Your
>> builds will use the tip of the branch you have cloned or downloaded to
>>your computer, so
>> nothing will be fetched"></i>
>> +                 {% else %}
>> +                  {{vcs_ref}}
>>                  {% endif %}
>> +                {% endwith %}
>> +                <i class="icon-question-sign get-help hover-help"
>>title="Your builds
>> will use the tip of the branch you have cloned or downloaded to your
>>computer, so
>> nothing will be fetched"></i>
>>              </td>
>>              <td class="dependencies">
>>          {% with ods=o.dependencies.all%}
>> diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>> b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>> index 61a01ca..73a59be 100644
>> --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>> +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>> @@ -304,7 +304,6 @@ def is_shaid(text):
>>          int(text, 16)
>>          if len(text) == 40:
>>              return True
>> -        return False
>> +        return False
>>      except:
>>          return False
>> -
>> --
>> 2.1.0
>



More information about the toaster mailing list