remote-hg: add remote tests
authorFelipe Contreras <felipe.contreras@gmail.com>
Sat, 25 May 2013 02:29:39 +0000 (21:29 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 May 2013 14:59:57 +0000 (07:59 -0700)
The logic when working with a local repository is totally different from
the one where we work with a remote repository; we need to pull and push
from it.

All this logic is currently not tested at all, so let's introduce a
variable to force the remote behavior.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-hg
contrib/remote-helpers/test-hg.sh
index 76438a687010f2109b1a3df3593ddf39c6254302..61e6c87724eae785bb36af1d778a0f42cd10e187 100755 (executable)
@@ -383,7 +383,7 @@ def get_repo(url, alias):
 
     extensions.loadall(myui)
 
-    if hg.islocal(url):
+    if hg.islocal(url) and not os.environ.get('GIT_REMOTE_HG_TEST_REMOTE'):
         repo = hg.repository(myui, url)
         if not os.path.exists(dirname):
             os.makedirs(dirname)
index 4e56640101a0f72d878366cff6ff50ff419948e2..c36b729770ecf95309feb1de7fc4029acdd9d9c5 100755 (executable)
@@ -250,4 +250,42 @@ test_expect_success 'remote push from master branch' '
        check_branch hgrepo default one
 '
 
+GIT_REMOTE_HG_TEST_REMOTE=1
+export GIT_REMOTE_HG_TEST_REMOTE
+
+test_expect_success 'remote cloning' '
+       test_when_finished "rm -rf gitrepo*" &&
+
+       (
+       hg init hgrepo &&
+       cd hgrepo &&
+       echo zero > content &&
+       hg add content &&
+       hg commit -m zero
+       ) &&
+
+       git clone "hg::hgrepo" gitrepo &&
+       check gitrepo HEAD zero
+'
+
+test_expect_success 'remote update bookmark' '
+       test_when_finished "rm -rf gitrepo*" &&
+
+       (
+       cd hgrepo &&
+       hg bookmark devel
+       ) &&
+
+       (
+       git clone "hg::hgrepo" gitrepo &&
+       cd gitrepo &&
+       git checkout --quiet devel &&
+       echo devel > content &&
+       git commit -a -m devel &&
+       git push --quiet
+       ) &&
+
+       check_bookmark hgrepo devel devel
+'
+
 test_done