Patchwork D4062: changegroup: move deltaparent() from narrow

login
register
mail settings
Submitter phabricator
Date Aug. 6, 2018, 6:56 a.m.
Message ID <b3823007bdea736787da7176a0ce0739@localhost.localdomain>
Download mbox | patch
Permalink /patch/33286/
State Not Applicable
Headers show

Comments

phabricator - Aug. 6, 2018, 6:56 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5839a170357d: changegroup: move deltaparent() from narrow (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4062?vs=9802&id=9943

REVISION DETAIL
  https://phab.mercurial-scm.org/D4062

AFFECTED FILES
  hgext/narrow/narrowchangegroup.py
  mercurial/changegroup.py

CHANGE DETAILS




To: indygreg, durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -851,6 +851,21 @@ 
             self._reorder = False
 
     def deltaparent(self, revlog, rev, p1, p2, prev):
+        # Narrow ellipses mode.
+        if util.safehasattr(self, 'full_nodes'):
+            # TODO: send better deltas when in narrow mode.
+            #
+            # changegroup.group() loops over revisions to send,
+            # including revisions we'll skip. What this means is that
+            # `prev` will be a potentially useless delta base for all
+            # ellipsis nodes, as the client likely won't have it. In
+            # the future we should do bookkeeping about which nodes
+            # have been sent to the client, and try to be
+            # significantly smarter about delta bases. This is
+            # slightly tricky because this same code has to work for
+            # all revlogs, and we don't have the linkrev/linknode here.
+            return p1
+
         dp = revlog.deltaparent(rev)
         if dp == nullrev and revlog.storedeltachains:
             # Avoid sending full revisions when delta parent is null. Pick prev
diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py
--- a/hgext/narrow/narrowchangegroup.py
+++ b/hgext/narrow/narrowchangegroup.py
@@ -316,20 +316,3 @@ 
         yield changegroup.ellipsisdata(
             self, rev, revlog, p1, p2, revlog.revision(n), linknode)
     extensions.wrapfunction(changegroup.cg1packer, 'revchunk', revchunk)
-
-    def deltaparent(orig, self, revlog, rev, p1, p2, prev):
-        if util.safehasattr(self, 'full_nodes'):
-            # TODO: send better deltas when in narrow mode.
-            #
-            # changegroup.group() loops over revisions to send,
-            # including revisions we'll skip. What this means is that
-            # `prev` will be a potentially useless delta base for all
-            # ellipsis nodes, as the client likely won't have it. In
-            # the future we should do bookkeeping about which nodes
-            # have been sent to the client, and try to be
-            # significantly smarter about delta bases. This is
-            # slightly tricky because this same code has to work for
-            # all revlogs, and we don't have the linkrev/linknode here.
-            return p1
-        return orig(self, revlog, rev, p1, p2, prev)
-    extensions.wrapfunction(changegroup.cg2packer, 'deltaparent', deltaparent)