remote-hg: add test for diverged push

Neither mercurial nor git allows pushing to a remote when it's a
non-fast-forward push. We should be able to detect these errors and
report them properly, as opposed to throwing an exception
stack-trace.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Felipe Contreras 2013-05-24 21:29:41 -05:00 коммит произвёл Junio C Hamano
Родитель e14432f798
Коммит 1a810864e8
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -318,4 +318,27 @@ test_expect_success 'remote new bookmark' '
check_bookmark hgrepo feature-b feature-b check_bookmark hgrepo feature-b feature-b
' '
test_expect_failure 'remote push diverged' '
test_when_finished "rm -rf gitrepo*" &&
git clone "hg::hgrepo" gitrepo &&
(
cd hgrepo &&
hg checkout default &&
echo bump > content &&
hg commit -m bump
) &&
(
cd gitrepo &&
echo diverge > content &&
git commit -a -m diverged &&
test_expect_code 1 git push 2> error &&
grep "^ ! \[rejected\] *master -> master (non-fast-forward)$" error
) &&
check_branch hgrepo default bump
'
test_done test_done