# HG changeset patch # User Anton Shestakov # Date 1610295820 -28800 # Node ID 644286633371a14feeb5843a1f58af523ea98bd5 # Parent 5abae69db9771f452026b0e88ddc268835f972a0 evolve: import mercurial.node as nodemod Makes it easier to do e.g. debugging in functions that uses `node` as a variable name. For the record, variable named `node` is used 5 times in this file. mercurial.node module is used in 4 cases seen in this patch and 2 of them already can be written without using `node` (nullid is imported directly). diff -r 5abae69db977 -r 644286633371 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Mon Jan 11 00:20:27 2021 +0800 +++ b/hgext3rd/evolve/__init__.py Mon Jan 11 00:23:40 2021 +0800 @@ -266,7 +266,7 @@ help, hg, lock as lockmod, - node, + node as nodemod, pycompat, revset, ) @@ -652,7 +652,7 @@ if rev.node() == prevnode and wasobs: return msg = _(b"working directory parent is obsolete! (%s)\n") - shortnode = node.short(rev.node()) + shortnode = nodemod.short(rev.node()) ui.warn(msg % shortnode) @@ -755,7 +755,7 @@ def _getnodefrompatch(patch, dest): patchnode = patch.get(b'nodeid') if patchnode is not None: - dest[b'node'] = node.bin(patchnode) + dest[b'node'] = nodemod.bin(patchnode) @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): @@ -878,7 +878,7 @@ parents = [ctx for ctx in parents if ctx.topic() == currenttopic] # issue message for the various case - if p1.node() == node.nullid: + if p1.node() == nullid: repo.ui.warn(_(b'already at repository root\n')) elif not parents and currenttopic: repo.ui.warn(_(b'no parent in topic "%s"\n') % currenttopic) @@ -1192,7 +1192,7 @@ if r'debugobsconvert' in sys.argv: return for mark in markers: - if node.nullid in mark[1]: + if nullid in mark[1]: msg = _(b'bad obsolescence marker detected: invalid successors nullid') hint = _(b'You should run `hg debugobsconvert`') raise error.Abort(msg, hint=hint)