identify: build the tag list directly instead of using wctx.tags()
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 28 Jun 2015 13:22:17 -0400
changeset 25684 0f894d2203c8
parent 25683 3b1fc40626d8
child 25685 51658e676cc3
identify: build the tag list directly instead of using wctx.tags() The current implementation of workingctx.tags() returns the tags of the parents. This causes the calculation of {lastesttagdistance} from wdir() to be wrong. The value when updated to a tag is 0, but updated to the tag's child is 2, the child of that 3, and so on. This prepares for workingctx.tags() to not report the parent tags.
mercurial/commands.py
--- a/mercurial/commands.py	Sun Jun 28 18:39:58 2015 -0400
+++ b/mercurial/commands.py	Sun Jun 28 13:22:17 2015 -0400
@@ -4069,6 +4069,10 @@
         if ctx.rev() is None:
             ctx = repo[None]
             parents = ctx.parents()
+            taglist = []
+            for p in parents:
+                taglist.extend(p.tags())
+
             changed = ""
             if default or id or num:
                 if (any(repo.status())
@@ -4085,6 +4089,7 @@
                 output = [hexfunc(ctx.node())]
             if num:
                 output.append(str(ctx.rev()))
+            taglist = ctx.tags()
 
         if default and not ui.quiet:
             b = ctx.branch()
@@ -4092,7 +4097,7 @@
                 output.append("(%s)" % b)
 
             # multiple tags for a single parent separated by '/'
-            t = '/'.join(ctx.tags())
+            t = '/'.join(taglist)
             if t:
                 output.append(t)
 
@@ -4105,7 +4110,7 @@
                 output.append(ctx.branch())
 
             if tags:
-                output.extend(ctx.tags())
+                output.extend(taglist)
 
             if bookmarks:
                 output.extend(ctx.bookmarks())