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
--- 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