largefiles: remove the second `changing_parents` in `updatelfiles`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 15 Feb 2023 00:57:16 +0100
changeset 50019 eed104af7401
parent 50018 ef1540c57730
child 50020 e2f3cba678ce
largefiles: remove the second `changing_parents` in `updatelfiles` Now that the `update_file` call have been migrated, we can drop the semantically-wrong `changing_parents` context.
hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py	Wed Feb 15 00:55:44 2023 +0100
+++ b/hgext/largefiles/lfcommands.py	Wed Feb 15 00:57:16 2023 +0100
@@ -579,43 +579,42 @@
             statuswriter(_(b'getting changed largefiles\n'))
             cachelfiles(ui, repo, None, lfiles)
 
-        with lfdirstate.changing_parents(repo):
-            for lfile in lfiles:
-                update1 = 0
+        for lfile in lfiles:
+            update1 = 0
 
-                expecthash = update.get(lfile)
-                if expecthash:
-                    if not lfutil.copyfromcache(repo, expecthash, lfile):
-                        # failed ... but already removed and set to normallookup
-                        continue
-                    # Synchronize largefile dirstate to the last modified
-                    # time of the file
-                    lfdirstate.hacky_extension_update_file(
-                        lfile,
-                        p1_tracked=True,
-                        wc_tracked=True,
-                    )
+            expecthash = update.get(lfile)
+            if expecthash:
+                if not lfutil.copyfromcache(repo, expecthash, lfile):
+                    # failed ... but already removed and set to normallookup
+                    continue
+                # Synchronize largefile dirstate to the last modified
+                # time of the file
+                lfdirstate.hacky_extension_update_file(
+                    lfile,
+                    p1_tracked=True,
+                    wc_tracked=True,
+                )
+                update1 = 1
+
+            # copy the exec mode of largefile standin from the repository's
+            # dirstate to its state in the lfdirstate.
+            standin = lfutil.standin(lfile)
+            if wvfs.exists(standin):
+                # exec is decided by the users permissions using mask 0o100
+                standinexec = wvfs.stat(standin).st_mode & 0o100
+                st = wvfs.stat(lfile)
+                mode = st.st_mode
+                if standinexec != mode & 0o100:
+                    # first remove all X bits, then shift all R bits to X
+                    mode &= ~0o111
+                    if standinexec:
+                        mode |= (mode >> 2) & 0o111 & ~util.umask
+                    wvfs.chmod(lfile, mode)
                     update1 = 1
 
-                # copy the exec mode of largefile standin from the repository's
-                # dirstate to its state in the lfdirstate.
-                standin = lfutil.standin(lfile)
-                if wvfs.exists(standin):
-                    # exec is decided by the users permissions using mask 0o100
-                    standinexec = wvfs.stat(standin).st_mode & 0o100
-                    st = wvfs.stat(lfile)
-                    mode = st.st_mode
-                    if standinexec != mode & 0o100:
-                        # first remove all X bits, then shift all R bits to X
-                        mode &= ~0o111
-                        if standinexec:
-                            mode |= (mode >> 2) & 0o111 & ~util.umask
-                        wvfs.chmod(lfile, mode)
-                        update1 = 1
+            updated += update1
 
-                updated += update1
-
-                lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)
+            lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)
 
         lfdirstate.write(repo.currenttransaction())
         if lfiles: