diff options
author | 2013-05-24 21:29:52 -0500 | |
---|---|---|
committer | 2013-05-28 08:02:05 -0700 | |
commit | d3c460b5b43ab67de894c9d3b6d6ce20f3f00070 (patch) | |
tree | 61f5d6201d6971b912c57e6158c4f10d5b7dc48d /contrib/remote-helpers/git-remote-hg | |
parent | remote-hg: pass around revision refs (diff) | |
download | tgif-d3c460b5b43ab67de894c9d3b6d6ce20f3f00070.tar.xz |
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>
Diffstat (limited to 'contrib/remote-helpers/git-remote-hg')
-rwxr-xr-x | contrib/remote-helpers/git-remote-hg | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index b6f85b2712..e8ebc17e75 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -859,6 +859,23 @@ def write_tag(repo, tag, node, msg, author): 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): remotemap = remote.branchmap() @@ -875,6 +892,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(repo, ref, ctx): + ret = False + + # only check branches + continue new.setdefault(branch, []).append(ctx.rev()) for branch, heads in new.iteritems(): |