##// END OF EJS Templates
dirstate: perform transactions with _map using single call, where possible...
Michael Bolin -
r34189:1246acda default
parent child Browse files
Show More
@@ -550,7 +550,8 b' class dirstate(object):'
550 for d in util.finddirs(f):
550 for d in util.finddirs(f):
551 if d in self._dirs:
551 if d in self._dirs:
552 break
552 break
553 if d in self._map and self[d] != 'r':
553 entry = self._map.get(d)
554 if entry is not None and entry[0] != 'r':
554 raise error.Abort(
555 raise error.Abort(
555 _('file %r in dirstate clashes with %r') % (d, f))
556 _('file %r in dirstate clashes with %r') % (d, f))
556 if oldstate in "?r" and "_dirs" in self.__dict__:
557 if oldstate in "?r" and "_dirs" in self.__dict__:
@@ -580,22 +581,23 b' class dirstate(object):'
580
581
581 def normallookup(self, f):
582 def normallookup(self, f):
582 '''Mark a file normal, but possibly dirty.'''
583 '''Mark a file normal, but possibly dirty.'''
583 if self._pl[1] != nullid and f in self._map:
584 if self._pl[1] != nullid:
584 # if there is a merge going on and the file was either
585 # if there is a merge going on and the file was either
585 # in state 'm' (-1) or coming from other parent (-2) before
586 # in state 'm' (-1) or coming from other parent (-2) before
586 # being removed, restore that state.
587 # being removed, restore that state.
587 entry = self._map[f]
588 entry = self._map.get(f)
588 if entry[0] == 'r' and entry[2] in (-1, -2):
589 if entry is not None:
589 source = self._copymap.get(f)
590 if entry[0] == 'r' and entry[2] in (-1, -2):
590 if entry[2] == -1:
591 source = self._copymap.get(f)
591 self.merge(f)
592 if entry[2] == -1:
592 elif entry[2] == -2:
593 self.merge(f)
593 self.otherparent(f)
594 elif entry[2] == -2:
594 if source:
595 self.otherparent(f)
595 self.copy(source, f)
596 if source:
596 return
597 self.copy(source, f)
597 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
598 return
598 return
599 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
600 return
599 self._addpath(f, 'n', 0, -1, -1)
601 self._addpath(f, 'n', 0, -1, -1)
600 self._copymap.pop(f, None)
602 self._copymap.pop(f, None)
601 if f in self._nonnormalset:
603 if f in self._nonnormalset:
@@ -624,14 +626,15 b' class dirstate(object):'
624 self._dirty = True
626 self._dirty = True
625 self._droppath(f)
627 self._droppath(f)
626 size = 0
628 size = 0
627 if self._pl[1] != nullid and f in self._map:
629 if self._pl[1] != nullid:
628 # backup the previous state
630 entry = self._map.get(f)
629 entry = self._map[f]
631 if entry is not None:
630 if entry[0] == 'm': # merge
632 # backup the previous state
631 size = -1
633 if entry[0] == 'm': # merge
632 elif entry[0] == 'n' and entry[2] == -2: # other parent
634 size = -1
633 size = -2
635 elif entry[0] == 'n' and entry[2] == -2: # other parent
634 self._otherparentset.add(f)
636 size = -2
637 self._otherparentset.add(f)
635 self._map[f] = dirstatetuple('r', 0, size, 0)
638 self._map[f] = dirstatetuple('r', 0, size, 0)
636 self._nonnormalset.add(f)
639 self._nonnormalset.add(f)
637 if size == 0:
640 if size == 0:
General Comments 0
You need to be logged in to leave comments. Login now