diff -r 27b2e1823e83 -r 9acb5cd19162 mercurial/discovery.py --- a/mercurial/discovery.py Thu May 17 15:34:59 2012 -0500 +++ b/mercurial/discovery.py Thu May 17 15:52:14 2012 -0500 @@ -87,7 +87,7 @@ return self._missing def findcommonoutgoing(repo, other, onlyheads=None, force=False, - commoninc=None): + commoninc=None, portable=False): '''Return an outgoing instance to identify the nodes present in repo but not in other. @@ -96,7 +96,10 @@ passing them in 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) @@ -130,6 +133,17 @@ missingheads = onlyheads og.missingheads = missingheads + if portable: + # recompute common and missingheads as if -r had been given for + # each head of missing, and --base for each head of the proper + # ancestors 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):