From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v4 09/21] remote-hg: refactor export
Date: Thu, 11 Apr 2013 07:23:05 -0500 [thread overview]
Message-ID: <1365682997-11329-10-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1365682997-11329-1-git-send-email-felipe.contreras@gmail.com>
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/remote-helpers/git-remote-hg | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 73cd812..3ceec85 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -9,7 +9,7 @@
# Then you can clone with:
# git clone hg::/path/to/mercurial/repo/
-from mercurial import hg, ui, bookmarks, context, util, encoding
+from mercurial import hg, ui, bookmarks, context, util, encoding, node
import re
import sys
@@ -60,6 +60,9 @@ def hgmode(mode):
m = { '100755': 'x', '120000': 'l' }
return m.get(mode, '')
+def hghex(node):
+ return hg.node.hex(node)
+
def get_config(config):
cmd = ['git', 'config', '--get', config]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
@@ -705,19 +708,18 @@ def do_export(parser):
for ref, node in parsed_refs.iteritems():
if ref.startswith('refs/heads/branches'):
- pass
+ print "ok %s" % ref
elif ref.startswith('refs/heads/'):
bmark = ref[len('refs/heads/'):]
p_bmarks.append((bmark, node))
- # handle below
continue
elif ref.startswith('refs/tags/'):
tag = ref[len('refs/tags/'):]
parser.repo.tag([tag], node, None, True, None, {})
+ print "ok %s" % ref
else:
# transport-helper/fast-export bugs
continue
- print "ok %s" % ref
if peer:
parser.repo.push(peer, force=False)
@@ -725,6 +727,7 @@ def do_export(parser):
# handle bookmarks
for bmark, node in p_bmarks:
ref = 'refs/heads/' + bmark
+ new = hghex(node)
if bmark in bmarks:
old = bmarks[bmark].hex()
@@ -733,10 +736,11 @@ def do_export(parser):
if bmark == 'master' and 'master' not in parser.repo._bookmarks:
# fake bookmark
- print "ok %s" % ref
- continue
-
- if not bookmarks.pushbookmark(parser.repo, bmark, old, node):
+ pass
+ elif bookmarks.pushbookmark(parser.repo, bmark, old, new):
+ # updated locally
+ pass
+ else:
print "error %s" % ref
continue
--
1.8.2.1
next prev parent reply other threads:[~2013-04-11 12:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 12:22 [PATCH v4 00/21] remote-hg: general updates Felipe Contreras
2013-04-11 12:22 ` [PATCH v4 01/21] remote-hg: trivial cleanups Felipe Contreras
2013-04-11 12:22 ` [PATCH v4 02/21] remote-hg: add missing config variable in doc Felipe Contreras
2013-04-11 12:22 ` [PATCH v4 03/21] remote-hg: properly report errors on bookmark pushes Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 04/21] remote-hg: fix for files with spaces Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 05/21] remote-hg: make sure fake bookmarks are updated Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 06/21] remote-hg: trivial test cleanups Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 07/21] remote-hg: redirect buggy mercurial output Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 08/21] remote-hg: split bookmark handling Felipe Contreras
2013-04-11 12:23 ` Felipe Contreras [this message]
2013-04-11 12:23 ` [PATCH v4 10/21] remote-hg: update remote bookmarks Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 11/21] remote-hg: update tags globally Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 12/21] remote-hg: push to the appropriate branch Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 13/21] remote-hg: force remote push Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 14/21] remote-hg: show more proper errors Felipe Contreras
2013-05-27 16:30 ` Antoine Pelisse
2013-05-27 16:49 ` Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 15/21] remote-hg: add basic author tests Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 16/21] remote-hg: add simple mail test Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 17/21] remote-hg: add 'insecure' option Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 18/21] remote-hg: fix bad state issue Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 19/21] remote-hg: document location of stored hg repository Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 20/21] remote-hg: fix bad file paths Felipe Contreras
2013-04-11 12:23 ` [PATCH v4 21/21] remote-hg: activate graphlog extension for hg_log() Felipe Contreras
2013-04-11 17:50 ` [PATCH v4 00/21] remote-hg: general updates Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365682997-11329-10-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).