Show More
@@ -238,20 +238,6 b' def prepush(repo, remote, force, revs, n' | |||||
238 | return None, 1 |
|
238 | return None, 1 | |
239 |
|
239 | |||
240 | if not force and remoteheads != [nullid]: |
|
240 | if not force and remoteheads != [nullid]: | |
241 |
|
||||
242 | def fail_multiple_heads(unsynced, branch=None): |
|
|||
243 | if branch: |
|
|||
244 | msg = _("push creates new remote heads " |
|
|||
245 | "on branch '%s'!") % branch |
|
|||
246 | else: |
|
|||
247 | msg = _("push creates new remote heads!") |
|
|||
248 |
|
||||
249 | if unsynced: |
|
|||
250 | hint = _("you should pull and merge or use push -f to force") |
|
|||
251 | else: |
|
|||
252 | hint = _("did you forget to merge? use push -f to force") |
|
|||
253 | raise util.Abort(msg, hint=hint) |
|
|||
254 |
|
||||
255 | if remote.capable('branchmap'): |
|
241 | if remote.capable('branchmap'): | |
256 | # Check for each named branch if we're creating new remote heads. |
|
242 | # Check for each named branch if we're creating new remote heads. | |
257 | # To be a remote head after push, node must be either: |
|
243 | # To be a remote head after push, node must be either: | |
@@ -298,23 +284,12 b' def prepush(repo, remote, force, revs, n' | |||||
298 | ctxgen = (repo[n] for n in outg) |
|
284 | ctxgen = (repo[n] for n in outg) | |
299 | repo._updatebranchcache(newmap, ctxgen) |
|
285 | repo._updatebranchcache(newmap, ctxgen) | |
300 |
|
286 | |||
301 | # 5. Check for new heads. |
|
|||
302 | # If there are more heads after the push than before, a suitable |
|
|||
303 | # warning, depending on unsynced status, is displayed. |
|
|||
304 | for branch in branches: |
|
|||
305 | if len(newmap[branch]) > len(oldmap[branch]): |
|
|||
306 | return fail_multiple_heads(branch in unsynced, branch) |
|
|||
307 |
|
||||
308 | # 6. Check for unsynced changes on involved branches. |
|
|||
309 | if unsynced: |
|
|||
310 | repo.ui.warn(_("note: unsynced remote changes!\n")) |
|
|||
311 |
|
||||
312 | else: |
|
287 | else: | |
313 |
# |
|
288 | # 1-4b. old servers: Check for new topological heads. | |
314 | # Code based on _updatebranchcache. |
|
289 | # Construct {old,new}map with branch = None (topological branch). | |
315 | newheads = set(h for h in remoteheads if h in cl.nodemap) |
|
290 | # (code based on _updatebranchcache) | |
316 | oldheadcnt = len(newheads) |
|
291 | oldheads = set(h for h in remoteheads if h in cl.nodemap) | |
317 |
newheads.u |
|
292 | newheads = oldheads.union(outg) | |
318 | if len(newheads) > 1: |
|
293 | if len(newheads) > 1: | |
319 | for latest in reversed(outg): |
|
294 | for latest in reversed(outg): | |
320 | if latest not in newheads: |
|
295 | if latest not in newheads: | |
@@ -323,10 +298,31 b' def prepush(repo, remote, force, revs, n' | |||||
323 | reachable = cl.reachable(latest, cl.node(minhrev)) |
|
298 | reachable = cl.reachable(latest, cl.node(minhrev)) | |
324 | reachable.remove(latest) |
|
299 | reachable.remove(latest) | |
325 | newheads.difference_update(reachable) |
|
300 | newheads.difference_update(reachable) | |
326 | if len(newheads) > oldheadcnt: |
|
301 | branches = set([None]) | |
327 | return fail_multiple_heads(inc) |
|
302 | newmap = {None: newheads} | |
328 | if inc: |
|
303 | oldmap = {None: oldheads} | |
329 | repo.ui.warn(_("note: unsynced remote changes!\n")) |
|
304 | unsynced = inc and branches or set() | |
|
305 | ||||
|
306 | # 5. Check for new heads. | |||
|
307 | # If there are more heads after the push than before, a suitable | |||
|
308 | # warning, depending on unsynced status, is displayed. | |||
|
309 | for branch in branches: | |||
|
310 | if len(newmap[branch]) > len(oldmap[branch]): | |||
|
311 | if branch: | |||
|
312 | msg = _("push creates new remote heads " | |||
|
313 | "on branch '%s'!") % branch | |||
|
314 | else: | |||
|
315 | msg = _("push creates new remote heads!") | |||
|
316 | ||||
|
317 | if branch in unsynced: | |||
|
318 | hint = _("you should pull and merge or use push -f to force") | |||
|
319 | else: | |||
|
320 | hint = _("did you forget to merge? use push -f to force") | |||
|
321 | raise util.Abort(msg, hint=hint) | |||
|
322 | ||||
|
323 | # 6. Check for unsynced changes on involved branches. | |||
|
324 | if unsynced: | |||
|
325 | repo.ui.warn(_("note: unsynced remote changes!\n")) | |||
330 |
|
326 | |||
331 | if revs is None: |
|
327 | if revs is None: | |
332 | # use the fast path, no race possible on push |
|
328 | # use the fast path, no race possible on push |
General Comments 0
You need to be logged in to leave comments.
Login now