Git development
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Jeff King <peff@peff.net>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v3 4/6] remote-hg: add support for trivial features
Date: Sun, 21 Oct 2012 19:49:02 +0200	[thread overview]
Message-ID: <1350841744-21564-5-git-send-email-felipe.contreras@gmail.com> (raw)
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

  parent reply	other threads:[~2012-10-21 17:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21 17:48 [PATCH v3 0/6] New remote-hg helper Felipe Contreras
2012-10-21 17:48 ` [PATCH v3 1/6] Add new remote-hg transport helper Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 2/6] remote-hg: add support for pushing Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 3/6] remote-hg: add support for remote pushing Felipe Contreras
2012-10-21 17:49 ` Felipe Contreras [this message]
2012-10-21 17:49 ` [PATCH v3 5/6] tests: add remote-hg tests Felipe Contreras
2012-10-21 21:02   ` Sverre Rabbelier
2012-10-24 15:47     ` Felipe Contreras
2012-10-21 17:49 ` [PATCH v3 6/6] tests: fix remote-hg warnings for modern git Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350841744-21564-5-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=peff@peff.net \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox