shelve: split up dounshelve() in unshelvecmd() and _dounshelve()
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 23 Mar 2020 15:14:42 -0700
changeset 44595 47c1226463a1
parent 44593 496868f1030c
child 44596 7333e8bb9781
shelve: split up dounshelve() in unshelvecmd() and _dounshelve() I'd like to be able to override the new `_dounshelve()`, getting access to the name of the shelve to unshelve. `unshelvecmd()` seems to better match the existing `createcmd()`, `listcmd()` etc. Differential Revision: https://phab.mercurial-scm.org/D8322
mercurial/commands.py
mercurial/shelve.py
--- a/mercurial/commands.py	Tue Mar 24 17:55:59 2020 +0100
+++ b/mercurial/commands.py	Mon Mar 23 15:14:42 2020 -0700
@@ -7585,7 +7585,7 @@
        unshelved.
     """
     with repo.wlock():
-        return shelvemod.dounshelve(ui, repo, *shelved, **opts)
+        return shelvemod.unshelvecmd(ui, repo, *shelved, **opts)
 
 
 statemod.addunfinished(
--- a/mercurial/shelve.py	Tue Mar 24 17:55:59 2020 +0100
+++ b/mercurial/shelve.py	Mon Mar 23 15:14:42 2020 -0700
@@ -1074,7 +1074,7 @@
         raise error.Abort(m, hint=hint)
 
 
-def dounshelve(ui, repo, *shelved, **opts):
+def unshelvecmd(ui, repo, *shelved, **opts):
     opts = pycompat.byteskwargs(opts)
     abortf = opts.get(b'abort')
     continuef = opts.get(b'continue')
@@ -1121,6 +1121,10 @@
     if not shelvedfile(repo, basename, patchextension).exists():
         raise error.Abort(_(b"shelved change '%s' not found") % basename)
 
+    return _dounshelve(ui, repo, basename, opts)
+
+
+def _dounshelve(ui, repo, basename, opts):
     repo = repo.unfiltered()
     lock = tr = None
     try: