diff -r 47b8ec0eb7fb -r 025b3b763ba9 mercurial/discovery.py --- a/mercurial/discovery.py Mon May 14 19:25:13 2012 -0400 +++ b/mercurial/discovery.py Sat May 12 19:38:20 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,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):