# HG changeset patch # User Matt Harbison # Date 1574192182 18000 # Node ID cb23d9e3e21ffbc9c46f310a4a3d6d09da96d92d # Parent c5bcd946a34b77d7680d62ea329542a06d48b5df shelve: fix a missing variable in the exception handler for delete Caught by pytype. I haven't paid much attention to the progress of this extension, but I *think* this was the intent. Differential Revision: https://phab.mercurial-scm.org/D7457 diff -r c5bcd946a34b -r cb23d9e3e21f mercurial/shelve.py --- a/mercurial/shelve.py Tue Nov 19 11:59:43 2019 +0100 +++ b/mercurial/shelve.py Tue Nov 19 14:36:22 2019 -0500 @@ -603,8 +603,8 @@ if not pats: raise error.Abort(_(b'no shelved changes specified!')) with repo.wlock(): - try: - for name in pats: + for name in pats: + try: for suffix in shelvefileextensions: shfile = shelvedfile(repo, name, suffix) # patch file is necessary, as it should @@ -614,11 +614,11 @@ # bundle if shfile.exists() or suffix == patchextension: shfile.movetobackup() + except OSError as err: + if err.errno != errno.ENOENT: + raise + raise error.Abort(_(b"shelved change '%s' not found") % name) cleanupoldbackups(repo) - except OSError as err: - if err.errno != errno.ENOENT: - raise - raise error.Abort(_(b"shelved change '%s' not found") % name) def listshelves(repo):