[PATCH 2 of 2] workingctx: don't report the tags for its parents

Matt Harbison mharbison72 at gmail.com
Sun Jun 28 14:34:42 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1435513083 14400
#      Sun Jun 28 13:38:03 2015 -0400
# Node ID 601770f5da477240954670d51f5ea11caa40dc20
# Parent  87c10f86c7517d0f8c42a080821c4b399d6f9755
workingctx: don't report the tags for its parents

This fixes the bad distance calculation for '{latesttagdistance}' mentioned in
the previous patch.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1247,10 +1247,7 @@
         return self._extra
 
     def tags(self):
-        t = []
-        for p in self.parents():
-            t.extend(p.tags())
-        return t
+        return []
 
     def bookmarks(self):
         b = []
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1653,7 +1653,7 @@
     "date": [*, 0], (glob)
     "desc": "",
     "bookmarks": [],
-    "tags": ["tip"],
+    "tags": [],
     "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
    }
   ]
@@ -1677,7 +1677,7 @@
     "date": [*, 0], (glob)
     "desc": "",
     "bookmarks": [],
-    "tags": ["tip"],
+    "tags": [],
     "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
     "manifest": null,
     "extra": {"branch": "default"},
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -416,6 +416,12 @@
   $ hg ci -A -m0
   adding f0
   $ hg tag tbase
+  $ hg up -qr '.^'
+  $ hg log -r 'wdir()' -T "{latesttagdistance}\n"
+  1
+  $ hg up -q
+  $ hg log -r 'wdir()' -T "{latesttagdistance}\n"
+  2
   $ cd ..
   $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone
   updating to branch default


More information about the Mercurial-devel mailing list