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