diff mercurial/context.py @ 23717:28a302e9225d

linkrev: also adjust linkrev when bootstrapping annotate (issue4305) The annotate logic now use the new 'introrev' method to bootstrap its traversal. This catches issues from linkrev-shadowing of the changeset introducing the version of a file in source changeset. More tests have been added to display pathological cases.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 24 Dec 2014 03:26:48 -0800 (2014-12-24)
parents aaa76612b3c0
children 33e5431684c0
line wrap: on
line diff
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -877,10 +877,11 @@
             return pl
 
         # use linkrev to find the first changeset where self appeared
-        if self.rev() != self.linkrev():
-            base = self.filectx(self.filenode())
-        else:
-            base = self
+        base = self
+        introrev = self.introrev()
+        if self.rev() != introrev:
+            base = filectx(self._repo, self._path, filelog=self.filelog(),
+                           fileid=self.filenode(), changeid=introrev)
 
         # This algorithm would prefer to be recursive, but Python is a
         # bit recursion-hostile. Instead we do an iterative