##// END OF EJS Templates
dirstate: perform transactions with _copymap using single call, where possible...
Michael Bolin -
r33983:5cb0a8fe default
parent child Browse files
Show More
@@ -406,13 +406,15 b' class dirstate(object):'
406
406
407 # Discard 'm' markers when moving away from a merge state
407 # Discard 'm' markers when moving away from a merge state
408 if s[0] == 'm':
408 if s[0] == 'm':
409 if f in self._copymap:
409 source = self._copymap.get(f)
410 copies[f] = self._copymap[f]
410 if source:
411 copies[f] = source
411 self.normallookup(f)
412 self.normallookup(f)
412 # Also fix up otherparent markers
413 # Also fix up otherparent markers
413 elif s[0] == 'n' and s[2] == -2:
414 elif s[0] == 'n' and s[2] == -2:
414 if f in self._copymap:
415 source = self._copymap.get(f)
415 copies[f] = self._copymap[f]
416 if source:
417 copies[f] = source
416 self.add(f)
418 self.add(f)
417 return copies
419 return copies
418
420
@@ -518,8 +520,7 b' class dirstate(object):'
518 self._copymap[dest] = source
520 self._copymap[dest] = source
519 self._updatedfiles.add(source)
521 self._updatedfiles.add(source)
520 self._updatedfiles.add(dest)
522 self._updatedfiles.add(dest)
521 elif dest in self._copymap:
523 elif self._copymap.pop(dest, None):
522 del self._copymap[dest]
523 self._updatedfiles.add(dest)
524 self._updatedfiles.add(dest)
524
525
525 def copied(self, file):
526 def copied(self, file):
@@ -568,8 +569,7 b' class dirstate(object):'
568 mtime = s.st_mtime
569 mtime = s.st_mtime
569 self._addpath(f, 'n', s.st_mode,
570 self._addpath(f, 'n', s.st_mode,
570 s.st_size & _rangemask, mtime & _rangemask)
571 s.st_size & _rangemask, mtime & _rangemask)
571 if f in self._copymap:
572 self._copymap.pop(f, None)
572 del self._copymap[f]
573 if f in self._nonnormalset:
573 if f in self._nonnormalset:
574 self._nonnormalset.remove(f)
574 self._nonnormalset.remove(f)
575 if mtime > self._lastnormaltime:
575 if mtime > self._lastnormaltime:
@@ -597,8 +597,7 b' class dirstate(object):'
597 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
597 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
598 return
598 return
599 self._addpath(f, 'n', 0, -1, -1)
599 self._addpath(f, 'n', 0, -1, -1)
600 if f in self._copymap:
600 self._copymap.pop(f, None)
601 del self._copymap[f]
602 if f in self._nonnormalset:
601 if f in self._nonnormalset:
603 self._nonnormalset.remove(f)
602 self._nonnormalset.remove(f)
604
603
@@ -613,15 +612,12 b' class dirstate(object):'
613 else:
612 else:
614 # add-like
613 # add-like
615 self._addpath(f, 'n', 0, -2, -1)
614 self._addpath(f, 'n', 0, -2, -1)
616
615 self._copymap.pop(f, None)
617 if f in self._copymap:
618 del self._copymap[f]
619
616
620 def add(self, f):
617 def add(self, f):
621 '''Mark a file added.'''
618 '''Mark a file added.'''
622 self._addpath(f, 'a', 0, -1, -1)
619 self._addpath(f, 'a', 0, -1, -1)
623 if f in self._copymap:
620 self._copymap.pop(f, None)
624 del self._copymap[f]
625
621
626 def remove(self, f):
622 def remove(self, f):
627 '''Mark a file removed.'''
623 '''Mark a file removed.'''
@@ -638,8 +634,8 b' class dirstate(object):'
638 self._otherparentset.add(f)
634 self._otherparentset.add(f)
639 self._map[f] = dirstatetuple('r', 0, size, 0)
635 self._map[f] = dirstatetuple('r', 0, size, 0)
640 self._nonnormalset.add(f)
636 self._nonnormalset.add(f)
641 if size == 0 and f in self._copymap:
637 if size == 0:
642 del self._copymap[f]
638 self._copymap.pop(f, None)
643
639
644 def merge(self, f):
640 def merge(self, f):
645 '''Mark a file merged.'''
641 '''Mark a file merged.'''
@@ -655,8 +651,7 b' class dirstate(object):'
655 del self._map[f]
651 del self._map[f]
656 if f in self._nonnormalset:
652 if f in self._nonnormalset:
657 self._nonnormalset.remove(f)
653 self._nonnormalset.remove(f)
658 if f in self._copymap:
654 self._copymap.pop(f, None)
659 del self._copymap[f]
660
655
661 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
656 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
662 if exists is None:
657 if exists is None:
General Comments 0
You need to be logged in to leave comments. Login now