On 6/6/07, <b class="gmail_sendername">Thomas Arendsen Hein</b> <<a href="mailto:thomas@intevation.de">thomas@intevation.de</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> + def branch_cmp(b1, b2):<br>> + # Make sure that branches who's tip is an unmerged head show<br>> + # up before all other branches.<br>> + b1_head = b1[1] in heads<br>> + b2_head = b2[1] in heads
<br>> + if b1_head and not b2_head:<br>> + return -1<br>> + if b2_head and not b1_head:<br>> + return 1<br>> + return -cmp(b1, b2) # Descending by rev #<br>> +
l.sort(branch_cmp)<br><br>Maybe it is better to add a boolean (is it a head) to each tuple as<br>the first element and then just use l.sort(); l.reverse()</blockquote><div><br>That might be. It would save an extra dict lookup. The first thing that was done with negating the revision number then negating it again on display was evil.
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Should be indented two more spaces.</blockquote><div><br>Oops.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> -foo 5:5f8fb06e083e<br>> +foo 5:5f8fb06e083e *HEAD*<br>> default 3:bf1bc2f45e83<br>> bar 2:67ec16bde7f1
<br><br>Looks like foo is no something dangerous: beware, it's a *HEAD*! :)<br><br>Suggestions:<br>- add "(inactive)" to the non-heads<br>- write " The following branches are inactive:\n" before showing
<br> the first inactive branch head.</blockquote><div><br>I want something that renders the list still susceptible to the wiles of awk. So I will choose the "(inactive)" option. You're right that "*HEAD*" is a little too scary looking.
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Both suggestions show no unneeded things with 'hg branches -a'.</blockquote>
<div><br>Thanks for the suggestions,<br></div></div>-- <br>Eric Hopper -- <a href="http://www.omnifarious.org/~hopper/">http://www.omnifarious.org/~hopper/</a><br>