context: avoid using a context object as a changeid
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 29 Mar 2018 21:29:15 -0700
changeset 37172 daef13da66fe
parent 37171 d7f3fdab94c4
child 37173 05ff1a155a21
context: avoid using a context object as a changeid I find it misleading to pass changeid=changectx. It currently works to do that because there's weird (IMO) handling of it in basectx.__new__. I'm planning on removing that code. Passing changeid as "changeid" and context as "context" makes it more readable. Note that the documentation of filectx.__init__ doesn't even seem to be aware that a changeid can be a context ("changeset revision, node, or tag"). Differential Revision: https://phab.mercurial-scm.org/D2967
mercurial/localrepo.py
mercurial/merge.py
--- a/mercurial/localrepo.py	Thu Mar 29 21:15:40 2018 -0700
+++ b/mercurial/localrepo.py	Thu Mar 29 21:29:15 2018 -0700
@@ -1086,10 +1086,11 @@
                     if f not in pctx and s not in pctx:
                         self.dirstate.copy(None, f)
 
-    def filectx(self, path, changeid=None, fileid=None):
+    def filectx(self, path, changeid=None, fileid=None, changectx=None):
         """changeid can be a changeset revision, node, or tag.
            fileid can be a file revision or node."""
-        return context.filectx(self, path, changeid, fileid)
+        return context.filectx(self, path, changeid, fileid,
+                               changectx=changectx)
 
     def getcwd(self):
         return self.dirstate.getcwd()
--- a/mercurial/merge.py	Thu Mar 29 21:15:40 2018 -0700
+++ b/mercurial/merge.py	Thu Mar 29 21:29:15 2018 -0700
@@ -561,7 +561,7 @@
         fcd = self._filectxorabsent(hash, wctx, dfile)
         fco = self._filectxorabsent(onode, octx, ofile)
         # TODO: move this to filectxorabsent
-        fca = self._repo.filectx(afile, fileid=anode, changeid=actx)
+        fca = self._repo.filectx(afile, fileid=anode, changectx=actx)
         # "premerge" x flags
         flo = fco.flags()
         fla = fca.flags()