So that we can report a proper error. Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- contrib/remote-helpers/git-remote-hg | 24 ++++++++++++++++++++++++ contrib/remote-helpers/test-hg.sh | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index 5a5667d..df3b9a4 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -839,6 +839,23 @@ def write_tag(repo, tag, node, msg, author): return (tagnode, branch) +def checkheads_bmark(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 ctx_old.descendant(ctx_new): + print "error %s non-fast forward" % ref + return False + + return True + def checkheads(repo, remote, p_revs): remotemap = remote.branchmap() @@ -855,6 +872,13 @@ def checkheads(repo, remote, p_revs): if not branch in remotemap: # new branch continue + if not ref.startswith('refs/heads/branches'): + if ref.startswith('refs/heads/'): + if not checkheads_bmark(ref, ctx): + ret = False + + # only check branches + continue new.setdefault(branch, []).append(ctx.rev()) for branch, heads in new.iteritems(): diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh index 4f6fd4c..ecf7bd4 100755 --- a/contrib/remote-helpers/test-hg.sh +++ b/contrib/remote-helpers/test-hg.sh @@ -320,7 +320,7 @@ test_expect_success 'remote update bookmark diverge' ' 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*" && ( -- 1.8.3.rc1.579.g184e698 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html