changeset 50130:a2def50142ea

dirstate: document the functions that need consolidation They are more functions that make the dirstate dirty but does not currently enforce a clean change scoping, we add comments in front of each of them so clarify this. There is no urgency to it, but the world will be a better place when all of them have proper scoping in place.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 16 Feb 2023 02:19:56 +0100
parents 8d02dfac072e
children 8eb460e0a202
files mercurial/dirstate.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Thu Feb 16 05:03:28 2023 +0100
+++ b/mercurial/dirstate.py	Thu Feb 16 02:19:56 2023 +0100
@@ -475,6 +475,9 @@
     def branch(self):
         return encoding.tolocal(self._branch)
 
+    # XXX since this make the dirstate dirty, we should enforce that it is done
+    # withing an appropriate change-context that scope the change and ensure it
+    # eventually get written on disk (or rolled back)
     def setparents(self, p1, p2=None):
         """Set dirstate parents to p1 and p2.
 
@@ -532,6 +535,9 @@
         self._invalidated_context = self._changing_level > 0
         self._origpl = None
 
+    # XXX since this make the dirstate dirty, we should enforce that it is done
+    # withing an appropriate change-context that scope the change and ensure it
+    # eventually get written on disk (or rolled back)
     def copy(self, source, dest):
         """Mark dest as a copy of source. Unmark dest if source is None."""
         if source == dest:
@@ -673,6 +679,9 @@
             parentfiledata=parentfiledata,
         )
 
+    # XXX since this make the dirstate dirty, we should enforce that it is done
+    # withing an appropriate change-context that scope the change and ensure it
+    # eventually get written on disk (or rolled back)
     def hacky_extension_update_file(self, *args, **kwargs):
         """NEVER USE THIS, YOU DO NOT NEED IT
 
@@ -834,10 +843,16 @@
             return self._normalize(path, isknown, ignoremissing)
         return path
 
+    # XXX since this make the dirstate dirty, we should enforce that it is done
+    # withing an appropriate change-context that scope the change and ensure it
+    # eventually get written on disk (or rolled back)
     def clear(self):
         self._map.clear()
         self._dirty = True
 
+    # XXX since this make the dirstate dirty, we should enforce that it is done
+    # withing an appropriate change-context that scope the change and ensure it
+    # eventually get written on disk (or rolled back)
     def rebuild(self, parent, allfiles, changedfiles=None):
         matcher = self._sparsematcher
         if matcher is not None and not matcher.always():
@@ -1413,6 +1428,9 @@
         )
         return (lookup, status)
 
+    # XXX since this can make the dirstate dirty (through rust), we should
+    # enforce that it is done withing an appropriate change-context that scope
+    # the change and ensure it eventually get written on disk (or rolled back)
     def status(self, match, subrepos, ignored, clean, unknown):
         """Determine the status of the working copy relative to the
         dirstate and return a pair of (unsure, status), where status is of type