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 <felipe.contreras@gmail.com>
This commit is contained in:
Felipe Contreras
2023-03-09 18:44:01 -06:00
parent 23f41c0ff1
commit 534d2bdd92
2 changed files with 3 additions and 12 deletions

View File

@@ -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

View File

@@ -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