[PATCH 4 of 5] adjustlinkrev: remove the inclusive parameter

Jun Wu quark at fb.com
Tue Nov 1 04:51:05 EDT 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1477885221 0
#      Mon Oct 31 03:40:21 2016 +0000
# Node ID f6c6598addaa1854f8556bacb732347256964e3e
# Parent  eead0ed124cbc59b9bb5183035aa481af3547677
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r f6c6598addaa
adjustlinkrev: remove the inclusive parameter

The parameter is only set to False when srcrev=fctx._descendantrev, in which
case inclusive could also be True with little performance impact.

Drop this parameter to make the interface cleaner.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -809,5 +809,5 @@ class basefilectx(object):
         return True
 
-    def _adjustlinkrev(self, path, filelog, fnode, srcrev, inclusive=False):
+    def _adjustlinkrev(self, path, filelog, fnode, srcrev):
         """return the first ancestor of <srcrev> introducing <fnode>
 
@@ -821,5 +821,4 @@ class basefilectx(object):
         :filelog: the filelog of this path
         :srcrev: the changeset revision we search ancestors from
-        :inclusive: if true, the src revision will also be checked
         """
         repo = self._repo
@@ -834,5 +833,4 @@ class basefilectx(object):
             # wctx case, used by workingfilectx during mergecopy
             revs = [p.rev() for p in self._repo[None].parents()]
-            inclusive = True # we skipped the real (revless) source
         else:
             revs = [srcrev]
@@ -846,5 +844,5 @@ class basefilectx(object):
                 return lkr
         # fallback to walk through the changelog
-        iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
+        iteranc = cl.ancestors(revs, lkr, inclusive=True)
         for a in iteranc:
             ac = cl.read(a) # get changeset data (we avoid object creation)
@@ -875,5 +873,5 @@ class basefilectx(object):
             return self.linkrev()
         return self._adjustlinkrev(self._path, self._filelog, self._filenode,
-                                   self.rev(), inclusive=True)
+                                   self.rev())
 
     def _parentfilectx(self, path, fileid, filelog):


More information about the Mercurial-devel mailing list