summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-04-02 14:18:23 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-04-02 14:18:23 -0700
commit125d8ecefe817db2d51dd5a85c287989ef8a0c0b (patch)
tree8071680e9aa1bb6e4a6d4f3b0ca1b05f87a22f46
parentMerge branch 'rs/pickaxe-i' (diff)
parentremote-hg: do not fail on invalid bookmarks (diff)
downloadtgif-125d8ecefe817db2d51dd5a85c287989ef8a0c0b.tar.xz
Merge branch 'ap/remote-hg-skip-null-bookmarks'
* ap/remote-hg-skip-null-bookmarks: remote-hg: do not fail on invalid bookmarks
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg5
-rwxr-xr-xcontrib/remote-helpers/test-hg.sh73
2 files changed, 77 insertions, 1 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index eb89ef6779..36b526106b 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -643,7 +643,10 @@ def do_list(parser):
print "? refs/heads/branches/%s" % gitref(branch)
for bmark in bmarks:
- print "? refs/heads/%s" % gitref(bmark)
+ if bmarks[bmark].hex() == '0000000000000000000000000000000000000000':
+ warn("Ignoring invalid bookmark '%s'", bmark)
+ else:
+ print "? refs/heads/%s" % gitref(bmark)
for tag, node in repo.tagslist():
if tag == 'tip':
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index a933b1e30c..7d90056cf3 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -772,4 +772,77 @@ test_expect_success 'remote double failed push' '
)
'
+test_expect_success 'clone remote with master null bookmark, then push to the bookmark' '
+ test_when_finished "rm -rf gitrepo* hgrepo*" &&
+
+ hg init hgrepo &&
+ (
+ cd hgrepo &&
+ echo a >a &&
+ hg add a &&
+ hg commit -m a &&
+ hg bookmark -r null master
+ ) &&
+
+ git clone "hg::hgrepo" gitrepo &&
+ check gitrepo HEAD a &&
+ (
+ cd gitrepo &&
+ git checkout --quiet -b master &&
+ echo b >b &&
+ git add b &&
+ git commit -m b &&
+ git push origin master
+ )
+'
+
+test_expect_success 'clone remote with default null bookmark, then push to the bookmark' '
+ test_when_finished "rm -rf gitrepo* hgrepo*" &&
+
+ hg init hgrepo &&
+ (
+ cd hgrepo &&
+ echo a >a &&
+ hg add a &&
+ hg commit -m a &&
+ hg bookmark -r null -f default
+ ) &&
+
+ git clone "hg::hgrepo" gitrepo &&
+ check gitrepo HEAD a &&
+ (
+ cd gitrepo &&
+ git checkout --quiet -b default &&
+ echo b >b &&
+ git add b &&
+ git commit -m b &&
+ git push origin default
+ )
+'
+
+test_expect_success 'clone remote with generic null bookmark, then push to the bookmark' '
+ test_when_finished "rm -rf gitrepo* hgrepo*" &&
+
+ hg init hgrepo &&
+ (
+ cd hgrepo &&
+ echo a >a &&
+ hg add a &&
+ hg commit -m a &&
+ hg bookmark -r null bmark
+ ) &&
+
+ git clone "hg::hgrepo" gitrepo &&
+ check gitrepo HEAD a &&
+ (
+ cd gitrepo &&
+ git checkout --quiet -b bmark &&
+ git remote -v &&
+ echo b >b &&
+ git add b &&
+ git commit -m b &&
+ git push origin bmark
+ )
+'
+
test_done