win32text: drop the `changing_parents` context in revert upgrade
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 25 Jan 2023 12:47:55 +0100
changeset 50013 05a2f65c9e86
parent 50012 d68b71256c33
child 50014 b7ddd9ae4bef
win32text: drop the `changing_parents` context in revert upgrade We are not changing parents here, so let us not pretend we do.
hgext/win32text.py
--- a/hgext/win32text.py	Wed Feb 15 00:29:39 2023 +0100
+++ b/hgext/win32text.py	Wed Jan 25 12:47:55 2023 +0100
@@ -216,24 +216,23 @@
 def wrap_revert(orig, repo, ctx, names, uipathfn, actions, *args, **kwargs):
     # reset dirstate cache for file we touch
     ds = repo.dirstate
-    with ds.changing_parents(repo):
-        for filename in actions[b'revert'][0]:
-            entry = ds.get_entry(filename)
-            if entry is not None:
-                if entry.p1_tracked:
-                    # If we revert the file, it is possibly dirty. However,
-                    # this extension meddle with the file content and therefore
-                    # its size. As a result, we cannot simply call
-                    # `dirstate.set_possibly_dirty` as it will not affet the
-                    # expected size of the file.
-                    #
-                    # At least, now, the quirk is properly documented.
-                    ds.hacky_extension_update_file(
-                        filename,
-                        entry.tracked,
-                        p1_tracked=True,
-                        p2_info=entry.p2_info,
-                    )
+    for filename in actions[b'revert'][0]:
+        entry = ds.get_entry(filename)
+        if entry is not None:
+            if entry.p1_tracked:
+                # If we revert the file, it is possibly dirty. However,
+                # this extension meddle with the file content and therefore
+                # its size. As a result, we cannot simply call
+                # `dirstate.set_possibly_dirty` as it will not affet the
+                # expected size of the file.
+                #
+                # At least, now, the quirk is properly documented.
+                ds.hacky_extension_update_file(
+                    filename,
+                    entry.tracked,
+                    p1_tracked=True,
+                    p2_info=entry.p2_info,
+                )
     return orig(repo, ctx, names, uipathfn, actions, *args, **kwargs)