shelve: fix a missing variable in the exception handler for delete stable
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 19 Nov 2019 14:36:22 -0500
branchstable
changeset 43435 cb23d9e3e21f
parent 43434 c5bcd946a34b
child 43436 132470ee53fe
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
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):