remote-hg: check diverged bookmarks
So that we can report a proper error. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
883d7be110
commit
d3c460b5b4
@ -859,6 +859,23 @@ def write_tag(repo, tag, node, msg, author):
|
|||||||
|
|
||||||
return (tagnode, branch)
|
return (tagnode, branch)
|
||||||
|
|
||||||
|
def checkheads_bmark(repo, ref, ctx):
|
||||||
|
if force_push:
|
||||||
|
return True
|
||||||
|
|
||||||
|
bmark = ref[len('refs/heads/'):]
|
||||||
|
if not bmark in bmarks:
|
||||||
|
# new bmark
|
||||||
|
return True
|
||||||
|
|
||||||
|
ctx_old = bmarks[bmark]
|
||||||
|
ctx_new = ctx
|
||||||
|
if not repo.changelog.descendant(ctx_old.rev(), ctx_new.rev()):
|
||||||
|
print "error %s non-fast forward" % ref
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def checkheads(repo, remote, p_revs):
|
def checkheads(repo, remote, p_revs):
|
||||||
|
|
||||||
remotemap = remote.branchmap()
|
remotemap = remote.branchmap()
|
||||||
@ -875,6 +892,13 @@ def checkheads(repo, remote, p_revs):
|
|||||||
if not branch in remotemap:
|
if not branch in remotemap:
|
||||||
# new branch
|
# new branch
|
||||||
continue
|
continue
|
||||||
|
if not ref.startswith('refs/heads/branches'):
|
||||||
|
if ref.startswith('refs/heads/'):
|
||||||
|
if not checkheads_bmark(repo, ref, ctx):
|
||||||
|
ret = False
|
||||||
|
|
||||||
|
# only check branches
|
||||||
|
continue
|
||||||
new.setdefault(branch, []).append(ctx.rev())
|
new.setdefault(branch, []).append(ctx.rev())
|
||||||
|
|
||||||
for branch, heads in new.iteritems():
|
for branch, heads in new.iteritems():
|
||||||
|
@ -380,7 +380,7 @@ test_expect_success 'remote update bookmark diverge' '
|
|||||||
check_bookmark hgrepo diverge "bump bookmark"
|
check_bookmark hgrepo diverge "bump bookmark"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'remote new bookmark multiple branch head' '
|
test_expect_success 'remote new bookmark multiple branch head' '
|
||||||
test_when_finished "rm -rf gitrepo*" &&
|
test_when_finished "rm -rf gitrepo*" &&
|
||||||
|
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user