win32text: clean up and clarify the post-revert hack of dirstate
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 15 Feb 2023 00:29:39 +0100
changeset 50012 d68b71256c33
parent 50011 016dc2387943
child 50013 05a2f65c9e86
win32text: clean up and clarify the post-revert hack of dirstate The change is unrelated to changing parents and should not be a in a "changing_parents" context. This call is quite hacky, but now it is at least explicitly hacky. We will drop the `changing_parents` context in the next changesets, but we kept this change simple to help readability.
hgext/win32text.py
--- a/hgext/win32text.py	Wed Feb 15 00:26:08 2023 +0100
+++ b/hgext/win32text.py	Wed Feb 15 00:29:39 2023 +0100
@@ -221,7 +221,14 @@
             entry = ds.get_entry(filename)
             if entry is not None:
                 if entry.p1_tracked:
-                    ds.update_file(
+                    # 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,