changeset 24817:0bb98eee531d stable

committablefilectx: propagate ancestry info to parent to fix annotation Before this patch, annotating working directory could include wrong revisions that were hidden or belonged to different branches. This fixes wfctx.parents() to set _descendantrev so that all ancestors can take advantage of the linkrev adjustment introduced at c48924787eaa. _adjustlinkrev() can handle 'None' revision thanks to 5a12ef618c03.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 18 Apr 2015 14:10:55 +0900
parents 8eec040cb65e
children 8d7d0bf62f9f
files mercurial/context.py tests/test-annotate.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sat Apr 18 14:03:41 2015 +0900
+++ b/mercurial/context.py	Sat Apr 18 14:10:55 2015 +0900
@@ -1618,7 +1618,7 @@
         for pc in pcl[1:]:
             pl.append((path, filenode(pc, path), fl))
 
-        return [filectx(self._repo, p, fileid=n, filelog=l)
+        return [self._parentfilectx(p, fileid=n, filelog=l)
                 for p, n, l in pl if n != nullid]
 
     def children(self):
--- a/tests/test-annotate.t	Sat Apr 18 14:03:41 2015 +0900
+++ b/tests/test-annotate.t	Sat Apr 18 14:10:55 2015 +0900
@@ -556,6 +556,7 @@
   grafting 1:fd27c222e3e6 "contentB"
   $ echo C >> a
   $ hg commit -m 'contentC'
+  $ echo W >> a
   $ hg log -G
   @  changeset:   4:072f1e8df249
   |  tag:         tip
@@ -592,6 +593,12 @@
   3: B
   4: C
 
+  $ hg annotate a -r 'wdir()'
+  0 : A
+  3 : B
+  4 : C
+  4+: W
+
 Even when the starting revision is the linkrev-shadowed one:
 
   $ hg annotate a -r 3