##// END OF EJS Templates
dirstate: factor the transaction abort logic...
marmoute -
r51150:fa04407b default
parent child Browse files
Show More
@@ -1009,6 +1009,20 b' class dirstate:'
1009
1009
1010 self._dirty = True
1010 self._dirty = True
1011
1011
1012 def _setup_tr_abort(self, tr):
1013 """make sure we invalidate the current change on abort"""
1014 if tr is None:
1015 return
1016
1017 def on_abort(tr):
1018 self._attached_to_a_transaction = False
1019 self.invalidate()
1020
1021 tr.addabort(
1022 b'dirstate-invalidate%s' % self._tr_key_suffix,
1023 on_abort,
1024 )
1025
1012 def write(self, tr):
1026 def write(self, tr):
1013 if not self._dirty:
1027 if not self._dirty:
1014 return
1028 return
@@ -1019,17 +1033,7 b' class dirstate:'
1019 write_key = self._use_tracked_hint and self._dirty_tracked_set
1033 write_key = self._use_tracked_hint and self._dirty_tracked_set
1020 if tr:
1034 if tr:
1021
1035
1022 def on_abort(tr):
1036 self._setup_tr_abort(tr)
1023 self._attached_to_a_transaction = False
1024 self.invalidate()
1025
1026 # make sure we invalidate the current change on abort
1027 if tr is not None:
1028 tr.addabort(
1029 b'dirstate-invalidate%s' % self._tr_key_suffix,
1030 on_abort,
1031 )
1032
1033 self._attached_to_a_transaction = True
1037 self._attached_to_a_transaction = True
1034
1038
1035 def on_success(f):
1039 def on_success(f):
General Comments 0
You need to be logged in to leave comments. Login now