changeset 39003:58377518201c

changegroup: pass state into _revisiondeltanarrow After this, the method no longer accesses self and can be split into a standalone function. Differential Revision: https://phab.mercurial-scm.org/D4195
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 07 Aug 2018 15:08:29 -0700
parents eb8a0139ace3
children e11d07cc125c
files mercurial/changegroup.py
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Tue Aug 07 14:53:42 2018 -0700
+++ b/mercurial/changegroup.py	Tue Aug 07 15:08:29 2018 -0700
@@ -707,9 +707,10 @@
                 elif linkrev not in self._precomputedellipsis:
                     delta = None
                 else:
-                    delta = self._revisiondeltanarrow(store, ischangelog,
-                                                      curr, linkrev, linknode,
-                                                      clrevtolocalrev)
+                    delta = self._revisiondeltanarrow(
+                        cl, store, ischangelog, curr, linkrev, linknode,
+                        clrevtolocalrev, self._fullclnodes,
+                        self._precomputedellipsis)
             else:
                 delta = _revisiondeltanormal(store, curr, prev, linknode,
                                              self._deltaparentfn)
@@ -1057,9 +1058,10 @@
                 self._verbosenote(_('%8.i  %s\n') % (size, fname))
         progress.complete()
 
-    def _revisiondeltanarrow(self, store, ischangelog, rev, linkrev, linknode,
-                             clrevtolocalrev):
-        linkparents = self._precomputedellipsis[linkrev]
+    def _revisiondeltanarrow(self, cl, store, ischangelog, rev, linkrev,
+                             linknode, clrevtolocalrev, fullclnodes,
+                             precomputedellipsis):
+        linkparents = precomputedellipsis[linkrev]
         def local(clrev):
             """Turn a changelog revnum into a local revnum.
 
@@ -1092,11 +1094,11 @@
                 walk = walk[1:]
                 if p in clrevtolocalrev:
                     return clrevtolocalrev[p]
-                elif p in self._fullclnodes:
-                    walk.extend([pp for pp in self._repo.changelog.parentrevs(p)
+                elif p in fullclnodes:
+                    walk.extend([pp for pp in cl.parentrevs(p)
                                     if pp != nullrev])
-                elif p in self._precomputedellipsis:
-                    walk.extend([pp for pp in self._precomputedellipsis[p]
+                elif p in precomputedellipsis:
+                    walk.extend([pp for pp in precomputedellipsis[p]
                                     if pp != nullrev])
                 else:
                     # In this case, we've got an ellipsis with parents