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