changeset 47730:cc438f793b98

record: use `update_file` instead of `normallookup` We are cheating a bit to enforce we are in a pending change context. This will have to be cleaned up later. The end goal is reached, we are now using the newer, more semantic API. Differential Revision: https://phab.mercurial-scm.org/D11172
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Jul 2021 01:17:56 +0200
parents b66ae4468c9a
children 485ae37a7ec5
files mercurial/cmdutil.py
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Jul 19 05:43:43 2021 +0200
+++ b/mercurial/cmdutil.py	Mon Jul 19 01:17:56 2021 +0200
@@ -630,7 +630,19 @@
                         # without normallookup, restoring timestamp
                         # may cause partially committed files
                         # to be treated as unmodified
-                        dirstate.normallookup(realname)
+
+                        # XXX-PENDINGCHANGE: We should clarify the context in
+                        # which this function is called  to make sure it
+                        # already called within a `pendingchange`, However we
+                        # are taking a shortcut here in order to be able to
+                        # quickly deprecated the older API.
+                        with dirstate.parentchange():
+                            dirstate.update_file(
+                                realname,
+                                p1_tracked=True,
+                                wc_tracked=True,
+                                possibly_dirty=True,
+                            )
 
                     # copystat=True here and above are a hack to trick any
                     # editors that have f open that we haven't modified them.