Show More
@@ -153,7 +153,10 b' def checkheads(repo, remote, outgoing, r' | |||
|
153 | 153 | branches = set(repo[n].branch() for n in outgoing.missing) |
|
154 | 154 | |
|
155 | 155 | # 2. Check for new branches on the remote. |
|
156 | remotemap = remote.branchmap() | |
|
156 | if remote.local(): | |
|
157 | remotemap = phases.visiblebranchmap(remote) | |
|
158 | else: | |
|
159 | remotemap = remote.branchmap() | |
|
157 | 160 | newbranches = branches - set(remotemap) |
|
158 | 161 | if newbranches and not newbranch: # new branch requires --new-branch |
|
159 | 162 | branchnames = ', '.join(sorted(newbranches)) |
@@ -263,6 +263,28 b' def visibleheads(repo):' | |||
|
263 | 263 | vheads = repo.heads() |
|
264 | 264 | return vheads |
|
265 | 265 | |
|
266 | def visiblebranchmap(repo): | |
|
267 | """return a branchmap for the visible set""" | |
|
268 | # XXX Recomputing this data on the fly is very slow. We should build a | |
|
269 | # XXX cached version while computin the standard branchmap version. | |
|
270 | sroots = repo._phaseroots[secret] | |
|
271 | if sroots: | |
|
272 | vbranchmap = {} | |
|
273 | for branch, nodes in repo.branchmap().iteritems(): | |
|
274 | # search for secret heads. | |
|
275 | for n in nodes: | |
|
276 | if repo[n].phase() >= secret: | |
|
277 | nodes = None | |
|
278 | break | |
|
279 | # if secreat heads where found we must compute them again | |
|
280 | if nodes is None: | |
|
281 | s = repo.set('heads(branch(%s) - secret())', branch) | |
|
282 | nodes = [c.node() for c in s] | |
|
283 | vbranchmap[branch] = nodes | |
|
284 | else: | |
|
285 | vbranchmap = repo.branchmap() | |
|
286 | return vbranchmap | |
|
287 | ||
|
266 | 288 | def analyzeremotephases(repo, subset, roots): |
|
267 | 289 | """Compute phases heads and root in a subset of node from root dict |
|
268 | 290 |
@@ -396,7 +396,7 b' def between(repo, proto, pairs):' | |||
|
396 | 396 | return "".join(r) |
|
397 | 397 | |
|
398 | 398 | def branchmap(repo, proto): |
|
399 |
branchmap = repo |
|
|
399 | branchmap = phases.visiblebranchmap(repo) | |
|
400 | 400 | heads = [] |
|
401 | 401 | for branch, nodes in branchmap.iteritems(): |
|
402 | 402 | branchname = urllib.quote(encoding.fromlocal(branch)) |
@@ -833,12 +833,20 b' Discovery locally secret changeset on a ' | |||
|
833 | 833 | o 0 public a-A - 054250a37db4 |
|
834 | 834 | |
|
835 | 835 | |
|
836 |
pushing a locally public and draft changesets remotly secret should make them |
|
|
836 | pushing a locally public and draft changesets remotly secret should make them | |
|
837 | appear on the remote side. | |
|
838 | ||
|
837 | 839 | |
|
838 | 840 | $ hg -R ../mu phase --secret --force 967b449fbc94 |
|
839 | 841 | $ hg push -r 435b5d83910c ../mu |
|
840 | 842 | pushing to ../mu |
|
841 | 843 | searching for changes |
|
844 | abort: push creates new remote head 435b5d83910c! | |
|
845 | (did you forget to merge? use push -f to force) | |
|
846 | [255] | |
|
847 | $ hg push -fr 435b5d83910c ../mu # because the push will create new visible head | |
|
848 | pushing to ../mu | |
|
849 | searching for changes | |
|
842 | 850 | adding changesets |
|
843 | 851 | adding manifests |
|
844 | 852 | adding file changes |
@@ -135,6 +135,39 b' Test secret changeset are not pushed' | |||
|
135 | 135 | 2 1 C |
|
136 | 136 | 1 0 B |
|
137 | 137 | 0 0 A |
|
138 | ||
|
139 | (Issue3303) | |
|
140 | Check that remote secret changeset are ignore when checking creation of remote heads | |
|
141 | ||
|
142 | We add a secret head into the push destination. This secreat head shadow a | |
|
143 | visible shared between the initial repo and the push destination. | |
|
144 | ||
|
145 | $ hg up -q 4 # B' | |
|
146 | $ mkcommit Z --config phases.new-commit=secret | |
|
147 | $ hg phase . | |
|
148 | 5: secret | |
|
149 | ||
|
150 | # We now try to push a new public changeset that descend from the common public | |
|
151 | # head shadowed by the remote secret head. | |
|
152 | ||
|
153 | $ cd ../initialrepo | |
|
154 | $ hg up -q 6 #B' | |
|
155 | $ mkcommit I | |
|
156 | created new head | |
|
157 | $ hg push ../push-dest | |
|
158 | pushing to ../push-dest | |
|
159 | searching for changes | |
|
160 | adding changesets | |
|
161 | adding manifests | |
|
162 | adding file changes | |
|
163 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
164 | ||
|
165 | :note: The "(+1 heads)" is wrong as we do not had any visible head | |
|
166 | ||
|
167 | ||
|
168 | Restore condition prior extra insertion. | |
|
169 | $ hg -q --config extensions.mq= strip . | |
|
170 | $ hg up -q 7 | |
|
138 | 171 | $ cd .. |
|
139 | 172 | |
|
140 | 173 | Test secret changeset are not pull |
General Comments 0
You need to be logged in to leave comments.
Login now