# HG changeset patch # User liscju # Date 1487498168 -3600 # Node ID 4189d790e8a4f2c626fe0f3dde305bec14c54bc3 # Parent 2d1bf84046f6fcf59bdaae7a0390246b09ce85f6 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. diff -r 2d1bf84046f6 -r 4189d790e8a4 hgext/shelve.py --- 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: diff -r 2d1bf84046f6 -r 4189d790e8a4 tests/test-shelve.t --- a/tests/test-shelve.t Sat Feb 18 17:23:43 2017 -0800 +++ b/tests/test-shelve.t Sun Feb 19 10:56:08 2017 +0100 @@ -493,7 +493,7 @@ $ ln -s foo a/a $ hg shelve -q -n symlink a/a $ hg status a/a - $ hg unshelve -q symlink + $ hg unshelve -q -n symlink $ hg status a/a M a/a $ hg revert a/a