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

[PATCH v3 4/6] remote-hg: add support for trivial features

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Oct 21, 2012, 17:49 UTC
Message-ID
<1350841744-21564-5-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1350841744-21564-1-git-send-email-felipe.contreras@gmail.com>
So that the other remote-hg tests don't barf.
I'm not particularily happy with this code, but does the trick.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-hg/git-remote-hg | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/contrib/remote-hg/git-remote-hg b/contrib/remote-hg/git-remote-hg
index 34a00cd..772bb69 100755
--- a/contrib/remote-hg/git-remote-hg
+++ b/contrib/remote-hg/git-remote-hg
@@ -12,6 +12,7 @@ import re
 import sys
 import os
 import json
+import shutil
 
 first = True
 
@@ -172,7 +173,13 @@ def get_repo(url, alias):
     myui = ui.ui()
     myui.setconfig('ui', 'interactive', 'off')
 
-    if hg.islocal(url):
+    if url.startswith("remote://"):
+        remote = True
+        url = "file://%s" % url[9:]
+    else:
+        remote = False
+
+    if hg.islocal(url) and not remote:
         repo = hg.repository(myui, url)
     else:
         local_path = os.path.join(dirname, 'clone')
@@ -442,6 +449,12 @@ def main(args):
     url = args[2]
     peer = None
 
+    if not alias.isalnum():
+        is_tmp = True
+        alias = "tmp"
+    else:
+        is_tmp = False
+
     gitdir = os.environ['GIT_DIR']
     dirname = os.path.join(gitdir, 'hg', alias)
     branches = {}
@@ -468,6 +481,9 @@ def main(args):
             do_export(parser)
         sys.stdout.flush()
 
-    marks.store()
+    if not is_tmp:
+        marks.store()
+    else:
+        shutil.rmtree(dirname)
 
 sys.exit(main(sys.argv))
-- 
1.8.0.rc2.7.g0961fdf.dirty
Previous: Felipe ContrerasNext: Felipe Contreras
Message 5 of 9 in “New remote-hg helper”
  1. 0/6 New remote-hg helperFelipe Contreras, Oct 21, 2012
  2. 1/6 Add new remote-hg transport helperFelipe Contreras, Oct 21, 2012
  3. 2/6 remote-hg: add support for pushingFelipe Contreras, Oct 21, 2012
  4. 3/6 remote-hg: add support for remote pushingFelipe Contreras, Oct 21, 2012
  5. 4/6 remote-hg: add support for trivial featuresFelipe Contreras, Oct 21, 2012
  6. 5/6 tests: add remote-hg testsFelipe Contreras, Oct 21, 2012
  7. Sverre RabbelierOct 21, 2012
  8. Felipe ContrerasOct 24, 2012
  9. 6/6 tests: fix remote-hg warnings for modern gitFelipe Contreras, Oct 21, 2012

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.