equal
deleted
inserted
replaced
22 Optional, |
22 Optional, |
23 Tuple, |
23 Tuple, |
24 ) |
24 ) |
25 |
25 |
26 from .i18n import _ |
26 from .i18n import _ |
27 from .interfaces.types import MatcherT |
27 from .interfaces.types import ( |
|
28 MatcherT, |
|
29 TransactionT, |
|
30 ) |
28 |
31 |
29 from hgdemandimport import tracing |
32 from hgdemandimport import tracing |
30 |
33 |
31 from . import ( |
34 from . import ( |
32 dirstatemap, |
35 dirstatemap, |
667 # True if we need to fold p2 related state back to a linear case |
670 # True if we need to fold p2 related state back to a linear case |
668 fold_p2 = oldp2 != nullid and p2 == nullid |
671 fold_p2 = oldp2 != nullid and p2 == nullid |
669 return self._map.setparents(p1, p2, fold_p2=fold_p2) |
672 return self._map.setparents(p1, p2, fold_p2=fold_p2) |
670 |
673 |
671 def setbranch( |
674 def setbranch( |
672 self, branch: bytes, transaction: Optional[intdirstate.TransactionT] |
675 self, branch: bytes, transaction: Optional[TransactionT] |
673 ) -> None: |
676 ) -> None: |
674 self.__class__._branch.set(self, encoding.fromlocal(branch)) |
677 self.__class__._branch.set(self, encoding.fromlocal(branch)) |
675 if transaction is not None: |
678 if transaction is not None: |
676 self._setup_tr_abort(transaction) |
679 self._setup_tr_abort(transaction) |
677 transaction.addfilegenerator( |
680 transaction.addfilegenerator( |
1100 tr.addabort( |
1103 tr.addabort( |
1101 b'dirstate-invalidate%s' % self._tr_key_suffix, |
1104 b'dirstate-invalidate%s' % self._tr_key_suffix, |
1102 on_abort, |
1105 on_abort, |
1103 ) |
1106 ) |
1104 |
1107 |
1105 def write(self, tr: Optional[intdirstate.TransactionT]) -> None: |
1108 def write(self, tr: Optional[TransactionT]) -> None: |
1106 if not self._dirty: |
1109 if not self._dirty: |
1107 return |
1110 return |
1108 # make sure we don't request a write of invalidated content |
1111 # make sure we don't request a write of invalidated content |
1109 # XXX move before the dirty check once `unlock` stop calling `write` |
1112 # XXX move before the dirty check once `unlock` stop calling `write` |
1110 assert not self._invalidated_context |
1113 assert not self._invalidated_context |