##// END OF EJS Templates
dirstate: track updated files to improve write time...
Durham Goode -
r31206:49e5491e default
parent child Browse files
Show More
@@ -89,6 +89,7 b' class dirstate(object):'
89 self._pendingfilename = '%s.pending' % self._filename
89 self._pendingfilename = '%s.pending' % self._filename
90 self._plchangecallbacks = {}
90 self._plchangecallbacks = {}
91 self._origpl = None
91 self._origpl = None
92 self._updatedfiles = set()
92
93
93 # for consistent view between _pl() and _read() invocations
94 # for consistent view between _pl() and _read() invocations
94 self._pendingmode = None
95 self._pendingmode = None
@@ -431,6 +432,7 b' class dirstate(object):'
431 delattr(self, a)
432 delattr(self, a)
432 self._lastnormaltime = 0
433 self._lastnormaltime = 0
433 self._dirty = False
434 self._dirty = False
435 self._updatedfiles.clear()
434 self._parentwriters = 0
436 self._parentwriters = 0
435 self._origpl = None
437 self._origpl = None
436
438
@@ -441,8 +443,11 b' class dirstate(object):'
441 self._dirty = True
443 self._dirty = True
442 if source is not None:
444 if source is not None:
443 self._copymap[dest] = source
445 self._copymap[dest] = source
446 self._updatedfiles.add(source)
447 self._updatedfiles.add(dest)
444 elif dest in self._copymap:
448 elif dest in self._copymap:
445 del self._copymap[dest]
449 del self._copymap[dest]
450 self._updatedfiles.add(dest)
446
451
447 def copied(self, file):
452 def copied(self, file):
448 return self._copymap.get(file, None)
453 return self._copymap.get(file, None)
@@ -459,6 +464,8 b' class dirstate(object):'
459 if normed in self._filefoldmap:
464 if normed in self._filefoldmap:
460 del self._filefoldmap[normed]
465 del self._filefoldmap[normed]
461
466
467 self._updatedfiles.add(f)
468
462 def _addpath(self, f, state, mode, size, mtime):
469 def _addpath(self, f, state, mode, size, mtime):
463 oldstate = self[f]
470 oldstate = self[f]
464 if state == 'a' or oldstate == 'r':
471 if state == 'a' or oldstate == 'r':
@@ -475,6 +482,7 b' class dirstate(object):'
475 if oldstate in "?r" and "_dirs" in self.__dict__:
482 if oldstate in "?r" and "_dirs" in self.__dict__:
476 self._dirs.addpath(f)
483 self._dirs.addpath(f)
477 self._dirty = True
484 self._dirty = True
485 self._updatedfiles.add(f)
478 self._map[f] = dirstatetuple(state, mode, size, mtime)
486 self._map[f] = dirstatetuple(state, mode, size, mtime)
479 if state != 'n' or mtime == -1:
487 if state != 'n' or mtime == -1:
480 self._nonnormalset.add(f)
488 self._nonnormalset.add(f)
@@ -656,6 +664,7 b' class dirstate(object):'
656 self._copymap = {}
664 self._copymap = {}
657 self._pl = [nullid, nullid]
665 self._pl = [nullid, nullid]
658 self._lastnormaltime = 0
666 self._lastnormaltime = 0
667 self._updatedfiles.clear()
659 self._dirty = True
668 self._dirty = True
660
669
661 def rebuild(self, parent, allfiles, changedfiles=None):
670 def rebuild(self, parent, allfiles, changedfiles=None):
@@ -692,13 +701,15 b' class dirstate(object):'
692 # emulate dropping timestamp in 'parsers.pack_dirstate'
701 # emulate dropping timestamp in 'parsers.pack_dirstate'
693 now = _getfsnow(self._opener)
702 now = _getfsnow(self._opener)
694 dmap = self._map
703 dmap = self._map
695 for f, e in dmap.iteritems():
704 for f in self._updatedfiles:
696 if e[0] == 'n' and e[3] == now:
705 e = dmap.get(f)
706 if e is not None and e[0] == 'n' and e[3] == now:
697 dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
707 dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
698 self._nonnormalset.add(f)
708 self._nonnormalset.add(f)
699
709
700 # emulate that all 'dirstate.normal' results are written out
710 # emulate that all 'dirstate.normal' results are written out
701 self._lastnormaltime = 0
711 self._lastnormaltime = 0
712 self._updatedfiles.clear()
702
713
703 # delay writing in-memory changes out
714 # delay writing in-memory changes out
704 tr.addfilegenerator('dirstate', (self._filename,),
715 tr.addfilegenerator('dirstate', (self._filename,),
General Comments 0
You need to be logged in to leave comments. Login now