Skip to content

Commit

Permalink
Merge branch 'ap/remote-hg-skip-null-bookmarks'
Browse files Browse the repository at this point in the history
* ap/remote-hg-skip-null-bookmarks:
  remote-hg: do not fail on invalid bookmarks
  • Loading branch information
Junio C Hamano committed Apr 2, 2014
2 parents 8132f2c + 51be46e commit 125d8ec
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/remote-helpers/git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
73 changes: 73 additions & 0 deletions contrib/remote-helpers/test-hg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 125d8ec

Please sign in to comment.