evolvecmd: import mercurial.node module as nodemod stable
authorPulkit Goyal <pulkit@yandex-team.ru>
Sat, 18 Aug 2018 21:01:14 +0530
branchstable
changeset 3977 a0a4f4de9ea3
parent 3976 d081528bb372
child 3978 fb8e44c70798
evolvecmd: import mercurial.node module as nodemod We use node as a variable name at few places and the conflicts with variable name are not good. Moreover this practice is followed in core mercurial also.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Sat Aug 18 20:24:41 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sat Aug 18 21:01:14 2018 +0530
@@ -21,7 +21,7 @@
     hg,
     lock as lockmod,
     merge,
-    node,
+    node as nodemod,
     obsolete,
     obsutil,
     phases,
@@ -299,7 +299,7 @@
         text += bumped.description()
 
         new = context.memctx(repo,
-                             parents=[prec.node(), node.nullid],
+                             parents=[prec.node(), nodemod.nullid],
                              text=text,
                              files=files,
                              filectxfn=filectxfn,
@@ -320,10 +320,10 @@
     # if rebased happened, update bookmarks from there too
     if rebasedbmupdate:
         rebasedbmupdate(newid)
-    repo.ui.status(_('committed as %s\n') % node.short(newid))
+    repo.ui.status(_('committed as %s\n') % nodemod.short(newid))
     # reroute the working copy parent to the new changeset
     with repo.dirstate.parentchange():
-        repo.dirstate.setparents(newid, node.nullid)
+        repo.dirstate.setparents(newid, nodemod.nullid)
     return (True, replacementnode)
 
 def _solvedivergent(ui, repo, divergent, evolvestate, dryrun=False,
@@ -535,7 +535,7 @@
     resparent = evolvestate['resolutionparent']
     try:
         with repo.dirstate.parentchange():
-            repo.dirstate.setparents(resparent, node.nullid)
+            repo.dirstate.setparents(resparent, nodemod.nullid)
 
         dirstatedance(repo, divergent, resparent, None)
 
@@ -798,7 +798,7 @@
         # We can't make any assumptions about how to update the hash if the
         # cset in question was split or diverged.
         if len(successors) == 1 and len(successors[0]) == 1:
-            newsha1 = node.hex(successors[0][0])
+            newsha1 = nodemod.hex(successors[0][0])
             commitmsg = commitmsg.replace(sha1, newsha1[:len(sha1)])
         else:
             repo.ui.note(_('The stale commit message reference to %s could '
@@ -1187,8 +1187,8 @@
                 for n in dset['divergentnodes']:
                     t = "%s (%s)" if first else " %s (%s)"
                     first = False
-                    fm.plain(t % (node.hex(n)[:hashlen], repo[n].phasestr()))
-                comprec = node.hex(dset['commonprecursor'])[:hashlen]
+                    fm.plain(t % (nodemod.hex(n)[:hashlen], repo[n].phasestr()))
+                comprec = nodemod.hex(dset['commonprecursor'])[:hashlen]
                 fm.plain(" (precursor %s)\n" % comprec)
         fm.plain("\n")
 
@@ -1207,11 +1207,11 @@
                              'sourcenode': imprec,
                              'sourcetype': 'immutableprecursor'})
         for dset in dsets:
-            divnodes = [{'node': node.hex(n),
+            divnodes = [{'node': nodemod.hex(n),
                          'phase': repo[n].phasestr(),
                         } for n in dset['divergentnodes']]
             troubles.append({'troubletype': TROUBLES['CONTENTDIVERGENT'],
-                             'commonprecursor': node.hex(dset['commonprecursor']),
+                             'commonprecursor': nodemod.hex(dset['commonprecursor']),
                              'divergentnodes': divnodes})
         fm.data(troubles=troubles)
 
@@ -1691,7 +1691,7 @@
             evolvestate.delete()
             ui.status(_('evolve aborted\n'))
             ui.status(_('working directory is now at %s\n')
-                      % node.hex(startnode)[:12])
+                      % nodemod.hex(startnode)[:12])
         else:
             raise error.Abort(_("unable to abort interrupted evolve, use 'hg "
                                 "evolve --stop' to stop evolve"))