Show More
@@ -49,7 +49,6 b' class dirstate(object):' | |||
|
49 | 49 | self._rootdir = os.path.join(root, '') |
|
50 | 50 | self._dirty = False |
|
51 | 51 | self._dirtypl = False |
|
52 | self._lastnormal = set() # files believed to be normal | |
|
53 | 52 | self._lastnormaltime = None |
|
54 | 53 | self._ui = ui |
|
55 | 54 | |
@@ -238,7 +237,6 b' class dirstate(object):' | |||
|
238 | 237 | "_ignore"): |
|
239 | 238 | if a in self.__dict__: |
|
240 | 239 | delattr(self, a) |
|
241 | self._lastnormal = set() | |
|
242 | 240 | self._lastnormaltime = None |
|
243 | 241 | self._dirty = False |
|
244 | 242 | |
@@ -289,24 +287,11 b' class dirstate(object):' | |||
|
289 | 287 | self._map[f] = ('n', s.st_mode, s.st_size, mtime) |
|
290 | 288 | if f in self._copymap: |
|
291 | 289 | del self._copymap[f] |
|
292 | ||
|
293 | if mtime < self._lastnormaltime: | |
|
294 | # We have already seen files with modification times from newer | |
|
295 | # filesystem timeslots, so this timeslot is old and harmless. | |
|
296 | # Comparing file times will work just fine for detecting modified | |
|
297 | # files in status(). No special treatment is needed for f. | |
|
298 | pass | |
|
299 | else: | |
|
300 | # f was modified most recently. | |
|
301 | if mtime > self._lastnormaltime: | |
|
302 | # A new timeslot, which we've never seen before. | |
|
303 | # We can drop the filenames of an older timeslot. | |
|
304 | self._lastnormaltime = mtime | |
|
305 | self._lastnormal = set() | |
|
306 | # Remember f in _lastnormal for closer inspection on status(), | |
|
290 | if mtime > self._lastnormaltime: | |
|
291 | # Remember the most recent modification timeslot for status(), | |
|
307 | 292 | # to make sure we won't miss future size-preserving file content |
|
308 | 293 | # modifications that happen within the same timeslot. |
|
309 |
self._lastnormal |
|
|
294 | self._lastnormaltime = mtime | |
|
310 | 295 | |
|
311 | 296 | def normallookup(self, f): |
|
312 | 297 | '''Mark a file normal, but possibly dirty.''' |
@@ -331,7 +316,6 b' class dirstate(object):' | |||
|
331 | 316 | self._map[f] = ('n', 0, -1, -1) |
|
332 | 317 | if f in self._copymap: |
|
333 | 318 | del self._copymap[f] |
|
334 | self._lastnormal.discard(f) | |
|
335 | 319 | |
|
336 | 320 | def otherparent(self, f): |
|
337 | 321 | '''Mark as coming from the other parent, always dirty.''' |
@@ -343,7 +327,6 b' class dirstate(object):' | |||
|
343 | 327 | self._map[f] = ('n', 0, -2, -1) |
|
344 | 328 | if f in self._copymap: |
|
345 | 329 | del self._copymap[f] |
|
346 | self._lastnormal.discard(f) | |
|
347 | 330 | |
|
348 | 331 | def add(self, f): |
|
349 | 332 | '''Mark a file added.''' |
@@ -352,7 +335,6 b' class dirstate(object):' | |||
|
352 | 335 | self._map[f] = ('a', 0, -1, -1) |
|
353 | 336 | if f in self._copymap: |
|
354 | 337 | del self._copymap[f] |
|
355 | self._lastnormal.discard(f) | |
|
356 | 338 | |
|
357 | 339 | def remove(self, f): |
|
358 | 340 | '''Mark a file removed.''' |
@@ -369,7 +351,6 b' class dirstate(object):' | |||
|
369 | 351 | self._map[f] = ('r', 0, size, 0) |
|
370 | 352 | if size == 0 and f in self._copymap: |
|
371 | 353 | del self._copymap[f] |
|
372 | self._lastnormal.discard(f) | |
|
373 | 354 | |
|
374 | 355 | def merge(self, f): |
|
375 | 356 | '''Mark a file merged.''' |
@@ -379,7 +360,6 b' class dirstate(object):' | |||
|
379 | 360 | self._map[f] = ('m', s.st_mode, s.st_size, int(s.st_mtime)) |
|
380 | 361 | if f in self._copymap: |
|
381 | 362 | del self._copymap[f] |
|
382 | self._lastnormal.discard(f) | |
|
383 | 363 | |
|
384 | 364 | def forget(self, f): |
|
385 | 365 | '''Forget a file.''' |
@@ -389,7 +369,6 b' class dirstate(object):' | |||
|
389 | 369 | del self._map[f] |
|
390 | 370 | except KeyError: |
|
391 | 371 | self._ui.warn(_("not in dirstate: %s\n") % f) |
|
392 | self._lastnormal.discard(f) | |
|
393 | 372 | |
|
394 | 373 | def _normalize(self, path, isknown): |
|
395 | 374 | normed = os.path.normcase(path) |
@@ -426,7 +405,6 b' class dirstate(object):' | |||
|
426 | 405 | delattr(self, "_dirs") |
|
427 | 406 | self._copymap = {} |
|
428 | 407 | self._pl = [nullid, nullid] |
|
429 | self._lastnormal = set() | |
|
430 | 408 | self._lastnormaltime = None |
|
431 | 409 | self._dirty = True |
|
432 | 410 | |
@@ -475,7 +453,6 b' class dirstate(object):' | |||
|
475 | 453 | write(f) |
|
476 | 454 | st.write(cs.getvalue()) |
|
477 | 455 | st.rename() |
|
478 | self._lastnormal = set() | |
|
479 | 456 | self._lastnormaltime = None |
|
480 | 457 | self._dirty = self._dirtypl = False |
|
481 | 458 | |
@@ -691,7 +668,6 b' class dirstate(object):' | |||
|
691 | 668 | radd = removed.append |
|
692 | 669 | dadd = deleted.append |
|
693 | 670 | cadd = clean.append |
|
694 | lastnormal = self._lastnormal.__contains__ | |
|
695 | 671 | |
|
696 | 672 | lnkkind = stat.S_IFLNK |
|
697 | 673 | |
@@ -714,6 +690,7 b' class dirstate(object):' | |||
|
714 | 690 | # lines are an expansion of "islink => checklink" |
|
715 | 691 | # where islink means "is this a link?" and checklink |
|
716 | 692 | # means "can we check links?". |
|
693 | mtime = int(st.st_mtime) | |
|
717 | 694 | if (size >= 0 and |
|
718 | 695 | (size != st.st_size |
|
719 | 696 | or ((mode ^ st.st_mode) & 0100 and self._checkexec)) |
@@ -721,20 +698,14 b' class dirstate(object):' | |||
|
721 | 698 | or size == -2 # other parent |
|
722 | 699 | or fn in self._copymap): |
|
723 | 700 | madd(fn) |
|
724 |
elif (time != |
|
|
701 | elif (mtime != time | |
|
725 | 702 | and (mode & lnkkind != lnkkind or self._checklink)): |
|
726 | 703 | ladd(fn) |
|
727 |
elif lastnormal |
|
|
728 | # If previously in this process we recorded that | |
|
729 | # this file is clean, think twice: intervening code | |
|
730 |
# m |
|
|
731 | # without changing its size. So force caller to | |
|
732 | # check file contents. Because we're not updating | |
|
733 | # self._map, this only affects the current process. | |
|
734 | # That should be OK because this mainly affects | |
|
735 | # multiple commits in the same process, and each | |
|
736 | # commit by definition makes the committed files | |
|
737 | # clean. | |
|
704 | elif mtime == self._lastnormaltime: | |
|
705 | # fn may have been changed in the same timeslot without | |
|
706 | # changing its size. This can happen if we quickly do | |
|
707 | # multiple commits in a single transaction. | |
|
708 | # Force lookup, so we don't miss such a racy file change. | |
|
738 | 709 | ladd(fn) |
|
739 | 710 | elif listclean: |
|
740 | 711 | cadd(fn) |
General Comments 0
You need to be logged in to leave comments.
Login now