D11027: narrow: update narrow spec within a dirstate.parentchange context

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Jul 8 18:08:04 UTC 2021


marmoute created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Even if the parents does not changes, the parents' content we consider is
  changed. So this seems legitimate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11027

AFFECTED FILES
  hgext/narrow/narrowcommands.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -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



To: marmoute, durin42, martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list