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