[PATCH] filectx: fix annotate to not directly instantiate filectx

Durham Goode durham at fb.com
Fri Jan 9 19:28:06 UTC 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1420831289 28800
#      Fri Jan 09 11:21:29 2015 -0800
# Node ID 83700e5605006fbddab0b02b695da6b9a0e106fd
# Parent  bb3ee61cfaa1d3f085c7577f48f566a0f31a6985
filectx: fix annotate to not directly instantiate filectx

28a302e9225d changed basefilectx.annotate() to directly instantiate new
filectx's instead of going through self.filectx(), this breaks extensions that
replace the filectx class, and would also break future uses that would need
memfilectx's.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -893,8 +893,7 @@ class basefilectx(object):
         base = self
         introrev = self.introrev()
         if self.rev() != introrev:
-            base = filectx(self._repo, self._path, filelog=self.filelog(),
-                           fileid=self.filenode(), changeid=introrev)
+            base = self.filectx(self.filenode(), changeid=introrev)
 
         # This algorithm would prefer to be recursive, but Python is a
         # bit recursion-hostile. Instead we do an iterative
@@ -1000,11 +999,11 @@ class filectx(basefilectx):
             # considered when solving linkrev issue are on the table.
             return changectx(self._repo.unfiltered(), self._changeid)
 
-    def filectx(self, fileid):
+    def filectx(self, fileid, changeid=None):
         '''opens an arbitrary revision of the file without
         opening a new filelog'''
         return filectx(self._repo, self._path, fileid=fileid,
-                       filelog=self._filelog)
+                       filelog=self._filelog, changeid=changeid)
 
     def data(self):
         try:


More information about the Mercurial-devel mailing list