[PATCH 03 of 10 shelve-ext v4] shelve: rename stripnodes to nodestoprune

Kostia Balytskyi ikostia at fb.com
Sat Mar 11 16:00:22 EST 2017


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1489191523 28800
#      Fri Mar 10 16:18:43 2017 -0800
# Node ID 8063b183d2396f14093ebe84da9cedf17b13881d
# Parent  13c8fb8e722fd0563a83e601bb784694535268f1
shelve: rename stripnodes to nodestoprune

Since we are introducing obs-based shelve, we are no longer
stripping temporary nodes, we are obsoleting them. Therefore
it looks like stipnodes would be a misleading name, while
prune has a connotaion of "strip but with obsolescense", so
nodestoprune seems like a good rename.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -184,7 +184,7 @@ class shelvedstate(object):
             wctx = nodemod.bin(fp.readline().strip())
             pendingctx = nodemod.bin(fp.readline().strip())
             parents = [nodemod.bin(h) for h in fp.readline().split()]
-            stripnodes = [nodemod.bin(h) for h in fp.readline().split()]
+            nodestoprune = [nodemod.bin(h) for h in fp.readline().split()]
             branchtorestore = fp.readline().strip()
             keep = fp.readline().strip() == cls._keep
         except (ValueError, TypeError) as err:
@@ -198,7 +198,7 @@ class shelvedstate(object):
             obj.wctx = repo[wctx]
             obj.pendingctx = repo[pendingctx]
             obj.parents = parents
-            obj.stripnodes = stripnodes
+            obj.nodestoprune = nodestoprune
             obj.branchtorestore = branchtorestore
             obj.keep = keep
         except error.RepoLookupError as err:
@@ -207,7 +207,7 @@ class shelvedstate(object):
         return obj
 
     @classmethod
-    def save(cls, repo, name, originalwctx, pendingctx, stripnodes,
+    def save(cls, repo, name, originalwctx, pendingctx, nodestoprune,
              branchtorestore, keep=False):
         fp = repo.vfs(cls._filename, 'wb')
         fp.write('%i\n' % cls._version)
@@ -217,7 +217,7 @@ class shelvedstate(object):
         fp.write('%s\n' %
                  ' '.join([nodemod.hex(p) for p in repo.dirstate.parents()]))
         fp.write('%s\n' %
-                 ' '.join([nodemod.hex(n) for n in stripnodes]))
+                 ' '.join([nodemod.hex(n) for n in nodestoprune]))
         fp.write('%s\n' % branchtorestore)
         fp.write('%s\n' % (cls._keep if keep else cls._nokeep))
         fp.close()
@@ -569,7 +569,7 @@ def unshelveabort(ui, repo, state, opts)
                 raise
 
             mergefiles(ui, repo, state.wctx, state.pendingctx)
-            repair.strip(ui, repo, state.stripnodes, backup=False,
+            repair.strip(ui, repo, state.nodestoprune, backup=False,
                          topic='shelve')
         finally:
             shelvedstate.clear(repo)
@@ -642,12 +642,12 @@ def unshelvecontinue(ui, repo, state, op
             shelvectx = state.pendingctx
         else:
             # only strip the shelvectx if the rebase produced it
-            state.stripnodes.append(shelvectx.node())
+            state.nodestoprune.append(shelvectx.node())
 
         mergefiles(ui, repo, state.wctx, shelvectx)
         restorebranch(ui, repo, state.branchtorestore)
 
-        repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve')
+        repair.strip(ui, repo, state.nodestoprune, backup=False, topic='shelve')
         shelvedstate.clear(repo)
         unshelvecleanup(ui, repo, state.name, opts)
         ui.status(_("unshelve of '%s' complete\n") % state.name)
@@ -699,9 +699,9 @@ def _rebaserestoredcommit(ui, repo, opts
     except error.InterventionRequired:
         tr.close()
 
-        stripnodes = [repo.changelog.node(rev)
-                      for rev in xrange(oldtiprev, len(repo))]
-        shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes,
+        nodestoprune = [repo.changelog.node(rev)
+                        for rev in xrange(oldtiprev, len(repo))]
+        shelvedstate.save(repo, basename, pctx, tmpwctx, nodestoprune,
                           branchtorestore, opts.get('keep'))
 
         util.rename(repo.join('rebasestate'),


More information about the Mercurial-devel mailing list