narrow: enforce that narrow spec is written within a transaction
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 23 Feb 2023 04:28:24 +0100
changeset 50192 6794f927bc48
parent 50191 99faa396e186
child 50193 ab806355fccb
narrow: enforce that narrow spec is written within a transaction
mercurial/narrowspec.py
--- 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)