largefiles: avoid a potentially undefined variable in exception case
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 25 Jul 2024 13:31:13 -0400
changeset 51733 e14ed26b72cb
parent 51732 43460c311c0c
child 51734 f1aeca014d80
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.
hgext/largefiles/overrides.py
--- 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(