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