# HG changeset patch # User Pierre-Yves David # Date 1677754469 -3600 # Node ID 307c155e6275984611c05fc2d5ddc229aa264343 # Parent 240a04cedd2412a5f837e4b51a2b523e3bacbb67 dirstate: deprecate calling `setbranch` without a transaction parameter The new way is now enforced. diff -r 240a04cedd24 -r 307c155e6275 mercurial/dirstate.py --- a/mercurial/dirstate.py Thu Mar 02 14:46:37 2023 +0100 +++ b/mercurial/dirstate.py Thu Mar 02 11:54:29 2023 +0100 @@ -43,6 +43,9 @@ 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 @@ -621,8 +624,12 @@ fold_p2 = oldp2 != nullid and p2 == nullid return self._map.setparents(p1, p2, fold_p2=fold_p2) - def setbranch(self, branch, transaction=None): + def setbranch(self, branch, transaction=SENTINEL): 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(