[PATCH] fix hg bundle bug, rev 2
Sune Foldager
cryo at cyanite.org
Sat May 12 12:11:15 CDT 2012
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1336842668 -7200
# Branch stable
# Node ID e94c6d3446d9748cfb84222fc4c423d740c14547
# Parent 41aad55ce0937b0e79d5744d60c975c22df1d7bf
fix hg bundle bug, rev 2
diff -r 41aad55ce093 -r e94c6d3446d9 mercurial/commands.py
--- a/mercurial/commands.py Sat May 12 18:37:53 2012 +0200
+++ b/mercurial/commands.py Sat May 12 19:11:08 2012 +0200
@@ -1009,7 +1009,8 @@
heads = revs and map(repo.lookup, revs) or revs
outgoing = discovery.findcommonoutgoing(repo, other,
onlyheads=heads,
- force=opts.get('force'))
+ force=opts.get('force'),
+ portable=True)
cg = repo.getlocalbundle('bundle', outgoing)
if not cg:
scmutil.nochangesfound(ui, outgoing and outgoing.excluded)
diff -r 41aad55ce093 -r e94c6d3446d9 mercurial/discovery.py
--- a/mercurial/discovery.py Sat May 12 18:37:53 2012 +0200
+++ b/mercurial/discovery.py Sat May 12 19:11:08 2012 +0200
@@ -86,7 +86,8 @@
self._computecommonmissing()
return self._missing
-def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
+def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None,
+ portable=False):
'''Return an outgoing instance to identify the nodes present in repo but
not in other.
@@ -95,7 +96,10 @@
onlyheads is faster than letting them be recomputed here.
If commoninc is given, it must the the result of a prior call to
- findcommonincoming(repo, other, force) to avoid recomputing it here.'''
+ findcommonincoming(repo, other, force) to avoid recomputing it here.
+
+ If portable is given, compute more conservative common and missingheads,
+ to make bundles created from the instance more portable.'''
# declare an empty outgoing object to be filled later
og = outgoing(repo.changelog, None, None)
@@ -129,6 +133,16 @@
missingheads = onlyheads
og.missingheads = missingheads
+ if portable:
+ # recompute common and missingheads as if -r<rev> had been given
+ # for each head of missing
+ og._computecommonmissing()
+ cl = repo.changelog
+ missingrevs = set(cl.rev(n) for n in og._missing)
+ og._common = set(cl.ancestors(*missingrevs)) - missingrevs
+ commonheads = set(og.commonheads)
+ og.missingheads = [h for h in og.missingheads if h not in commonheads]
+
return og
def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False):
diff -r 41aad55ce093 -r e94c6d3446d9 tests/test-bundle.t
--- a/tests/test-bundle.t Sat May 12 18:37:53 2012 +0200
+++ b/tests/test-bundle.t Sat May 12 19:11:08 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
diff -r 41aad55ce093 -r e94c6d3446d9 tests/test-check-code-hg.t
--- a/tests/test-check-code-hg.t Sat May 12 18:37:53 2012 +0200
+++ b/tests/test-check-code-hg.t Sat May 12 19:11:08 2012 +0200
@@ -423,9 +423,6 @@
mercurial/discovery.py:0:
> If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
warning: line over 80 characters
- mercurial/discovery.py:0:
- > def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
- warning: line over 80 characters
mercurial/dispatch.py:0:
> " (.hg not found)") % os.getcwd())
warning: line over 80 characters
More information about the Mercurial-devel
mailing list