[Updated] D9699: shelve: raise more specific errors
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Sat Jan 16 10:56:57 UTC 2021
Closed by commit rHG3edd82c0f5bb: shelve: raise more specific errors (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D9699?vs=24706&id=24934#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9699?vs=24706&id=24934
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9699/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9699
AFFECTED FILES
mercurial/shelve.py
tests/test-shelve.t
tests/test-shelve2.t
CHANGE DETAILS
diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -769,10 +769,10 @@
$ hg shelve -l
$ hg unshelve
abort: no shelved changes to apply!
- [255]
+ [20]
$ hg shelve -d junk2
abort: shelved change 'junk2' not found
- [255]
+ [10]
$ find .hg/shelve*
.hg/shelve-backup
.hg/shelve-backup/junk1.patch
@@ -787,7 +787,7 @@
ValueError: not enough values to unpack (expected 2, got 1)
$ hg shelve -d junk3
abort: shelved change 'junk3' not found
- [255]
+ [10]
$ find .hg/shelve*
.hg/shelve-backup
.hg/shelve-backup/junk1.patch
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -278,10 +278,10 @@
$ hg unshelve
abort: no shelved changes to apply!
- [255]
+ [20]
$ hg unshelve foo
abort: shelved change 'foo' not found
- [255]
+ [10]
named shelves, specific filenames, and "commit messages" should all work
(this tests also that editor is invoked, if '--edit' is specified)
@@ -979,7 +979,7 @@
default (*s ago) changes to: create conflict (glob)
$ hg shelve --delete doesnotexist
abort: shelved change 'doesnotexist' not found
- [255]
+ [10]
$ hg shelve --delete default
$ cd ..
@@ -1408,7 +1408,7 @@
-- using --continue with --interactive should throw an error
$ hg unshelve --continue -i
abort: cannot use both continue and interactive
- [255]
+ [10]
$ cat bar1
A
@@ -1511,7 +1511,7 @@
-- test for --interactive --keep
$ hg unshelve -i --keep
abort: --keep on --interactive is not yet supported
- [255]
+ [10]
$ hg update -q --clean .
diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -592,11 +592,13 @@
def deletecmd(ui, repo, pats):
"""subcommand that deletes a specific shelve"""
if not pats:
- raise error.Abort(_(b'no shelved changes specified!'))
+ raise error.InputError(_(b'no shelved changes specified!'))
with repo.wlock():
for name in pats:
if not shelvedfile(repo, name, patchextension).exists():
- raise error.Abort(_(b"shelved change '%s' not found") % name)
+ raise error.InputError(
+ _(b"shelved change '%s' not found") % name
+ )
for suffix in shelvefileextensions:
shfile = shelvedfile(repo, name, suffix)
if shfile.exists():
@@ -1066,12 +1068,14 @@
shelved.append(opts[b"name"])
if interactive and opts.get(b'keep'):
- raise error.Abort(_(b'--keep on --interactive is not yet supported'))
+ raise error.InputError(
+ _(b'--keep on --interactive is not yet supported')
+ )
if abortf or continuef:
if abortf and continuef:
- raise error.Abort(_(b'cannot use both abort and continue'))
+ raise error.InputError(_(b'cannot use both abort and continue'))
if shelved:
- raise error.Abort(
+ raise error.InputError(
_(
b'cannot combine abort/continue with '
b'naming a shelved change'
@@ -1084,22 +1088,24 @@
if abortf:
return unshelveabort(ui, repo, state)
elif continuef and interactive:
- raise error.Abort(_(b'cannot use both continue and interactive'))
+ raise error.InputError(
+ _(b'cannot use both continue and interactive')
+ )
elif continuef:
return unshelvecontinue(ui, repo, state, opts)
elif len(shelved) > 1:
- raise error.Abort(_(b'can only unshelve one change at a time'))
+ raise error.InputError(_(b'can only unshelve one change at a time'))
elif not shelved:
shelved = listshelves(repo)
if not shelved:
- raise error.Abort(_(b'no shelved changes to apply!'))
+ raise error.StateError(_(b'no shelved changes to apply!'))
basename = util.split(shelved[0][1])[1]
ui.status(_(b"unshelving change '%s'\n") % basename)
else:
basename = shelved[0]
if not shelvedfile(repo, basename, patchextension).exists():
- raise error.Abort(_(b"shelved change '%s' not found") % basename)
+ raise error.InputError(_(b"shelved change '%s' not found") % basename)
return _dounshelve(ui, repo, basename, opts)
To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210116/014700cf/attachment-0002.html>
More information about the Mercurial-patches
mailing list