[PATCH v2] shelve: make unshelve be able to abort in any case

Anton Shestakov engored at ya.ru
Fri Jul 8 01:30:14 EDT 2016


08.07.2016, 05:12, "Kostia Balytskyi" <ikostia at fb.com>:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1467925588 -7200
> # Thu Jul 07 23:06:28 2016 +0200
> # Node ID f06ece8d99297bb9e3e8446be6bedff66acbb831
> # Parent b4d117cee636be8a566f56e84d4b351a736a1299
> shelve: make unshelve be able to abort in any case
>
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -662,10 +662,23 @@ def _dounshelve(ui, repo, *shelved, **op
>
>          try:
>              state = shelvedstate.load(repo)
> + except error.HintException:
> + raise
>          except IOError as err:
> - if err.errno != errno.ENOENT:
> - raise
> - cmdutil.wrongtooltocontinue(repo, _('unshelve'))
> + if err.errno == errno.ENOENT:
> + cmdutil.wrongtooltocontinue(repo, _('unshelve'))

Does this mean every other IOError now get silently ignored?

> + except Exception as err:
> + if continuef:
> + msg = _('could not read shelved state file\nplease run '
> + 'hg unshelve --abort to abort unshelve operation\n')
> + raise error.Abort(msg)

This could use hint for Abort exception, like:

msg = _('could not read shelved state file')
hint = _('run hg unshelve --abort to abort unshelve operation')
Abort(msg, hint=hint)

(Sorry for mangled white spaces.)


More information about the Mercurial-devel mailing list