##// END OF EJS Templates
dirstate: introduce a symbolic constant for the NONNORMAL marker...
marmoute -
r48277:4ac418b4 default
parent child Browse files
Show More
@@ -51,6 +51,9 b' dirstatetuple = parsers.dirstatetuple'
51 # a special value used internally for `size` if the file come from the other parent
51 # a special value used internally for `size` if the file come from the other parent
52 FROM_P2 = -2
52 FROM_P2 = -2
53
53
54 # a special value used internally for `size` if the file is modified/merged/added
55 NONNORMAL = -1
56
54
57
55 class repocache(filecache):
58 class repocache(filecache):
56 """filecache for files in .hg/"""
59 """filecache for files in .hg/"""
@@ -488,9 +491,9 b' class dirstate(object):'
488 # being removed, restore that state.
491 # being removed, restore that state.
489 entry = self._map.get(f)
492 entry = self._map.get(f)
490 if entry is not None:
493 if entry is not None:
491 if entry[0] == b'r' and entry[2] in (-1, FROM_P2):
494 if entry[0] == b'r' and entry[2] in (NONNORMAL, FROM_P2):
492 source = self._map.copymap.get(f)
495 source = self._map.copymap.get(f)
493 if entry[2] == -1:
496 if entry[2] == NONNORMAL:
494 self.merge(f)
497 self.merge(f)
495 elif entry[2] == FROM_P2:
498 elif entry[2] == FROM_P2:
496 self.otherparent(f)
499 self.otherparent(f)
@@ -499,7 +502,7 b' class dirstate(object):'
499 return
502 return
500 if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2:
503 if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2:
501 return
504 return
502 self._addpath(f, b'n', 0, -1, -1)
505 self._addpath(f, b'n', 0, NONNORMAL, -1)
503 self._map.copymap.pop(f, None)
506 self._map.copymap.pop(f, None)
504
507
505 def otherparent(self, f):
508 def otherparent(self, f):
@@ -517,7 +520,7 b' class dirstate(object):'
517
520
518 def add(self, f):
521 def add(self, f):
519 '''Mark a file added.'''
522 '''Mark a file added.'''
520 self._addpath(f, b'a', 0, -1, -1)
523 self._addpath(f, b'a', 0, NONNORMAL, -1)
521 self._map.copymap.pop(f, None)
524 self._map.copymap.pop(f, None)
522
525
523 def remove(self, f):
526 def remove(self, f):
@@ -530,7 +533,7 b' class dirstate(object):'
530 if entry is not None:
533 if entry is not None:
531 # backup the previous state
534 # backup the previous state
532 if entry[0] == b'm': # merge
535 if entry[0] == b'm': # merge
533 size = -1
536 size = NONNORMAL
534 elif entry[0] == b'n' and entry[2] == FROM_P2: # other parent
537 elif entry[0] == b'n' and entry[2] == FROM_P2: # other parent
535 size = FROM_P2
538 size = FROM_P2
536 self._map.otherparentset.add(f)
539 self._map.otherparentset.add(f)
General Comments 0
You need to be logged in to leave comments. Login now