changeset 50231:6794f927bc48

narrow: enforce that narrow spec is written within a transaction
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 23 Feb 2023 04:28:24 +0100
parents 99faa396e186
children ab806355fccb
files mercurial/narrowspec.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/narrowspec.py	Thu Feb 23 04:42:17 2023 +0100
+++ b/mercurial/narrowspec.py	Thu Feb 23 04:28:24 2023 +0100
@@ -182,7 +182,8 @@
 
     tr = repo.currenttransaction()
     if tr is None:
-        repo.svfs.write(FILENAME, spec)
+        m = "changing narrow spec outside of a transaction"
+        raise error.ProgrammingError(m)
     else:
         # the roundtrip is sometime different
         # not taking any chance for now
@@ -215,7 +216,8 @@
     tr = repo.currenttransaction()
     spec = format(*repo.narrowpats)
     if tr is None:
-        repo.vfs.write(DIRSTATE_FILENAME, spec)
+        m = "changing narrow spec outside of a transaction"
+        raise error.ProgrammingError(m)
     else:
 
         reporef = weakref.ref(repo)