dirstate: make the `transaction` argument of `setbranch` mandatory
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 12 Dec 2023 17:08:45 +0100
changeset 51273 79cd29d598af
parent 51272 c4cbb515b006
child 51274 bec6e9c108fd
dirstate: make the `transaction` argument of `setbranch` mandatory This is deprecated since 6.4. We should drop it now.
hgext/git/dirstate.py
mercurial/dirstate.py
mercurial/interfaces/dirstate.py
--- a/hgext/git/dirstate.py	Wed Dec 20 14:59:31 2023 +0100
+++ b/hgext/git/dirstate.py	Tue Dec 12 17:08:45 2023 +0100
@@ -389,7 +389,7 @@
         # TODO: should this be added to the dirstate interface?
         self._plchangecallbacks[category] = callback
 
-    def setbranch(self, branch, transaction=None):
+    def setbranch(self, branch, transaction):
         raise error.Abort(
             b'git repos do not support branches. try using bookmarks'
         )
--- a/mercurial/dirstate.py	Wed Dec 20 14:59:31 2023 +0100
+++ b/mercurial/dirstate.py	Tue Dec 12 17:08:45 2023 +0100
@@ -42,9 +42,6 @@
 parsers = policy.importmod('parsers')
 rustmod = policy.importrust('dirstate')
 
-# use to detect lack of a parameter
-SENTINEL = object()
-
 HAS_FAST_DIRSTATE_V2 = rustmod is not None
 
 propertycache = util.propertycache
@@ -660,12 +657,8 @@
         fold_p2 = oldp2 != nullid and p2 == nullid
         return self._map.setparents(p1, p2, fold_p2=fold_p2)
 
-    def setbranch(self, branch, transaction=SENTINEL):
+    def setbranch(self, branch, transaction):
         self.__class__._branch.set(self, encoding.fromlocal(branch))
-        if transaction is SENTINEL:
-            msg = b"setbranch needs a `transaction` argument"
-            self._ui.deprecwarn(msg, b'6.5')
-            transaction = None
         if transaction is not None:
             self._setup_tr_abort(transaction)
             transaction.addfilegenerator(
--- a/mercurial/interfaces/dirstate.py	Wed Dec 20 14:59:31 2023 +0100
+++ b/mercurial/interfaces/dirstate.py	Tue Dec 12 17:08:45 2023 +0100
@@ -123,7 +123,7 @@
         See localrepo.setparents()
         """
 
-    def setbranch(branch, transaction=None):
+    def setbranch(branch, transaction):
         pass
 
     def invalidate():