##// END OF EJS Templates
dirstate: enforce the use of `changing_files` context to change tracking...
marmoute -
r50955:4f758b51 default
parent child Browse files
Show More
@@ -80,6 +80,17 b' def requires_changing_parents(func):'
80 80 return wrap
81 81
82 82
83 def requires_changing_files(func):
84 def wrap(self, *args, **kwargs):
85 if not self.is_changing_files:
86 msg = 'calling `%s` outside of a `changing_files`'
87 msg %= func.__name__
88 raise error.ProgrammingError(msg)
89 return func(self, *args, **kwargs)
90
91 return wrap
92
93
83 94 def requires_not_changing_parents(func):
84 95 def wrap(self, *args, **kwargs):
85 96 if self.is_changing_parents:
@@ -539,6 +550,7 b' class dirstate:'
539 550 return self._map.copymap
540 551
541 552 @requires_not_changing_parents
553 @requires_changing_files
542 554 def set_tracked(self, filename, reset_copy=False):
543 555 """a "public" method for generic code to mark a file as tracked
544 556
@@ -561,6 +573,7 b' class dirstate:'
561 573 return pre_tracked
562 574
563 575 @requires_not_changing_parents
576 @requires_changing_files
564 577 def set_untracked(self, filename):
565 578 """a "public" method for generic code to mark a file as untracked
566 579
General Comments 0
You need to be logged in to leave comments. Login now