[PATCH 2 of 2 NOPUSH stable] fix bundle error (issue XXX)

Sune Foldager cryo at cyanite.org
Sat May 12 08:39:53 CDT 2012


# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1336829974 -7200
# Branch stable
# Node ID b81e7e187080391f0608e28fda5d11fb06c8b7ee
# Parent  381f8c47ba233d1c80489172d59a222944f465f0
fix bundle error (issue XXX)

diff -r 381f8c47ba23 -r b81e7e187080 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sat May 12 15:33:50 2012 +0200
+++ b/mercurial/localrepo.py	Sat May 12 15:39:34 2012 +0200
@@ -1782,11 +1782,7 @@
         common = set(cl.ancestors(*[cl.rev(n) for n in bases]))
         return self._changegroupsubset(common, csets, heads, source)
 
-    def getlocalbundle(self, source, outgoing):
-        """Like getbundle, but taking a discovery.outgoing as an argument.
-
-        This is only implemented for local repos and reuses potentially
-        precomputed sets in outgoing."""
+    def _getbundle(self, source, outgoing):
         if not outgoing.missing:
             return None
         return self._changegroupsubset(outgoing.common,
@@ -1794,6 +1790,18 @@
                                        outgoing.missingheads,
                                        source)
 
+    def getlocalbundle(self, source, outgoing):
+        """Like getbundle, but taking a discovery.outgoing as an argument.
+
+        This is only implemented for local repos and reuses potentially
+        precomputed sets in outgoing."""
+        # Include only ancestors of missing in the common known set
+        # See issue XXX
+        cl = self.changelog
+        missingrevs = set(cl.rev(n) for n in outgoing.missing)
+        outgoing.common = set(cl.ancestors(*missingrevs)) - missingrevs
+        return self._getbundle(source, outgoing)
+
     def getbundle(self, source, heads=None, common=None):
         """Like changegroupsubset, but returns the set difference between the
         ancestors of heads and the ancestors common.
@@ -1811,8 +1819,7 @@
             common = [nullid]
         if not heads:
             heads = cl.heads()
-        return self.getlocalbundle(source,
-                                   discovery.outgoing(cl, common, heads))
+        return self._getbundle(source, discovery.outgoing(cl, common, heads))
 
     def _changegroupsubset(self, commonrevs, csets, heads, source):
 
@@ -1826,7 +1833,7 @@
 
         # can we go through the fast path ?
         heads.sort()
-        if heads == sorted(self.heads()):
+        if source != 'bundle' and heads == sorted(self.heads()):
             return self._changegroup(csets, source)
 
         # slow path
diff -r 381f8c47ba23 -r b81e7e187080 tests/test-bundle.t
--- a/tests/test-bundle.t	Sat May 12 15:33:50 2012 +0200
+++ b/tests/test-bundle.t	Sat May 12 15:39:34 2012 +0200
@@ -586,6 +586,7 @@
   bundling: 2/2 manifests (100.00%)
   bundling: b 1/3 files (33.33%)
   bundling: b1 2/3 files (66.67%)
+  bundling: x 3/3 files (100.00%)
 
 == Test for issueXXX
 
@@ -596,8 +597,4 @@
   checking manifests
   crosschecking files in changesets and manifests
   checking files
-   x at 2: d98b3f566194 in manifests not found
-  4 files, 3 changesets, 4 total revisions
-  1 integrity errors encountered!
-  (first damaged changeset appears to be 2)
-  [1]
+  4 files, 3 changesets, 5 total revisions


More information about the Mercurial-devel mailing list