largefiles: use context manager for setting "lfstatus" on subrepos too
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 18 Oct 2019 15:16:57 -0700
changeset 43296 2cb787b65cf2
parent 43295 013637f4812e
child 43297 8a2925265402
largefiles: use context manager for setting "lfstatus" on subrepos too It's safe since we now reset to the previous value. Differential Revision: https://phab.mercurial-scm.org/D7138
hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Fri Oct 18 15:14:51 2019 -0700
+++ b/hgext/largefiles/overrides.py	Fri Oct 18 15:16:57 2019 -0700
@@ -1208,8 +1208,8 @@
             sub = ctx.workingsub(subpath)
             submatch = matchmod.subdirmatcher(subpath, match)
             subprefix = prefix + subpath + b'/'
-            sub._repo.lfstatus = True
-            sub.archive(archiver, subprefix, submatch)
+            with lfstatus(sub._repo):
+                sub.archive(archiver, subprefix, submatch)
 
     archiver.done()
 
@@ -1266,8 +1266,8 @@
         sub = ctx.workingsub(subpath)
         submatch = matchmod.subdirmatcher(subpath, match)
         subprefix = prefix + subpath + b'/'
-        sub._repo.lfstatus = True
-        sub.archive(archiver, subprefix, submatch, decode)
+        with lfstatus(sub._repo):
+            sub.archive(archiver, subprefix, submatch, decode)
 
 
 # If a largefile is modified, the change is not reflected in its