diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -934,10 +934,21 @@ if opts.get("name"): shelved.append(opts["name"]) - if abortf or continuef and not interactive: + if len(shelved) > 1: + raise error.Abort(_('can only unshelve one change at a time')) + elif not shelved: + shelved = listshelves(repo) + if not shelved: + raise error.Abort(_('no shelved changes to apply!')) + basename = util.split(shelved[0][1])[1] + if not (abortf or continuef): + ui.status(_("unshelving change '%s'\n") % basename) + elif shelved: + basename = shelved[0] + if abortf or continuef: if abortf and continuef: raise error.Abort(_('cannot use both abort and continue')) - if shelved: + if opts.get("name"): raise error.Abort(_('cannot combine abort/continue with ' 'naming a shelved change')) if abortf and opts.get('tool', False): @@ -947,20 +958,7 @@ if abortf: return unshelveabort(ui, repo, state) elif continuef: - return unshelvecontinue(ui, repo, state, opts) - elif len(shelved) > 1: - raise error.Abort(_('can only unshelve one change at a time')) - elif not shelved: - shelved = listshelves(repo) - if not shelved: - raise error.Abort(_('no shelved changes to apply!')) - basename = util.split(shelved[0][1])[1] - ui.status(_("unshelving change '%s'\n") % basename) - elif shelved: - basename = shelved[0] - if continuef and interactive: - state = _loadshelvedstate(ui, repo, opts) - return unshelvecontinue(ui, repo, state, opts, basename) + return unshelvecontinue(ui, repo, state, opts, basename) if not shelvedfile(repo, basename, patchextension).exists(): raise error.Abort(_("shelved change '%s' not found") % basename) diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -1351,13 +1351,12 @@ A B C - $ hg unshelve --continue -i < y > y > y > y > EOF - unshelving change 'default-01' diff --git a/bar1 b/bar1 1 hunks, 1 lines changed examine changes to 'bar1'?