changeset 42695:52a383451739

unshelve: add abort on using continue and interactive together `unshelve --continue --interactive` will not work as expected by the user as the mode of in-progress unshelve is preserved and cannot be overwritten. This patch makes `unshelve` to throw an error on using both `--continue` and `--interactive` together with `unshelve`. Differential Revision: https://phab.mercurial-scm.org/D6703
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Tue, 30 Jul 2019 21:36:15 +0530
parents 6d50a7ebf7e0
children 36c692eb28d3
files mercurial/shelve.py tests/test-shelve.t
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/shelve.py	Mon Jul 29 13:22:52 2019 +0300
+++ b/mercurial/shelve.py	Tue Jul 30 21:36:15 2019 +0530
@@ -954,6 +954,8 @@
         state = _loadshelvedstate(ui, repo, opts)
         if abortf:
             return unshelveabort(ui, repo, state)
+        elif continuef and interactive:
+            raise error.Abort(_('cannot use both continue and interactive'))
         elif continuef:
             return unshelvecontinue(ui, repo, state, opts)
     elif len(shelved) > 1:
--- a/tests/test-shelve.t	Mon Jul 29 13:22:52 2019 +0300
+++ b/tests/test-shelve.t	Tue Jul 30 21:36:15 2019 +0530
@@ -1347,6 +1347,12 @@
   $ hg resolve -m bar1 bar2
   (no more unresolved files)
   continue: hg unshelve --continue
+
+-- using --continue with --interactive should throw an error
+  $ hg unshelve --continue -i
+  abort: cannot use both continue and interactive
+  [255]
+
   $ cat bar1
   A
   B