diff hgext/shelve.py @ 31021:4189d790e8a4

shelve: add -n/--name option to unshelve (issue5475) This makes using shelve/unshelve more consistent because shelving can be done using name option and unshelving as well. Author of the idea of this improvement and solution is joshgold.
author liscju <piotr.listkiewicz@gmail.com>
date Sun, 19 Feb 2017 10:56:08 +0100
parents dfc6663f97ca
children 356937ea7a02
line wrap: on
line diff
--- a/hgext/shelve.py	Sat Feb 18 17:23:43 2017 -0800
+++ b/hgext/shelve.py	Sun Feb 19 10:56:08 2017 +0100
@@ -747,10 +747,12 @@
            _('continue an incomplete unshelve operation')),
           ('k', 'keep', None,
            _('keep shelve after unshelving')),
+          ('n', 'name', '',
+           _('restore shelved change with given name'), _('NAME')),
           ('t', 'tool', '', _('specify merge tool')),
           ('', 'date', '',
            _('set date for temporary commits (DEPRECATED)'), _('DATE'))],
-         _('hg unshelve [SHELVED]'))
+         _('hg unshelve [[-n] SHELVED]'))
 def unshelve(ui, repo, *shelved, **opts):
     """restore a shelved change to the working directory
 
@@ -795,6 +797,9 @@
     continuef = opts.get('continue')
     if not abortf and not continuef:
         cmdutil.checkunfinished(repo)
+    shelved = list(shelved)
+    if opts.get("name"):
+        shelved.append(opts["name"])
 
     if abortf or continuef:
         if abortf and continuef: