##// END OF EJS Templates
dirstate: rename _parentwriters to _changing_level...
marmoute -
r50916:4e955a7a default
parent child Browse files
Show More
@@ -128,7 +128,7 b' class dirstate:'
128 128 self._ui = ui
129 129 self._filecache = {}
130 130 # nesting level of `changing_parents` context
131 self._parentwriters = 0
131 self._changing_level = 0
132 132 # True if the current dirstate changing operations have been
133 133 # invalidated (used to make sure all nested contexts have been exited)
134 134 self._invalidated_context = False
@@ -164,23 +164,23 b' class dirstate:'
164 164 if self._invalidated_context:
165 165 msg = "trying to use an invalidated dirstate before it has reset"
166 166 raise error.ProgrammingError(msg)
167 self._parentwriters += 1
167 self._changing_level += 1
168 168 try:
169 169 yield
170 170 except Exception:
171 171 self.invalidate()
172 172 raise
173 173 finally:
174 if self._parentwriters > 0:
174 if self._changing_level > 0:
175 175 if self._invalidated_context:
176 176 # make sure we invalidate anything an upper context might
177 177 # have changed.
178 178 self.invalidate()
179 self._parentwriters -= 1
179 self._changing_level -= 1
180 180 # The invalidation is complete once we exit the final context
181 181 # manager
182 if self._parentwriters <= 0:
183 assert self._parentwriters == 0
182 if self._changing_level <= 0:
183 assert self._changing_level == 0
184 184 if self._invalidated_context:
185 185 self._invalidated_context = False
186 186 else:
@@ -206,7 +206,7 b' class dirstate:'
206 206 """Returns true if the dirstate is in the middle of a set of changes
207 207 that modify the dirstate parent.
208 208 """
209 return self._parentwriters > 0
209 return self._changing_level > 0
210 210
211 211 @propertycache
212 212 def _map(self):
@@ -418,7 +418,7 b' class dirstate:'
418 418 """
419 419 if p2 is None:
420 420 p2 = self._nodeconstants.nullid
421 if self._parentwriters == 0:
421 if self._changing_level == 0:
422 422 raise ValueError(
423 423 b"cannot set dirstate parent outside of "
424 424 b"dirstate.changing_parents context manager"
@@ -461,7 +461,7 b' class dirstate:'
461 461 delattr(self, a)
462 462 self._dirty = False
463 463 self._dirty_tracked_set = False
464 self._invalidated_context = self._parentwriters > 0
464 self._invalidated_context = self._changing_level > 0
465 465 self._origpl = None
466 466
467 467 def copy(self, source, dest):
@@ -769,7 +769,6 b' class dirstate:'
769 769 self._dirty = True
770 770
771 771 def rebuild(self, parent, allfiles, changedfiles=None):
772
773 772 matcher = self._sparsematcher
774 773 if matcher is not None and not matcher.always():
775 774 # should not add non-matching files
@@ -808,7 +807,6 b' class dirstate:'
808 807 self._map.setparents(parent, self._nodeconstants.nullid)
809 808
810 809 for f in to_lookup:
811
812 810 if self.in_merge:
813 811 self.set_tracked(f)
814 812 else:
@@ -1020,7 +1018,8 b' class dirstate:'
1020 1018 badfn(ff, badtype(kind))
1021 1019 if nf in dmap:
1022 1020 results[nf] = None
1023 except OSError as inst: # nf not found on disk - it is dirstate only
1021 except (OSError) as inst:
1022 # nf not found on disk - it is dirstate only
1024 1023 if nf in dmap: # does it exactly match a missing file?
1025 1024 results[nf] = None
1026 1025 else: # does it match a missing directory?
@@ -1330,7 +1329,7 b' class dirstate:'
1330 1329 )
1331 1330 )
1332 1331
1333 for (fn, message) in bad:
1332 for fn, message in bad:
1334 1333 matcher.bad(fn, encoding.strtolocal(message))
1335 1334
1336 1335 status = scmutil.status(
General Comments 0
You need to be logged in to leave comments. Login now