Patchwork [1,of,3,STABLE] adjustlinkrev: prepare sources revs for ancestry only once

login
register
mail settings
Submitter Pierre-Yves David
Date March 20, 2015, 7:41 a.m.
Message ID <0bfd0d3ee74a21535874.1426837293@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8198/
State Not Applicable
Headers show

Comments

Pierre-Yves David - March 20, 2015, 7:41 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1426834346 25200
#      Thu Mar 19 23:52:26 2015 -0700
# Branch stable
# Node ID 0bfd0d3ee74a21535874ca4d8cd71cd877366f78
# Parent  d0ecf62a37d0ab1c2f737a164c5d0b50af6fbb31
adjustlinkrev: prepare sources revs for ancestry only once

We'll need some more complex initialisation to handle workingfilectx case. We do
this small change in a different patch for clarify purpose.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -772,17 +772,17 @@  class basefilectx(object):
         fr = filelog.rev(fnode)
         lkr = filelog.linkrev(fr)
         # hack to reuse ancestor computation when searching for renames
         memberanc = getattr(self, '_ancestrycontext', None)
         iteranc = None
+        revs = [srcrev]
         if memberanc is None:
-            memberanc = iteranc = cl.ancestors([srcrev], lkr,
-                                               inclusive=inclusive)
+            memberanc = iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
         # check if this linkrev is an ancestor of srcrev
         if lkr not in memberanc:
             if iteranc is None:
-                iteranc = cl.ancestors([srcrev], lkr, inclusive=inclusive)
+                iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
             for a in iteranc:
                 ac = cl.read(a) # get changeset data (we avoid object creation)
                 if path in ac[3]: # checking the 'files' field.
                     # The file has been touched, check if the content is
                     # similar to the one we search for.