changeset 5699:644286633371

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).
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 11 Jan 2021 00:23:40 +0800
parents 5abae69db977
children 15534a82f2cb
files hgext3rd/evolve/__init__.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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)