changeset 51733:e14ed26b72cb

largefiles: avoid a potentially undefined variable in exception case The `wlock` variable is used to release the lock in the `finally` block, so it would be undefined if `repo.wlock()` itself failed. Caught by pytype 2024.04.11 with py3.10.11.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 25 Jul 2024 13:31:13 -0400
parents 43460c311c0c
children f1aeca014d80
files hgext/largefiles/overrides.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Wed Jul 24 22:40:22 2024 -0400
+++ b/hgext/largefiles/overrides.py	Thu Jul 25 13:31:13 2024 -0400
@@ -825,11 +825,11 @@
         if not os.path.isdir(makestandin(dest)):
             os.makedirs(makestandin(dest))
 
+    # When we call orig below it creates the standins but we don't add
+    # them to the dir state until later so lock during that time.
+    wlock = repo.wlock()
+
     try:
-        # When we call orig below it creates the standins but we don't add
-        # them to the dir state until later so lock during that time.
-        wlock = repo.wlock()
-
         manifest = repo[None].manifest()
 
         def overridematch(