Patchwork [03,of,10,shelve-ext] shelve: rename stripnodes to nodestoprune

login
register
mail settings
Submitter Kostia Balytskyi
Date Nov. 29, 2016, 3:22 p.m.
Message ID <93bb69fa1f1abbe0a424.1480432977@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17786/
State Accepted
Headers show

Comments

Kostia Balytskyi - Nov. 29, 2016, 3:22 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1480425731 28800
#      Tue Nov 29 05:22:11 2016 -0800
# Node ID 93bb69fa1f1abbe0a42455ad8df691fdf29b2e3a
# Parent  37119e028c699d9fabd220086e08c754827e709f
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.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -198,7 +198,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:
@@ -212,7 +212,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:
@@ -221,7 +221,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)
@@ -231,7 +231,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()
@@ -576,7 +576,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)
@@ -649,12 +649,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)
@@ -706,9 +706,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'),