changeset 47604:090fc6a95e50

narrow: update narrow spec within a dirstate.parentchange context Even if the parents does not changes, the parents' content we consider is changed. So this seems legitimate. Differential Revision: https://phab.mercurial-scm.org/D11027
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jul 2021 18:51:45 +0200
parents 7c64688e554d
children a5701ffc10e4
files hgext/narrow/narrowcommands.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowcommands.py	Thu Jul 08 18:30:24 2021 +0200
+++ b/hgext/narrow/narrowcommands.py	Thu Jul 08 18:51:45 2021 +0200
@@ -321,8 +321,9 @@
                 repo.store.markremoved(f)
 
             ui.status(_(b'deleting unwanted files from working copy\n'))
-            narrowspec.updateworkingcopy(repo, assumeclean=True)
-            narrowspec.copytoworkingcopy(repo)
+            with repo.dirstate.parentchange():
+                narrowspec.updateworkingcopy(repo, assumeclean=True)
+                narrowspec.copytoworkingcopy(repo)
 
         repo.destroyed()
 
@@ -422,7 +423,7 @@
             with ds.parentchange():
                 ds.setparents(p1, p2)
 
-        with repo.transaction(b'widening'):
+        with repo.transaction(b'widening'), repo.dirstate.parentchange():
             repo.setnewnarrowpats()
             narrowspec.updateworkingcopy(repo)
             narrowspec.copytoworkingcopy(repo)
@@ -589,7 +590,9 @@
         return 0
 
     if update_working_copy:
-        with repo.wlock(), repo.lock(), repo.transaction(b'narrow-wc'):
+        with repo.wlock(), repo.lock(), repo.transaction(
+            b'narrow-wc'
+        ), repo.dirstate.parentchange():
             narrowspec.updateworkingcopy(repo)
             narrowspec.copytoworkingcopy(repo)
         return 0