##// END OF EJS Templates
dirstate: enforce context set_clean and set_possibly_dirty...
marmoute -
r51047:e9379b55 default
parent child Browse files
Show More
@@ -116,10 +116,13 b' def requires_changing_any(func):'
116 116 return check_invalidated(wrap)
117 117
118 118
119 def requires_not_changing_parents(func):
119 def requires_changing_files_or_status(func):
120 120 def wrap(self, *args, **kwargs):
121 if self.is_changing_parents:
122 msg = 'calling `%s` inside of a changing_parents context'
121 if not (self.is_changing_files or self._running_status > 0):
122 msg = (
123 'calling `%s` outside of a changing_files '
124 'or running_status context'
125 )
123 126 msg %= func.__name__
124 127 raise error.ProgrammingError(msg)
125 128 return func(self, *args, **kwargs)
@@ -698,7 +701,7 b' class dirstate:'
698 701 self._dirty_tracked_set = True
699 702 return ret
700 703
701 @requires_not_changing_parents
704 @requires_changing_files_or_status
702 705 def set_clean(self, filename, parentfiledata):
703 706 """record that the current state of the file on disk is known to be clean"""
704 707 self._dirty = True
@@ -707,7 +710,7 b' class dirstate:'
707 710 (mode, size, mtime) = parentfiledata
708 711 self._map.set_clean(filename, mode, size, mtime)
709 712
710 @requires_not_changing_parents
713 @requires_changing_files_or_status
711 714 def set_possibly_dirty(self, filename):
712 715 """record that the current state of the file on disk is unknown"""
713 716 self._dirty = True
General Comments 0
You need to be logged in to leave comments. Login now