navaneeth.suresh edited the summary of this revision.
navaneeth.suresh updated this revision to Diff 15700.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6553?vs=15692&id=15700

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6553/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6553

AFFECTED FILES
  contrib/win32/mercurial.ini
  hgext/shelve.py
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/shelve.py
  mercurial/state.py
  mercurial/ui.py
  relnotes/next
  tests/test-bookflow.t
  tests/test-completion.t
  tests/test-copytrace-heuristics.t
  tests/test-globalopts.t
  tests/test-help-hide.t
  tests/test-help.t
  tests/test-hgweb-json.t
  tests/test-keyword.t
  tests/test-shelve.t
  tests/test-shelve2.t
  tests/test-treemanifest.t

CHANGE DETAILS

diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -357,10 +357,10 @@
 Shelving and unshelving should work
 
   $ echo foo >> dir1/a
-  $ hg --config extensions.shelve= shelve
+  $ hg shelve
   shelved as default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg --config extensions.shelve= unshelve
+  $ hg unshelve
   unshelving change 'default'
   $ hg diff --nodates
   diff -r 708a273da119 dir1/a
diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -3,7 +3,6 @@
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
   > mq =
-  > shelve =
   > [defaults]
   > diff = --nodates --git
   > qnew = --date '0 0'
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -3,7 +3,6 @@
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
   > mq =
-  > shelve =
   > [defaults]
   > diff = --nodates --git
   > qnew = --date '0 0'
@@ -65,8 +64,6 @@
       To delete specific shelved changes, use "--delete". To delete all shelved
       changes, use "--cleanup".
   
-  (use 'hg help -e shelve' to show help for the shelve extension)
-  
   options ([+] can be repeated):
   
    -A --addremove           mark new/missing files as added/removed before
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -1248,11 +1248,6 @@
 
 Test restricted mode with unshelve
 
-  $ cat <<EOF >> $HGRCPATH
-  > [extensions]
-  > shelve =
-  > EOF
-
   $ echo xxxx >> a
   $ hg diff
   diff -r 800511b3a22d a
diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t
--- a/tests/test-hgweb-json.t
+++ b/tests/test-hgweb-json.t
@@ -2057,6 +2057,10 @@
         "topic": "root"
       },
       {
+        "summary": "save and set aside changes from the working directory",
+        "topic": "shelve"
+      },
+      {
         "summary": "add one or more tags for the current or given revision",
         "topic": "tag"
       },
@@ -2069,6 +2073,10 @@
         "topic": "unbundle"
       },
       {
+        "summary": "restore a shelved change to the working directory",
+        "topic": "unshelve"
+      },
+      {
         "summary": "verify the integrity of the repository",
         "topic": "verify"
       },
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -112,8 +112,10 @@
    resolve       redo merges or set/view the merge status of files
    revert        restore files to their checkout state
    root          print the root (top) of the current working directory
+   shelve        save and set aside changes from the working directory
    status        show changed files in the working directory
    summary       summarize working directory state
+   unshelve      restore a shelved change to the working directory
    update        update working directory (or switch revisions)
   
   Change import/export:
@@ -238,8 +240,10 @@
    resolve       redo merges or set/view the merge status of files
    revert        restore files to their checkout state
    root          print the root (top) of the current working directory
+   shelve        save and set aside changes from the working directory
    status        show changed files in the working directory
    summary       summarize working directory state
+   unshelve      restore a shelved change to the working directory
    update        update working directory (or switch revisions)
   
   Change import/export:
@@ -375,7 +379,6 @@
        relink        recreates hardlinks between repository clones
        schemes       extend schemes with shortcuts to repository swarms
        share         share a common history between several working directories
-       shelve        save and restore changes to the working directory
        strip         strip changesets and their descendants from history
        transplant    command to transplant changesets from another branch
        win32mbcs     allow the use of MBCS paths with problematic encodings
@@ -2705,6 +2708,13 @@
   (no help text available)
   </td></tr>
   <tr><td>
+  <a href="/help/shelve">
+  shelve
+  </a>
+  </td><td>
+  save and set aside changes from the working directory
+  </td></tr>
+  <tr><td>
   <a href="/help/tag">
   tag
   </a>
@@ -2726,6 +2736,13 @@
   apply one or more bundle files
   </td></tr>
   <tr><td>
+  <a href="/help/unshelve">
+  unshelve
+  </a>
+  </td><td>
+  restore a shelved change to the working directory
+  </td></tr>
+  <tr><td>
   <a href="/help/verify">
   verify
   </a>
diff --git a/tests/test-help-hide.t b/tests/test-help-hide.t
--- a/tests/test-help-hide.t
+++ b/tests/test-help-hide.t
@@ -60,8 +60,10 @@
    resolve       redo merges or set/view the merge status of files
    revert        restore files to their checkout state
    root          print the root (top) of the current working directory
+   shelve        save and set aside changes from the working directory
    status        show changed files in the working directory
    summary       summarize working directory state
+   unshelve      restore a shelved change to the working directory
    update        update working directory (or switch revisions)
   
   Change import/export:
@@ -194,8 +196,10 @@
    resolve       redo merges or set/view the merge status of files
    revert        restore files to their checkout state
    root          print the root (top) of the current working directory
+   shelve        save and set aside changes from the working directory
    status        show changed files in the working directory
    summary       summarize working directory state
+   unshelve      restore a shelved change to the working directory
    update        update working directory (or switch revisions)
   
   Change import/export:
diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t
--- a/tests/test-globalopts.t
+++ b/tests/test-globalopts.t
@@ -356,8 +356,10 @@
    resolve       redo merges or set/view the merge status of files
    revert        restore files to their checkout state
    root          print the root (top) of the current working directory
+   shelve        save and set aside changes from the working directory
    status        show changed files in the working directory
    summary       summarize working directory state
+   unshelve      restore a shelved change to the working directory
    update        update working directory (or switch revisions)
   
   Change import/export:
@@ -486,8 +488,10 @@
    resolve       redo merges or set/view the merge status of files
    revert        restore files to their checkout state
    root          print the root (top) of the current working directory
+   shelve        save and set aside changes from the working directory
    status        show changed files in the working directory
    summary       summarize working directory state
+   unshelve      restore a shelved change to the working directory
    update        update working directory (or switch revisions)
   
   Change import/export:
diff --git a/tests/test-copytrace-heuristics.t 
b/tests/test-copytrace-heuristics.t
--- a/tests/test-copytrace-heuristics.t
+++ b/tests/test-copytrace-heuristics.t
@@ -15,7 +15,6 @@
   $ cat >> $HGRCPATH << EOF
   > [extensions]
   > rebase=
-  > shelve=
   > [alias]
   > l = log -G -T 'rev: {rev}\ndesc: {desc}\n'
   > pl = log -G -T 'rev: {rev}, phase: {phase}\ndesc: {desc}\n'
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -45,12 +45,14 @@
   rollback
   root
   serve
+  shelve
   status
   summary
   tag
   tags
   tip
   unbundle
+  unshelve
   update
   verify
   version
@@ -228,7 +230,7 @@
 Show an error if we use --options with an ambiguous abbreviation
   $ hg debugcomplete --options s
   hg: command 's' is ambiguous:
-      serve showconfig status summary
+      serve shelve showconfig status summary
   [255]
 
 Show all commands + options
@@ -340,12 +342,14 @@
   rollback: dry-run, force
   root: template
   serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, 
name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, 
ipv6, certificate, print-url, subrepos
+  shelve: addremove, unknown, cleanup, date, delete, edit, keep, list, 
message, name, patch, interactive, stat, include, exclude
   status: all, modified, added, removed, deleted, clean, unknown, ignored, 
no-status, terse, copies, print0, rev, change, include, exclude, subrepos, 
template
   summary: remote
   tag: force, local, rev, remove, edit, message, date, user
   tags: template
   tip: patch, git, style, template
   unbundle: update
+  unshelve: abort, continue, keep, name, tool, date
   update: clean, check, merge, date, rev, tool
   verify: full
   version: template
diff --git a/tests/test-bookflow.t b/tests/test-bookflow.t
--- a/tests/test-bookflow.t
+++ b/tests/test-bookflow.t
@@ -215,11 +215,11 @@
   $ hg diff --stat
    test |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
-  $ hg --config extensions.shelve= shelve
+  $ hg shelve
   shelved as Z
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg pull -uq
-  $ hg --trace --config extensions.shelve= unshelve
+  $ hg unshelve
   unshelving change 'Z'
   rebasing shelved changes
   $ hg diff --stat
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -57,3 +57,5 @@
 
  * `util.dirs()` and `util.finddirs()` now include an entry for the
    root directory (empty string).
+
+ * shelve is no longer an extension now. it will be turned on by default.
\ No newline at end of file
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -102,7 +102,6 @@
 #
 # histedit =
 # rebase =
-# shelve =
 # uncommit =
 """,
 
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -194,6 +194,10 @@
     cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
 )
 addunfinished(
+    'unshelve', fname='shelvedstate', continueflag=True,
+    cmdmsg=_('unshelve already in progress')
+)
+addunfinished(
     'update', fname='updatestate', clearable=True,
     cmdmsg=_('last update was interrupted'),
     cmdhint=_("use 'hg update' to get a consistent checkout"),
diff --git a/hgext/shelve.py b/mercurial/shelve.py
rename from hgext/shelve.py
rename to mercurial/shelve.py
--- a/hgext/shelve.py
+++ b/mercurial/shelve.py
@@ -27,8 +27,8 @@
 import itertools
 import stat
 
-from mercurial.i18n import _
-from mercurial import (
+from .i18n import _
+from . import (
     bookmarks,
     bundle2,
     bundlerepo,
@@ -45,7 +45,6 @@
     patch,
     phases,
     pycompat,
-    registrar,
     repair,
     scmutil,
     state as statemod,
@@ -53,27 +52,11 @@
     util,
     vfs as vfsmod,
 )
-
-from mercurial.utils import (
+from .utils import (
     dateutil,
     stringutil,
 )
 
-cmdtable = {}
-command = registrar.command(cmdtable)
-# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
-# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
-# be specifying the version(s) of Mercurial they are tested with, or
-# leave the attribute unspecified.
-testedwith = 'ships-with-hg-core'
-
-configtable = {}
-configitem = registrar.configitem(configtable)
-
-configitem('shelve', 'maxbackups',
-    default=10,
-)
-
 backupdir = 'shelve-backup'
 shelvedir = 'shelved'
 shelvefileextensions = ['hg', 'patch', 'shelve']
@@ -865,59 +848,6 @@
         hint = _("run hg status to see which files are missing")
         raise error.Abort(m, hint=hint)
 
-@command('unshelve',
-         [('a', 'abort', None,
-           _('abort an incomplete unshelve operation')),
-          ('c', 'continue', None,
-           _('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 [[-n] SHELVED]'),
-         helpcategory=command.CATEGORY_WORKING_DIRECTORY)
-def unshelve(ui, repo, *shelved, **opts):
-    """restore a shelved change to the working directory
-
-    This command accepts an optional name of a shelved change to
-    restore. If none is given, the most recent shelved change is used.
-
-    If a shelved change is applied successfully, the bundle that
-    contains the shelved changes is moved to a backup location
-    (.hg/shelve-backup).
-
-    Since you can restore a shelved change on top of an arbitrary
-    commit, it is possible that unshelving will result in a conflict
-    between your changes and the commits you are unshelving onto. If
-    this occurs, you must resolve the conflict, then use
-    ``--continue`` to complete the unshelve operation. (The bundle
-    will not be moved until you successfully complete the unshelve.)
-
-    (Alternatively, you can use ``--abort`` to abandon an unshelve
-    that causes a conflict. This reverts the unshelved changes, and
-    leaves the bundle in place.)
-
-    If bare shelved change (when no files are specified, without interactive,
-    include and exclude option) was done on newly created branch it would
-    restore branch information to the working directory.
-
-    After a successful unshelve, the shelved changes are stored in a
-    backup directory. Only the N most recent backups are kept. N
-    defaults to 10 but can be overridden using the ``shelve.maxbackups``
-    configuration option.
-
-    .. container:: verbose
-
-       Timestamp in seconds is used to decide order of backups. More
-       than ``maxbackups`` backups are kept, if same timestamp
-       prevents from deciding exact order of them, for safety.
-    """
-    with repo.wlock():
-        return _dounshelve(ui, repo, *shelved, **opts)
-
 def _dounshelve(ui, repo, *shelved, **opts):
     opts = pycompat.byteskwargs(opts)
     abortf = opts.get('abort')
@@ -1025,110 +955,3 @@
         if tr:
             tr.release()
         lockmod.release(lock)
-
-@command('shelve',
-         [('A', 'addremove', None,
-           _('mark new/missing files as added/removed before shelving')),
-          ('u', 'unknown', None,
-           _('store unknown files in the shelve')),
-          ('', 'cleanup', None,
-           _('delete all shelved changes')),
-          ('', 'date', '',
-           _('shelve with the specified commit date'), _('DATE')),
-          ('d', 'delete', None,
-           _('delete the named shelved change(s)')),
-          ('e', 'edit', False,
-           _('invoke editor on commit messages')),
-          ('k', 'keep', False,
-           _('shelve, but keep changes in the working directory')),
-          ('l', 'list', None,
-           _('list current shelves')),
-          ('m', 'message', '',
-           _('use text as shelve message'), _('TEXT')),
-          ('n', 'name', '',
-           _('use the given name for the shelved commit'), _('NAME')),
-          ('p', 'patch', None,
-           _('output patches for changes (provide the names of the shelved '
-             'changes as positional arguments)')),
-          ('i', 'interactive', None,
-           _('interactive mode, only works while creating a shelve')),
-          ('', 'stat', None,
-           _('output diffstat-style summary of changes (provide the names of '
-             'the shelved changes as positional arguments)')
-           )] + cmdutil.walkopts,
-         _('hg shelve [OPTION]... [FILE]...'),
-         helpcategory=command.CATEGORY_WORKING_DIRECTORY)
-def shelvecmd(ui, repo, *pats, **opts):
-    '''save and set aside changes from the working directory
-
-    Shelving takes files that "hg status" reports as not clean, saves
-    the modifications to a bundle (a shelved change), and reverts the
-    files so that their state in the working directory becomes clean.
-
-    To restore these changes to the working directory, using "hg
-    unshelve"; this will work even if you switch to a different
-    commit.
-
-    When no files are specified, "hg shelve" saves all not-clean
-    files. If specific files or directories are named, only changes to
-    those files are shelved.
-
-    In bare shelve (when no files are specified, without interactive,
-    include and exclude option), shelving remembers information if the
-    working directory was on newly created branch, in other words working
-    directory was on different branch than its first parent. In this
-    situation unshelving restores branch information to the working directory.
-
-    Each shelved change has a name that makes it easier to find later.
-    The name of a shelved change defaults to being based on the active
-    bookmark, or if there is no active bookmark, the current named
-    branch.  To specify a different name, use ``--name``.
-
-    To see a list of existing shelved changes, use the ``--list``
-    option. For each shelved change, this will print its name, age,
-    and description; use ``--patch`` or ``--stat`` for more details.
-
-    To delete specific shelved changes, use ``--delete``. To delete
-    all shelved changes, use ``--cleanup``.
-    '''
-    opts = pycompat.byteskwargs(opts)
-    allowables = [
-        ('addremove', {'create'}), # 'create' is pseudo action
-        ('unknown', {'create'}),
-        ('cleanup', {'cleanup'}),
-#       ('date', {'create'}), # ignored for passing '--date "0 0"' in tests
-        ('delete', {'delete'}),
-        ('edit', {'create'}),
-        ('keep', {'create'}),
-        ('list', {'list'}),
-        ('message', {'create'}),
-        ('name', {'create'}),
-        ('patch', {'patch', 'list'}),
-        ('stat', {'stat', 'list'}),
-    ]
-    def checkopt(opt):
-        if opts.get(opt):
-            for i, allowable in allowables:
-                if opts[i] and opt not in allowable:
-                    raise error.Abort(_("options '--%s' and '--%s' may not be "
-                                       "used together") % (opt, i))
-            return True
-    if checkopt('cleanup'):
-        if pats:
-            raise error.Abort(_("cannot specify names when using '--cleanup'"))
-        return cleanupcmd(ui, repo)
-    elif checkopt('delete'):
-        return deletecmd(ui, repo, pats)
-    elif checkopt('list'):
-        return listcmd(ui, repo, pats, opts)
-    elif checkopt('patch') or checkopt('stat'):
-        return patchcmds(ui, repo, pats, opts)
-    else:
-        return createcmd(ui, repo, pats, opts)
-
-def extsetup(ui):
-    statemod.addunfinished(
-        'unshelve', fname=shelvedstate._filename, continueflag=True,
-        cmdmsg=_('unshelve already in progress')
-    )
-
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1091,6 +1091,9 @@
 coreconfigitem('share', 'poolnaming',
     default='identity',
 )
+coreconfigitem('shelve','maxbackups',
+    default=10,
+)
 coreconfigitem('smtp', 'host',
     default=None,
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -58,6 +58,7 @@
     rewriteutil,
     scmutil,
     server,
+    shelve as shelvemod,
     state as statemod,
     streamclone,
     tags as tagsmod,
@@ -5324,6 +5325,106 @@
     service = server.createservice(ui, repo, opts)
     return server.runservice(opts, initfn=service.init, runfn=service.run)
 
+@command('shelve',
+         [('A', 'addremove', None,
+           _('mark new/missing files as added/removed before shelving')),
+          ('u', 'unknown', None,
+           _('store unknown files in the shelve')),
+          ('', 'cleanup', None,
+           _('delete all shelved changes')),
+          ('', 'date', '',
+           _('shelve with the specified commit date'), _('DATE')),
+          ('d', 'delete', None,
+           _('delete the named shelved change(s)')),
+          ('e', 'edit', False,
+           _('invoke editor on commit messages')),
+          ('k', 'keep', False,
+           _('shelve, but keep changes in the working directory')),
+          ('l', 'list', None,
+           _('list current shelves')),
+          ('m', 'message', '',
+           _('use text as shelve message'), _('TEXT')),
+          ('n', 'name', '',
+           _('use the given name for the shelved commit'), _('NAME')),
+          ('p', 'patch', None,
+           _('output patches for changes (provide the names of the shelved '
+             'changes as positional arguments)')),
+          ('i', 'interactive', None,
+           _('interactive mode, only works while creating a shelve')),
+          ('', 'stat', None,
+           _('output diffstat-style summary of changes (provide the names of '
+             'the shelved changes as positional arguments)')
+           )] + cmdutil.walkopts,
+         _('hg shelve [OPTION]... [FILE]...'),
+         helpcategory=command.CATEGORY_WORKING_DIRECTORY)
+def shelve(ui, repo, *pats, **opts):
+    '''save and set aside changes from the working directory
+
+    Shelving takes files that "hg status" reports as not clean, saves
+    the modifications to a bundle (a shelved change), and reverts the
+    files so that their state in the working directory becomes clean.
+
+    To restore these changes to the working directory, using "hg
+    unshelve"; this will work even if you switch to a different
+    commit.
+
+    When no files are specified, "hg shelve" saves all not-clean
+    files. If specific files or directories are named, only changes to
+    those files are shelved.
+
+    In bare shelve (when no files are specified, without interactive,
+    include and exclude option), shelving remembers information if the
+    working directory was on newly created branch, in other words working
+    directory was on different branch than its first parent. In this
+    situation unshelving restores branch information to the working directory.
+
+    Each shelved change has a name that makes it easier to find later.
+    The name of a shelved change defaults to being based on the active
+    bookmark, or if there is no active bookmark, the current named
+    branch.  To specify a different name, use ``--name``.
+
+    To see a list of existing shelved changes, use the ``--list``
+    option. For each shelved change, this will print its name, age,
+    and description; use ``--patch`` or ``--stat`` for more details.
+
+    To delete specific shelved changes, use ``--delete``. To delete
+    all shelved changes, use ``--cleanup``.
+    '''
+    opts = pycompat.byteskwargs(opts)
+    allowables = [
+        ('addremove', {'create'}), # 'create' is pseudo action
+        ('unknown', {'create'}),
+        ('cleanup', {'cleanup'}),
+#       ('date', {'create'}), # ignored for passing '--date "0 0"' in tests
+        ('delete', {'delete'}),
+        ('edit', {'create'}),
+        ('keep', {'create'}),
+        ('list', {'list'}),
+        ('message', {'create'}),
+        ('name', {'create'}),
+        ('patch', {'patch', 'list'}),
+        ('stat', {'stat', 'list'}),
+    ]
+    def checkopt(opt):
+        if opts.get(opt):
+            for i, allowable in allowables:
+                if opts[i] and opt not in allowable:
+                    raise error.Abort(_("options '--%s' and '--%s' may not be "
+                                       "used together") % (opt, i))
+            return True
+    if checkopt('cleanup'):
+        if pats:
+            raise error.Abort(_("cannot specify names when using '--cleanup'"))
+        return shelvemod.cleanupcmd(ui, repo)
+    elif checkopt('delete'):
+        return shelvemod.deletecmd(ui, repo, pats)
+    elif checkopt('list'):
+        return shelvemod.listcmd(ui, repo, pats, opts)
+    elif checkopt('patch') or checkopt('stat'):
+        return shelvemod.patchcmds(ui, repo, pats, opts)
+    else:
+        return shelvemod.createcmd(ui, repo, pats, opts)
+
 _NOTTERSE = 'nothing'
 
 @command('status|st',
@@ -6052,6 +6153,59 @@
 
     return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
 
+@command('unshelve',
+         [('a', 'abort', None,
+           _('abort an incomplete unshelve operation')),
+          ('c', 'continue', None,
+           _('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 [[-n] SHELVED]'),
+         helpcategory=command.CATEGORY_WORKING_DIRECTORY)
+def unshelve(ui, repo, *shelved, **opts):
+    """restore a shelved change to the working directory
+
+    This command accepts an optional name of a shelved change to
+    restore. If none is given, the most recent shelved change is used.
+
+    If a shelved change is applied successfully, the bundle that
+    contains the shelved changes is moved to a backup location
+    (.hg/shelve-backup).
+
+    Since you can restore a shelved change on top of an arbitrary
+    commit, it is possible that unshelving will result in a conflict
+    between your changes and the commits you are unshelving onto. If
+    this occurs, you must resolve the conflict, then use
+    ``--continue`` to complete the unshelve operation. (The bundle
+    will not be moved until you successfully complete the unshelve.)
+
+    (Alternatively, you can use ``--abort`` to abandon an unshelve
+    that causes a conflict. This reverts the unshelved changes, and
+    leaves the bundle in place.)
+
+    If bare shelved change (when no files are specified, without interactive,
+    include and exclude option) was done on newly created branch it would
+    restore branch information to the working directory.
+
+    After a successful unshelve, the shelved changes are stored in a
+    backup directory. Only the N most recent backups are kept. N
+    defaults to 10 but can be overridden using the ``shelve.maxbackups``
+    configuration option.
+
+    .. container:: verbose
+
+       Timestamp in seconds is used to decide order of backups. More
+       than ``maxbackups`` backups are kept, if same timestamp
+       prevents from deciding exact order of them, for safety.
+    """
+    with repo.wlock():
+        return shelvemod._dounshelve(ui, repo, *shelved, **opts)
+
 @command('update|up|checkout|co',
     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
     ('c', 'check', None, _('require clean working directory')),
diff --git a/contrib/win32/mercurial.ini b/contrib/win32/mercurial.ini
--- a/contrib/win32/mercurial.ini
+++ b/contrib/win32/mercurial.ini
@@ -64,7 +64,6 @@
 ;relink =
 ;schemes =
 ;share =
-;shelve =
 ;transplant =
 ;win32mbcs =
 ;zeroconf =



To: navaneeth.suresh, #hg-reviewers, pulkit
Cc: martinvonz, pulkit, Kwan, mjpieters, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to