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