In preparation to shift to SHA-1's. Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- contrib/remote-helpers/git-remote-hg | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index d82eb2d..a8591a2 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -63,6 +63,9 @@ def hgmode(mode): def hghex(node): return hg.node.hex(node) +def hgbin(node): + return hg.node.bin(node) + def get_config(config): cmd = ['git', 'config', '--get', config] process = subprocess.Popen(cmd, stdout=subprocess.PIPE) @@ -207,7 +210,7 @@ def get_filechanges(repo, ctx, parent): removed = set() cur = ctx.manifest() - prev = repo[parent].manifest().copy() + prev = parent.manifest().copy() for fn in cur: if fn in prev: @@ -326,7 +329,7 @@ def export_ref(repo, name, kind, head): else: committer = author - parents = [p for p in repo.changelog.parentrevs(rev) if p >= 0] + parents = [repo[p] for p in repo.changelog.parentrevs(rev) if p >= 0] if len(parents) == 0: modified = c.manifest().keys() @@ -372,9 +375,9 @@ def export_ref(repo, name, kind, head): print desc if len(parents) > 0: - print "from :%s" % (rev_to_mark(parents[0])) + print "from :%s" % (rev_to_mark(parents[0].rev())) if len(parents) > 1: - print "merge :%s" % (rev_to_mark(parents[1])) + print "merge :%s" % (rev_to_mark(parents[1].rev())) for f in modified: export_file(c.filectx(f)) @@ -389,10 +392,10 @@ def export_ref(repo, name, kind, head): # make sure the ref is updated print "reset %s/%s" % (prefix, ename) - print "from :%u" % rev_to_mark(rev) + print "from :%u" % rev_to_mark(head.rev()) print - marks.set_tip(ename, rev) + marks.set_tip(ename, head.rev()) def export_tag(repo, tag): export_ref(repo, tag, 'tags', repo[tag]) @@ -651,7 +654,7 @@ def parse_commit(parser): tmp = encoding.encoding encoding.encoding = 'utf-8' - node = repo.commitctx(ctx) + node = hghex(repo.commitctx(ctx)) encoding.encoding = tmp @@ -675,7 +678,7 @@ def parse_reset(parser): parser.next() node = parser.repo.changelog.node(mark_to_rev(from_mark)) - parsed_refs[ref] = node + parsed_refs[ref] = hghex(node) def parse_tag(parser): name = parser[1] @@ -720,10 +723,10 @@ def do_export(parser): elif ref.startswith('refs/tags/'): tag = ref[len('refs/tags/'):] if mode == 'git': - msg = 'Added tag %s for changeset %s' % (tag, hghex(node[:6])); - parser.repo.tag([tag], node, msg, False, None, {}) + msg = 'Added tag %s for changeset %s' % (tag, node[:6]); + parser.repo.tag([tag], hgbin(node), msg, False, None, {}) else: - parser.repo.tag([tag], node, None, True, None, {}) + parser.repo.tag([tag], hgbin(node), None, True, None, {}) print "ok %s" % ref else: # transport-helper/fast-export bugs @@ -735,7 +738,7 @@ def do_export(parser): # handle bookmarks for bmark, node in p_bmarks: ref = 'refs/heads' + bmark - new = hghex(node) + new = node if bmark in bmarks: old = bmarks[bmark].hex() -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html