Show More
@@ -594,10 +594,15 b' def listcmd(ui, repo, pats, opts):' | |||||
594 | for chunk, label in patch.diffstatui(difflines, width=width): |
|
594 | for chunk, label in patch.diffstatui(difflines, width=width): | |
595 | ui.write(chunk, label=label) |
|
595 | ui.write(chunk, label=label) | |
596 |
|
596 | |||
597 |
def patchcmds(ui, repo, pats, opts |
|
597 | def patchcmds(ui, repo, pats, opts): | |
598 | """subcommand that displays shelves""" |
|
598 | """subcommand that displays shelves""" | |
599 | if len(pats) == 0: |
|
599 | if len(pats) == 0: | |
600 | raise error.Abort(_("--%s expects at least one shelf") % subcommand) |
|
600 | shelves = listshelves(repo) | |
|
601 | if not shelves: | |||
|
602 | raise error.Abort(_("there are no shelves to show")) | |||
|
603 | mtime, name = shelves[0] | |||
|
604 | sname = util.split(name)[1] | |||
|
605 | pats = [sname] | |||
601 |
|
606 | |||
602 | for shelfname in pats: |
|
607 | for shelfname in pats: | |
603 | if not shelvedfile(repo, shelfname, patchextension).exists(): |
|
608 | if not shelvedfile(repo, shelfname, patchextension).exists(): | |
@@ -1082,10 +1087,8 b' def shelvecmd(ui, repo, *pats, **opts):' | |||||
1082 | return deletecmd(ui, repo, pats) |
|
1087 | return deletecmd(ui, repo, pats) | |
1083 | elif checkopt('list'): |
|
1088 | elif checkopt('list'): | |
1084 | return listcmd(ui, repo, pats, opts) |
|
1089 | return listcmd(ui, repo, pats, opts) | |
1085 | elif checkopt('patch'): |
|
1090 | elif checkopt('patch') or checkopt('stat'): | |
1086 |
return patchcmds(ui, repo, pats, opts |
|
1091 | return patchcmds(ui, repo, pats, opts) | |
1087 | elif checkopt('stat'): |
|
|||
1088 | return patchcmds(ui, repo, pats, opts, subcommand='stat') |
|
|||
1089 | else: |
|
1092 | else: | |
1090 | return createcmd(ui, repo, pats, opts) |
|
1093 | return createcmd(ui, repo, pats, opts) | |
1091 |
|
1094 |
@@ -1057,8 +1057,33 b' shelve --patch and shelve --stat should ' | |||||
1057 | $ hg shelve --patch default nonexistentshelf |
|
1057 | $ hg shelve --patch default nonexistentshelf | |
1058 | abort: cannot find shelf nonexistentshelf |
|
1058 | abort: cannot find shelf nonexistentshelf | |
1059 | [255] |
|
1059 | [255] | |
|
1060 | ||||
|
1061 | when the user asks for a patch, we assume they want the most recent shelve if | |||
|
1062 | they don't provide a shelve name | |||
|
1063 | ||||
1060 | $ hg shelve --patch |
|
1064 | $ hg shelve --patch | |
1061 | abort: --patch expects at least one shelf |
|
1065 | default-01 (*)* changes to: create conflict (glob) | |
|
1066 | ||||
|
1067 | diff --git a/shelf-patch-b b/shelf-patch-b | |||
|
1068 | new file mode 100644 | |||
|
1069 | --- /dev/null | |||
|
1070 | +++ b/shelf-patch-b | |||
|
1071 | @@ -0,0 +1,1 @@ | |||
|
1072 | +patch b | |||
|
1073 | ||||
|
1074 | $ cd .. | |||
|
1075 | ||||
|
1076 | you shouldn't be able to ask for the patch/stats of the most recent shelve if | |||
|
1077 | there are no shelves | |||
|
1078 | ||||
|
1079 | $ hg init noshelves | |||
|
1080 | $ cd noshelves | |||
|
1081 | ||||
|
1082 | $ hg shelve --patch | |||
|
1083 | abort: there are no shelves to show | |||
|
1084 | [255] | |||
|
1085 | $ hg shelve --stat | |||
|
1086 | abort: there are no shelves to show | |||
1062 | [255] |
|
1087 | [255] | |
1063 |
|
1088 | |||
1064 | $ cd .. |
|
1089 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now