mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2026-07-08 19:53:04 +02:00
Handle pushing bookmarks without pushing changesets
Also prevent errors when trying to push no changesets to a peer, which some combinations of versions and extensions do not handle well; see e.g. as in felipec/git-remote-hg#32 and felipec/git-remote-hg#22
This commit is contained in:
@@ -1078,8 +1078,15 @@ def push_unsafe(repo, remote, parsed_refs, p_revs):
|
||||
fci = discovery.findcommonincoming
|
||||
commoninc = fci(repo, remote, force=force)
|
||||
common, _, remoteheads = commoninc
|
||||
fco = discovery.findcommonoutgoing
|
||||
outgoing = fco(repo, remote, onlyheads=list(p_revs), commoninc=commoninc, force=force)
|
||||
|
||||
if not checkheads(repo, remote, p_revs):
|
||||
return False
|
||||
|
||||
# nice to know about this rather than assume a bogus error
|
||||
# also, some remote peertypes might otherwise be surprised further down
|
||||
if not outgoing.missing:
|
||||
return None
|
||||
|
||||
if check_version(3, 2):
|
||||
@@ -1230,7 +1237,9 @@ def do_export(parser):
|
||||
return
|
||||
|
||||
if peer:
|
||||
if not push(parser.repo, peer, parsed_refs, p_revs):
|
||||
ret = push(parser.repo, peer, parsed_refs, p_revs)
|
||||
# None ok: nothing to push
|
||||
if ret != None and not ret:
|
||||
# do not update bookmarks
|
||||
print
|
||||
return
|
||||
|
||||
@@ -882,7 +882,7 @@ test_expect_failure 'push updates notes' '
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_failure 'push bookmark without changesets' '
|
||||
test_expect_success 'push bookmark without changesets' '
|
||||
test_when_finished "rm -rf hgrepo gitrepo" &&
|
||||
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user