##// END OF EJS Templates
shelve: raise more specific errors...
Martin von Zweigbergk -
r46898:3edd82c0 default draft
parent child Browse files
Show More
@@ -592,11 +592,13 b' def cleanupcmd(ui, repo):'
592 592 def deletecmd(ui, repo, pats):
593 593 """subcommand that deletes a specific shelve"""
594 594 if not pats:
595 raise error.Abort(_(b'no shelved changes specified!'))
595 raise error.InputError(_(b'no shelved changes specified!'))
596 596 with repo.wlock():
597 597 for name in pats:
598 598 if not shelvedfile(repo, name, patchextension).exists():
599 raise error.Abort(_(b"shelved change '%s' not found") % name)
599 raise error.InputError(
600 _(b"shelved change '%s' not found") % name
601 )
600 602 for suffix in shelvefileextensions:
601 603 shfile = shelvedfile(repo, name, suffix)
602 604 if shfile.exists():
@@ -1066,12 +1068,14 b' def unshelvecmd(ui, repo, *shelved, **op'
1066 1068 shelved.append(opts[b"name"])
1067 1069
1068 1070 if interactive and opts.get(b'keep'):
1069 raise error.Abort(_(b'--keep on --interactive is not yet supported'))
1071 raise error.InputError(
1072 _(b'--keep on --interactive is not yet supported')
1073 )
1070 1074 if abortf or continuef:
1071 1075 if abortf and continuef:
1072 raise error.Abort(_(b'cannot use both abort and continue'))
1076 raise error.InputError(_(b'cannot use both abort and continue'))
1073 1077 if shelved:
1074 raise error.Abort(
1078 raise error.InputError(
1075 1079 _(
1076 1080 b'cannot combine abort/continue with '
1077 1081 b'naming a shelved change'
@@ -1084,22 +1088,24 b' def unshelvecmd(ui, repo, *shelved, **op'
1084 1088 if abortf:
1085 1089 return unshelveabort(ui, repo, state)
1086 1090 elif continuef and interactive:
1087 raise error.Abort(_(b'cannot use both continue and interactive'))
1091 raise error.InputError(
1092 _(b'cannot use both continue and interactive')
1093 )
1088 1094 elif continuef:
1089 1095 return unshelvecontinue(ui, repo, state, opts)
1090 1096 elif len(shelved) > 1:
1091 raise error.Abort(_(b'can only unshelve one change at a time'))
1097 raise error.InputError(_(b'can only unshelve one change at a time'))
1092 1098 elif not shelved:
1093 1099 shelved = listshelves(repo)
1094 1100 if not shelved:
1095 raise error.Abort(_(b'no shelved changes to apply!'))
1101 raise error.StateError(_(b'no shelved changes to apply!'))
1096 1102 basename = util.split(shelved[0][1])[1]
1097 1103 ui.status(_(b"unshelving change '%s'\n") % basename)
1098 1104 else:
1099 1105 basename = shelved[0]
1100 1106
1101 1107 if not shelvedfile(repo, basename, patchextension).exists():
1102 raise error.Abort(_(b"shelved change '%s' not found") % basename)
1108 raise error.InputError(_(b"shelved change '%s' not found") % basename)
1103 1109
1104 1110 return _dounshelve(ui, repo, basename, opts)
1105 1111
@@ -278,10 +278,10 b' is difficult to decide actual order of t'
278 278
279 279 $ hg unshelve
280 280 abort: no shelved changes to apply!
281 [255]
281 [20]
282 282 $ hg unshelve foo
283 283 abort: shelved change 'foo' not found
284 [255]
284 [10]
285 285
286 286 named shelves, specific filenames, and "commit messages" should all work
287 287 (this tests also that editor is invoked, if '--edit' is specified)
@@ -979,7 +979,7 b' Test shelve --delete'
979 979 default (*s ago) changes to: create conflict (glob)
980 980 $ hg shelve --delete doesnotexist
981 981 abort: shelved change 'doesnotexist' not found
982 [255]
982 [10]
983 983 $ hg shelve --delete default
984 984
985 985 $ cd ..
@@ -1408,7 +1408,7 b' Abort unshelve while merging (issue5123)'
1408 1408 -- using --continue with --interactive should throw an error
1409 1409 $ hg unshelve --continue -i
1410 1410 abort: cannot use both continue and interactive
1411 [255]
1411 [10]
1412 1412
1413 1413 $ cat bar1
1414 1414 A
@@ -1511,7 +1511,7 b' Abort unshelve while merging (issue5123)'
1511 1511 -- test for --interactive --keep
1512 1512 $ hg unshelve -i --keep
1513 1513 abort: --keep on --interactive is not yet supported
1514 [255]
1514 [10]
1515 1515
1516 1516 $ hg update -q --clean .
1517 1517
@@ -769,10 +769,10 b' Test corrupt shelves (in .hg/shelved/, n'
769 769 $ hg shelve -l
770 770 $ hg unshelve
771 771 abort: no shelved changes to apply!
772 [255]
772 [20]
773 773 $ hg shelve -d junk2
774 774 abort: shelved change 'junk2' not found
775 [255]
775 [10]
776 776 $ find .hg/shelve*
777 777 .hg/shelve-backup
778 778 .hg/shelve-backup/junk1.patch
@@ -787,7 +787,7 b' Test corrupt shelves (in .hg/shelved/, n'
787 787 ValueError: not enough values to unpack (expected 2, got 1)
788 788 $ hg shelve -d junk3
789 789 abort: shelved change 'junk3' not found
790 [255]
790 [10]
791 791 $ find .hg/shelve*
792 792 .hg/shelve-backup
793 793 .hg/shelve-backup/junk1.patch
General Comments 0
You need to be logged in to leave comments. Login now