Show More
@@ -487,6 +487,8 b' def listbookmarks(repo):' | |||||
487 |
|
487 | |||
488 |
|
488 | |||
489 | def pushbookmark(repo, key, old, new): |
|
489 | def pushbookmark(repo, key, old, new): | |
|
490 | if isdivergent(key): | |||
|
491 | return False | |||
490 | if bookmarksinstore(repo): |
|
492 | if bookmarksinstore(repo): | |
491 | wlock = util.nullcontextmanager() |
|
493 | wlock = util.nullcontextmanager() | |
492 | else: |
|
494 | else: |
@@ -2368,6 +2368,11 b' def handlebookmark(op, inpart):' | |||||
2368 | b'prepushkey', throw=True, **pycompat.strkwargs(hookargs) |
|
2368 | b'prepushkey', throw=True, **pycompat.strkwargs(hookargs) | |
2369 | ) |
|
2369 | ) | |
2370 |
|
2370 | |||
|
2371 | for book, node in changes: | |||
|
2372 | if bookmarks.isdivergent(book): | |||
|
2373 | msg = _(b'cannot accept divergent bookmark %s!') % book | |||
|
2374 | raise error.Abort(msg) | |||
|
2375 | ||||
2371 | bookstore.applychanges(op.repo, op.gettransaction(), changes) |
|
2376 | bookstore.applychanges(op.repo, op.gettransaction(), changes) | |
2372 |
|
2377 | |||
2373 | if pushkeycompat: |
|
2378 | if pushkeycompat: |
@@ -856,7 +856,11 b' def _processcompared(pushop, pushed, exp' | |||||
856 | for b, scid, dcid in addsrc: |
|
856 | for b, scid, dcid in addsrc: | |
857 | if b in explicit: |
|
857 | if b in explicit: | |
858 | explicit.remove(b) |
|
858 | explicit.remove(b) | |
859 | pushop.outbookmarks.append((b, b'', scid)) |
|
859 | if bookmod.isdivergent(b): | |
|
860 | pushop.ui.warn(_(b'cannot push divergent bookmark %s!\n') % b) | |||
|
861 | pushop.bkresult = 2 | |||
|
862 | else: | |||
|
863 | pushop.outbookmarks.append((b, b'', scid)) | |||
860 | # search for overwritten bookmark |
|
864 | # search for overwritten bookmark | |
861 | for b, scid, dcid in list(advdst) + list(diverge) + list(differ): |
|
865 | for b, scid, dcid in list(advdst) + list(diverge) + list(differ): | |
862 | if b in explicit: |
|
866 | if b in explicit: |
@@ -24,6 +24,7 b'' | |||||
24 | * Use `hg copy --forget --at-rev REV` to unmark already committed |
|
24 | * Use `hg copy --forget --at-rev REV` to unmark already committed | |
25 | copies. |
|
25 | copies. | |
26 |
|
26 | |||
|
27 | * prevent pushes of divergent bookmarks (foo@remote) | |||
27 |
|
28 | |||
28 | == Bug Fixes == |
|
29 | == Bug Fixes == | |
29 |
|
30 |
@@ -328,6 +328,17 b' delete a remote bookmark' | |||||
328 |
|
328 | |||
329 | #endif |
|
329 | #endif | |
330 |
|
330 | |||
|
331 | Divergent bookmark cannot be exported | |||
|
332 | ||||
|
333 | $ hg book W@default | |||
|
334 | $ hg push -B W@default ../a | |||
|
335 | pushing to ../a | |||
|
336 | searching for changes | |||
|
337 | cannot push divergent bookmark W@default! | |||
|
338 | no changes found | |||
|
339 | [2] | |||
|
340 | $ hg book -d W@default | |||
|
341 | ||||
331 | export the active bookmark |
|
342 | export the active bookmark | |
332 |
|
343 | |||
333 | $ hg bookmark V |
|
344 | $ hg bookmark V |
General Comments 0
You need to be logged in to leave comments.
Login now