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.contre...@gmail.com>
---
 contrib/remote-helpers/git-remote-hg |  2 +-
 contrib/remote-helpers/test-hg.sh    | 38 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/contrib/remote-helpers/git-remote-hg 
b/contrib/remote-helpers/git-remote-hg
index 776c5af..6c7392f 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -368,7 +368,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)
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index dc71c37..44764a0 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -184,4 +184,42 @@ test_expect_success 'strip' '
        test_cmp actual expected
 '
 
+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
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to