git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] remote-hg: simplify shared repo setup

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Aug 9, 2013, 20:03 UTC
Message-ID
<1376078581-24766-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1376078581-24766-1-git-send-email-felipe.contreras@gmail.com>

We don't need the initial clone, if the repository is shared, pulling from the child updates the parent's storage; it's exactly the same as cloning.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-hg | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 0194c67..cfd4f53 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -391,11 +391,12 @@ def get_repo(url, alias):
             os.makedirs(dirname)
     else:
         shared_path = os.path.join(gitdir, 'hg')
-        if not os.path.exists(shared_path):
-            try:
-                hg.clone(myui, {}, url, shared_path, update=False, pull=True)
-            except:
-                die('Repository error')
+
+        # setup shared repo (if not there)
+        try:
+            hg.peer(myui, {}, shared_path, create=True)
+        except error.RepoError:
+            pass
 
         if not os.path.exists(dirname):
             os.makedirs(dirname)
-- 
1.8.3.267.gbb4989f
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 6 in “remote-hg: shared repo upgrade fix”
  1. 0/2 remote-hg: shared repo upgrade fixFelipe Contreras, Aug 9, 2013
  2. 1/2 remote-hg: simplify shared repo setupFelipe Contreras, Aug 9, 2013
  3. 2/2 remote-hg: add shared repo upgradeFelipe Contreras, Aug 9, 2013
  4. Antoine PelisseAug 9, 2013
  5. Felipe ContrerasAug 9, 2013
  6. Junio C HamanoAug 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.