39 util as interfaceutil, |
39 util as interfaceutil, |
40 ) |
40 ) |
41 |
41 |
42 parsers = policy.importmod('parsers') |
42 parsers = policy.importmod('parsers') |
43 rustmod = policy.importrust('dirstate') |
43 rustmod = policy.importrust('dirstate') |
44 |
|
45 # use to detect lack of a parameter |
|
46 SENTINEL = object() |
|
47 |
44 |
48 HAS_FAST_DIRSTATE_V2 = rustmod is not None |
45 HAS_FAST_DIRSTATE_V2 = rustmod is not None |
49 |
46 |
50 propertycache = util.propertycache |
47 propertycache = util.propertycache |
51 filecache = scmutil.filecache |
48 filecache = scmutil.filecache |
658 nullid = self._nodeconstants.nullid |
655 nullid = self._nodeconstants.nullid |
659 # True if we need to fold p2 related state back to a linear case |
656 # True if we need to fold p2 related state back to a linear case |
660 fold_p2 = oldp2 != nullid and p2 == nullid |
657 fold_p2 = oldp2 != nullid and p2 == nullid |
661 return self._map.setparents(p1, p2, fold_p2=fold_p2) |
658 return self._map.setparents(p1, p2, fold_p2=fold_p2) |
662 |
659 |
663 def setbranch(self, branch, transaction=SENTINEL): |
660 def setbranch(self, branch, transaction): |
664 self.__class__._branch.set(self, encoding.fromlocal(branch)) |
661 self.__class__._branch.set(self, encoding.fromlocal(branch)) |
665 if transaction is SENTINEL: |
|
666 msg = b"setbranch needs a `transaction` argument" |
|
667 self._ui.deprecwarn(msg, b'6.5') |
|
668 transaction = None |
|
669 if transaction is not None: |
662 if transaction is not None: |
670 self._setup_tr_abort(transaction) |
663 self._setup_tr_abort(transaction) |
671 transaction.addfilegenerator( |
664 transaction.addfilegenerator( |
672 b'dirstate-3-branch%s' % self._tr_key_suffix, |
665 b'dirstate-3-branch%s' % self._tr_key_suffix, |
673 (b'branch',), |
666 (b'branch',), |