Patchwork [1,of,9] localrepo: make it clear that changegroupsubset doesn't take bases but roots

login
register
mail settings
Submitter Mads Kiilerich
Date Feb. 10, 2014, 12:01 a.m.
Message ID <23335d0a2a4b55ae94c9.1391990470@localhost.localdomain>
Download mbox | patch
Permalink /patch/3526/
State Accepted
Commit 9e331f1f05730e8d1e4d37fcba7ff95ec39e992b
Headers show

Comments

Mads Kiilerich - Feb. 10, 2014, 12:01 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1391989936 -3600
#      Mon Feb 10 00:52:16 2014 +0100
# Node ID 23335d0a2a4b55ae94c96819d12adfb67b22c609
# Parent  b0638b5b004d575faeb363cd6028d356dc146bc2
localrepo: make it clear that changegroupsubset doesn't take bases but roots

changegroupsubset will take the parents of the roots to find the bases.

Other parts of Mercurial do not expect that, and a result of that is that some
bundles contain more changesets than necessary.

No real changes here - just renaming a parameter to document what it is.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1761,9 +1761,9 @@  class localrepository(object):
             for node in nodes:
                 self.ui.debug("%s\n" % hex(node))
 
-    def changegroupsubset(self, bases, heads, source):
+    def changegroupsubset(self, roots, heads, source):
         """Compute a changegroup consisting of all the nodes that are
-        descendants of any of the bases and ancestors of any of the heads.
+        descendants of any of the roots and ancestors of any of the heads.
         Return a chunkbuffer object whose read() method will return
         successive changegroup chunks.
 
@@ -1775,12 +1775,12 @@  class localrepository(object):
         the changegroup a particular filenode or manifestnode belongs to.
         """
         cl = self.changelog
-        if not bases:
-            bases = [nullid]
+        if not roots:
+            roots = [nullid]
         # TODO: remove call to nodesbetween.
-        csets, bases, heads = cl.nodesbetween(bases, heads)
+        csets, roots, heads = cl.nodesbetween(roots, heads)
         discbases = []
-        for n in bases:
+        for n in roots:
             discbases.extend([p for p in cl.parents(n) if p != nullid])
         outgoing = discovery.outgoing(cl, discbases, heads)
         bundler = changegroup.bundle10(self)