diff --git a/hgext/shelve.py b/hgext/shelve.py index b54a2984cdd49805309b58091741fcea99c1ab38_aGdleHQvc2hlbHZlLnB5..806a830e66123c92a3f457e3c244456adeb2af10_aGdleHQvc2hlbHZlLnB5 100644 --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -522,9 +522,8 @@ for chunk, label in patch.diffstatui(difflines, width=width): ui.write(chunk, label=label) -def singlepatchcmds(ui, repo, pats, opts, subcommand): - """subcommand that displays a single shelf""" - if len(pats) != 1: - raise error.Abort(_("--%s expects a single shelf") % subcommand) - shelfname = pats[0] +def patchcmds(ui, repo, pats, opts, subcommand): + """subcommand that displays shelves""" + if len(pats) == 0: + raise error.Abort(_("--%s expects at least one shelf") % subcommand) @@ -530,6 +529,7 @@ - if not shelvedfile(repo, shelfname, patchextension).exists(): - raise error.Abort(_("cannot find shelf %s") % shelfname) + for shelfname in pats: + if not shelvedfile(repo, shelfname, patchextension).exists(): + raise error.Abort(_("cannot find shelf %s") % shelfname) listcmd(ui, repo, pats, opts) @@ -967,5 +967,5 @@ elif checkopt('list'): return listcmd(ui, repo, pats, opts) elif checkopt('patch'): - return singlepatchcmds(ui, repo, pats, opts, subcommand='patch') + return patchcmds(ui, repo, pats, opts, subcommand='patch') elif checkopt('stat'): @@ -971,5 +971,5 @@ elif checkopt('stat'): - return singlepatchcmds(ui, repo, pats, opts, subcommand='stat') + return patchcmds(ui, repo, pats, opts, subcommand='stat') else: return createcmd(ui, repo, pats, opts) diff --git a/tests/test-shelve.t b/tests/test-shelve.t index b54a2984cdd49805309b58091741fcea99c1ab38_dGVzdHMvdGVzdC1zaGVsdmUudA==..806a830e66123c92a3f457e3c244456adeb2af10_dGVzdHMvdGVzdC1zaGVsdmUudA== 100644 --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -991,7 +991,7 @@ x x -shelve --patch and shelve --stat should work with a single valid shelfname +shelve --patch and shelve --stat should work with valid shelfnames $ hg up --clean . 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -1008,6 +1008,20 @@ shelved as default-01 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg shelve --patch default default-01 - abort: --patch expects a single shelf - [255] + default-01 (*)* changes to: create conflict (glob) + + diff --git a/shelf-patch-b b/shelf-patch-b + new file mode 100644 + --- /dev/null + +++ b/shelf-patch-b + @@ -0,0 +1,1 @@ + +patch b + default (*)* changes to: create conflict (glob) + + diff --git a/shelf-patch-a b/shelf-patch-a + new file mode 100644 + --- /dev/null + +++ b/shelf-patch-a + @@ -0,0 +1,1 @@ + +patch a $ hg shelve --stat default default-01 @@ -1013,6 +1027,10 @@ $ hg shelve --stat default default-01 - abort: --stat expects a single shelf - [255] + default-01 (*)* changes to: create conflict (glob) + shelf-patch-b | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + default (*)* changes to: create conflict (glob) + shelf-patch-a | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) $ hg shelve --patch default default (*)* changes to: create conflict (glob) @@ -1032,6 +1050,12 @@ $ hg shelve --stat nonexistentshelf abort: cannot find shelf nonexistentshelf [255] + $ hg shelve --patch default nonexistentshelf + abort: cannot find shelf nonexistentshelf + [255] + $ hg shelve --patch + abort: --patch expects at least one shelf + [255] $ cd ..