84 def missing(self): |
84 def missing(self): |
85 if self._missing is None: |
85 if self._missing is None: |
86 self._computecommonmissing() |
86 self._computecommonmissing() |
87 return self._missing |
87 return self._missing |
88 |
88 |
89 def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None): |
89 def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None, |
|
90 portable=False): |
90 '''Return an outgoing instance to identify the nodes present in repo but |
91 '''Return an outgoing instance to identify the nodes present in repo but |
91 not in other. |
92 not in other. |
92 |
93 |
93 If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive) |
94 If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive) |
94 are included. If you already know the local repo's heads, passing them in |
95 are included. If you already know the local repo's heads, passing them in |
95 onlyheads is faster than letting them be recomputed here. |
96 onlyheads is faster than letting them be recomputed here. |
96 |
97 |
97 If commoninc is given, it must the the result of a prior call to |
98 If commoninc is given, it must the the result of a prior call to |
98 findcommonincoming(repo, other, force) to avoid recomputing it here.''' |
99 findcommonincoming(repo, other, force) to avoid recomputing it here. |
|
100 |
|
101 If portable is given, compute more conservative common and missingheads, |
|
102 to make bundles created from the instance more portable.''' |
99 # declare an empty outgoing object to be filled later |
103 # declare an empty outgoing object to be filled later |
100 og = outgoing(repo.changelog, None, None) |
104 og = outgoing(repo.changelog, None, None) |
101 |
105 |
102 # get common set if not provided |
106 # get common set if not provided |
103 if commoninc is None: |
107 if commoninc is None: |
126 # update missing heads |
130 # update missing heads |
127 missingheads = phases.newheads(repo, onlyheads, excluded) |
131 missingheads = phases.newheads(repo, onlyheads, excluded) |
128 else: |
132 else: |
129 missingheads = onlyheads |
133 missingheads = onlyheads |
130 og.missingheads = missingheads |
134 og.missingheads = missingheads |
|
135 |
|
136 if portable: |
|
137 # recompute common and missingheads as if -r<rev> had been given for |
|
138 # each head of missing, and --base <rev> for each head of the proper |
|
139 # ancestors of missing |
|
140 og._computecommonmissing() |
|
141 cl = repo.changelog |
|
142 missingrevs = set(cl.rev(n) for n in og._missing) |
|
143 og._common = set(cl.ancestors(*missingrevs)) - missingrevs |
|
144 commonheads = set(og.commonheads) |
|
145 og.missingheads = [h for h in og.missingheads if h not in commonheads] |
131 |
146 |
132 return og |
147 return og |
133 |
148 |
134 def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False): |
149 def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False): |
135 """Check that a push won't add any outgoing head |
150 """Check that a push won't add any outgoing head |