From 534d2bdd92a69485355c5fb961b94a8ec2bb5b94 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 9 Mar 2023 18:44:01 -0600 Subject: [PATCH] Don't deal with the node in get_changeset() It's not necessary. It could be fetched with repo[rev].node(), but why bother? Signed-off-by: Felipe Contreras --- hg-fast-export.py | 4 ++-- hg2git.py | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/hg-fast-export.py b/hg-fast-export.py index 696f55a..7492ab4 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -296,7 +296,7 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, brmap[name]=n return n - (revnode,_,user,(time,timezone),files,desc,branch,extra)=get_changeset(ui,repo,revision,authors,encoding) + (_,user,(time,timezone),files,desc,branch,extra)=get_changeset(ui,repo,revision,authors,encoding) if repo[revision].hidden(): return count @@ -375,7 +375,7 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, return checkpoint(count) def export_note(ui,repo,revision,count,authors,encoding,is_first): - (revnode,_,user,(time,timezone),_,_,_,_)=get_changeset(ui,repo,revision,authors,encoding) + (_,user,(time,timezone),_,_,_,_)=get_changeset(ui,repo,revision,authors,encoding) if repo[revision].hidden(): return count diff --git a/hg2git.py b/hg2git.py index 420381c..a7c93dc 100755 --- a/hg2git.py +++ b/hg2git.py @@ -81,22 +81,13 @@ def get_branch(name): return name def get_changeset(ui,repo,revision,authors={},encoding=''): - # Starting with Mercurial 4.6 lookup no longer accepts raw hashes - # for lookups. Work around it by changing our behaviour depending on - # how it fails - try: - node=repo.lookup(revision) - except (TypeError, hgerror.ProgrammingError): - node=binnode(revsymbol(repo, b"%d" % revision)) # We were given a numeric rev - except hgerror.RepoLookupError: - node=revision # We got a raw hash (manifest,user,(time,timezone),files,desc,extra)=repo.changelog.read(revision) if encoding: user=user.decode(encoding).encode('utf8') desc=desc.decode(encoding).encode('utf8') tz=b"%+03d%02d" % (-timezone // 3600, ((-timezone % 3600) // 60)) branch=get_branch(extra.get(b'branch', b'')) - return (node,manifest,fixup_user(user,authors),(time,tz),files,desc,branch,extra) + return (manifest,fixup_user(user,authors),(time,tz),files,desc,branch,extra) def mangle_key(key): return key -- 2.11.4.GIT