##// END OF EJS Templates
dirstate: introduce a symbolic constant for the AMBIGUOUS_TIME marker...
marmoute -
r48278:3f13dfa1 default
parent child Browse files
Show More
@@ -54,6 +54,9 b' FROM_P2 = -2'
54 54 # a special value used internally for `size` if the file is modified/merged/added
55 55 NONNORMAL = -1
56 56
57 # a special value used internally for `time` if the time is ambigeous
58 AMBIGUOUS_TIME = -1
59
57 60
58 61 class repocache(filecache):
59 62 """filecache for files in .hg/"""
@@ -502,7 +505,7 b' class dirstate(object):'
502 505 return
503 506 if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2:
504 507 return
505 self._addpath(f, b'n', 0, NONNORMAL, -1)
508 self._addpath(f, b'n', 0, NONNORMAL, AMBIGUOUS_TIME)
506 509 self._map.copymap.pop(f, None)
507 510
508 511 def otherparent(self, f):
@@ -512,15 +515,15 b' class dirstate(object):'
512 515 raise error.Abort(msg)
513 516 if f in self and self[f] == b'n':
514 517 # merge-like
515 self._addpath(f, b'm', 0, FROM_P2, -1)
518 self._addpath(f, b'm', 0, FROM_P2, AMBIGUOUS_TIME)
516 519 else:
517 520 # add-like
518 self._addpath(f, b'n', 0, FROM_P2, -1)
521 self._addpath(f, b'n', 0, FROM_P2, AMBIGUOUS_TIME)
519 522 self._map.copymap.pop(f, None)
520 523
521 524 def add(self, f):
522 525 '''Mark a file added.'''
523 self._addpath(f, b'a', 0, NONNORMAL, -1)
526 self._addpath(f, b'a', 0, NONNORMAL, AMBIGUOUS_TIME)
524 527 self._map.copymap.pop(f, None)
525 528
526 529 def remove(self, f):
@@ -1537,7 +1540,7 b' class dirstatemap(object):'
1537 1540 if oldstate == b"?" and "_alldirs" in self.__dict__:
1538 1541 self._alldirs.addpath(f)
1539 1542 self._map[f] = dirstatetuple(state, mode, size, mtime)
1540 if state != b'n' or mtime == -1:
1543 if state != b'n' or mtime == AMBIGUOUS_TIME:
1541 1544 self.nonnormalset.add(f)
1542 1545 if size == FROM_P2:
1543 1546 self.otherparentset.add(f)
@@ -1581,7 +1584,7 b' class dirstatemap(object):'
1581 1584 for f in files:
1582 1585 e = self.get(f)
1583 1586 if e is not None and e[0] == b'n' and e[3] == now:
1584 self._map[f] = dirstatetuple(e[0], e[1], e[2], -1)
1587 self._map[f] = dirstatetuple(e[0], e[1], e[2], AMBIGUOUS_TIME)
1585 1588 self.nonnormalset.add(f)
1586 1589
1587 1590 def nonnormalentries(self):
@@ -1592,7 +1595,7 b' class dirstatemap(object):'
1592 1595 nonnorm = set()
1593 1596 otherparent = set()
1594 1597 for fname, e in pycompat.iteritems(self._map):
1595 if e[0] != b'n' or e[3] == -1:
1598 if e[0] != b'n' or e[3] == AMBIGUOUS_TIME:
1596 1599 nonnorm.add(fname)
1597 1600 if e[0] == b'n' and e[2] == FROM_P2:
1598 1601 otherparent.add(fname)
General Comments 0
You need to be logged in to leave comments. Login now