Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 51633:553eb132366f stable
bookmark: fix remote bookmark deletion when the push is raced
Before this patch, running `hg push -B book` to push the `book` bookmark
sideway at the same time as a commit making it moving forward might result in
the removal of the bookmark remotely.
After this changeset, the push can still be raced, but to remove deletion
happens. This is progress.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 11 Jun 2024 03:05:20 +0200 |
parents | 3b69324d9535 |
children | 69c5f8d6c710 |
comparison
equal
deleted
inserted
replaced
51632:fcc149f3fdcb | 51633:553eb132366f |
---|---|
715 if b in explicit: | 715 if b in explicit: |
716 explicit.remove(b) | 716 explicit.remove(b) |
717 if bookmod.isdivergent(b): | 717 if bookmod.isdivergent(b): |
718 pushop.ui.warn(_(b'cannot push divergent bookmark %s!\n') % b) | 718 pushop.ui.warn(_(b'cannot push divergent bookmark %s!\n') % b) |
719 pushop.bkresult = 2 | 719 pushop.bkresult = 2 |
720 elif pushed and repo[scid].rev() not in pushed: | |
721 # in case of race or secret | |
722 msg = _(b'cannot push bookmark X without its revision: %s!\n') | |
723 pushop.ui.warn(msg % b) | |
724 pushop.bkresult = 2 | |
720 else: | 725 else: |
721 pushop.outbookmarks.append((b, b'', scid)) | 726 pushop.outbookmarks.append((b, b'', scid)) |
722 # search for overwritten bookmark | 727 # search for overwritten bookmark |
723 for b, scid, dcid in list(advdst) + list(diverge) + list(differ): | 728 for b, scid, dcid in list(advdst) + list(diverge) + list(differ): |
724 if b in explicit: | 729 if b in explicit: |
725 explicit.remove(b) | 730 explicit.remove(b) |
726 pushop.outbookmarks.append((b, dcid, scid)) | 731 if not pushed or repo[scid].rev() in pushed: |
732 pushop.outbookmarks.append((b, dcid, scid)) | |
727 # search for bookmark to delete | 733 # search for bookmark to delete |
728 for b, scid, dcid in adddst: | 734 for b, scid, dcid in adddst: |
729 if b in explicit: | 735 if b in explicit: |
730 explicit.remove(b) | 736 explicit.remove(b) |
731 # treat as "deleted locally" | 737 # treat as "deleted locally" |