[PATCH 1 of 7 shelve-ext v5] shelve: move node-pruning functionality to be member of shelvedstate
Kostia Balytskyi
ikostia at fb.com
Wed Mar 29 13:18:44 UTC 2017
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1490790691 25200
# Wed Mar 29 05:31:31 2017 -0700
# Node ID b5d6e501621808f330e46295d09526a5d1e9064a
# Parent d73490957d6162edf064055e40b321ee819187d2
shelve: move node-pruning functionality to be member of shelvedstate
Node-pruning can be node stripping or marker creation, depending on
whether shelve is traditional or obs-based. Thus it makes sense to
move it to a separate function. Also, since we already have
shelvedstate object and this functionality operates on that object,
it makes sense to make it a method.
Later we can migrate this type of conditional stripping/hiding
to core, once we agree on how this should be implemented in core.
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -234,6 +234,11 @@ class shelvedstate(object):
def clear(cls, repo):
repo.vfs.unlinkpath(cls._filename, ignoremissing=True)
+ def prunenodes(self, ui, repo):
+ """Cleanup temporary nodes from the repo"""
+ repair.strip(ui, repo, self.nodestoprune, backup=False,
+ topic='shelve')
+
def cleanupoldbackups(repo):
vfs = vfsmod.vfs(repo.vfs.join(backupdir))
maxbackups = repo.ui.configint('shelve', 'maxbackups', 10)
@@ -583,8 +588,7 @@ def unshelveabort(ui, repo, state, opts)
raise
mergefiles(ui, repo, state.wctx, state.pendingctx)
- repair.strip(ui, repo, state.nodestoprune, backup=False,
- topic='shelve')
+ state.prunenodes(ui, repo)
finally:
shelvedstate.clear(repo)
ui.warn(_("unshelve of '%s' aborted\n") % state.name)
@@ -659,7 +663,7 @@ def unshelvecontinue(ui, repo, state, op
mergefiles(ui, repo, state.wctx, shelvectx)
restorebranch(ui, repo, state.branchtorestore)
- repair.strip(ui, repo, state.nodestoprune, backup=False, topic='shelve')
+ state.prunenodes(ui, repo)
_restoreactivebookmark(repo, state.activebookmark)
shelvedstate.clear(repo)
unshelvecleanup(ui, repo, state.name, opts)
More information about the Mercurial-devel
mailing list