Patchwork debuglabelcomplete: compute active branch heads correctly

login
register
mail settings
Submitter Bryan O'Sullivan
Date April 8, 2013, 7:49 p.m.
Message ID <279fb87a2621f2cfa347.1365450543@australite.local>
Download mbox | patch
Permalink /patch/1260/
State Accepted
Commit 46c0ca1ef7e1e62d8acfd5a20961251a640fbd3c
Headers show

Comments

Bryan O'Sullivan - April 8, 2013, 7:49 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1365450537 25200
#      Mon Apr 08 12:48:57 2013 -0700
# Node ID 279fb87a2621f2cfa347f8964b930db9cca48ce5
# Parent  565482e2ac6b71125e74adf409939bf54bad274f
debuglabelcomplete: compute active branch heads correctly

The previous computation was simply wrong.
Nikolaj Sjujskij - April 9, 2013, 8:05 a.m.
Den 2013-04-08 23:49:03 skrev Bryan O'Sullivan <bos@serpentine.com>:

> # HG changeset patch
> # User Bryan O'Sullivan <bryano@fb.com>
> # Date 1365450537 25200
> # Mon Apr 08 12:48:57 2013 -0700
> # Node ID 279fb87a2621f2cfa347f8964b930db9cca48ce5
> # Parent  565482e2ac6b71125e74adf409939bf54bad274f
> debuglabelcomplete: compute active branch heads correctly
  Seems to be fixing issue with stable branch on mercurial repo. Thanks!
Bryan O'Sullivan - April 9, 2013, 4:41 p.m.
On Tue, Apr 9, 2013 at 1:05 AM, Nikolaj Sjujskij <sterkrig@myopera.com>wrote:

>  Seems to be fixing issue with stable branch on mercurial repo. Thanks!
>

Great, I'm glad that worked for you. Pushed to crew.
Matt Mackall - April 9, 2013, 8:23 p.m.
On Tue, 2013-04-09 at 09:41 -0700, Bryan O'Sullivan wrote:
> On Tue, Apr 9, 2013 at 1:05 AM, Nikolaj Sjujskij <sterkrig@myopera.com>wrote:
> 
> >  Seems to be fixing issue with stable branch on mercurial repo. Thanks!
> >
> 
> Great, I'm glad that worked for you. Pushed to crew.

Wow, that was confusingly ambiguous. For people following along at home,
this fixes the problem with tab-completing 's' to 'stable' when used on
the Mercurial repo itself, not an "issue with the stable branch of
Mercurial", where debuglabelcomplete hasn't even landed yet.
Nikolaj Sjujskij - April 9, 2013, 8:28 p.m.
Den 2013-04-10 00:23:19 skrev Matt Mackall <mpm@selenic.com>:

> On Tue, 2013-04-09 at 09:41 -0700, Bryan O'Sullivan wrote:
>> On Tue, Apr 9, 2013 at 1:05 AM, Nikolaj Sjujskij  
>> <sterkrig@myopera.com>wrote:
>>
>>>  Seems to be fixing issue with stable branch on mercurial repo.
>> Thanks!
>>>
>>
>> Great, I'm glad that worked for you. Pushed to crew.
>
> Wow, that was confusingly ambiguous. For people following along at home,
> this fixes the problem with tab-completing 's' to 'stable' when used on
> the Mercurial repo itself, not an "issue with the stable branch of
> Mercurial", where debuglabelcomplete hasn't even landed yet.
  Sorry, mea culpa.
I kinda hoped it's clear from thread context... but forgot that we're in  
another thread now.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2078,8 +2078,12 @@  def debuglabelcomplete(ui, repo, *args):
 
     labels = set()
     labels.update(t[0] for t in repo.tagslist())
-    labels.update(repo[n].branch() for n in repo.heads())
     labels.update(repo._bookmarks.keys())
+    for tag, heads in repo.branchmap().iteritems():
+        for h in heads:
+            ctx = repo[h]
+            if not ctx.closesbranch():
+                labels.add(ctx.branch())
     completions = set()
     if not args:
         args = ['']
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -329,8 +329,10 @@  Test debuglabelcomplete
   Fum
   default
   fee
+  fie
   fo
   tip
   $ hg debuglabelcomplete f
   fee
+  fie
   fo