##// END OF EJS Templates
dirstate: move nonnormal and otherparent sets to dirstatemap...
Durham Goode -
r34675:60927b19 default
parent child Browse files
Show More
@@ -32,9 +32,10 b' def checkconsistency(ui, orig, dmap, _no'
32
32
33 def _checkdirstate(orig, self, arg):
33 def _checkdirstate(orig, self, arg):
34 """Check nonnormal set consistency before and after the call to orig"""
34 """Check nonnormal set consistency before and after the call to orig"""
35 checkconsistency(self._ui, orig, self._map, self._nonnormalset, "before")
35 checkconsistency(self._ui, orig, self._map, self._map.nonnormalset,
36 "before")
36 r = orig(self, arg)
37 r = orig(self, arg)
37 checkconsistency(self._ui, orig, self._map, self._nonnormalset, "after")
38 checkconsistency(self._ui, orig, self._map, self._map.nonnormalset, "after")
38 return r
39 return r
39
40
40 def extsetup(ui):
41 def extsetup(ui):
@@ -138,18 +138,6 b' class dirstate(object):'
138 return self._identity
138 return self._identity
139
139
140 @propertycache
140 @propertycache
141 def _nonnormalset(self):
142 nonnorm, otherparents = self._map.nonnormalentries()
143 self._otherparentset = otherparents
144 return nonnorm
145
146 @propertycache
147 def _otherparentset(self):
148 nonnorm, otherparents = self._map.nonnormalentries()
149 self._nonnormalset = nonnorm
150 return otherparents
151
152 @propertycache
153 def _filefoldmap(self):
141 def _filefoldmap(self):
154 return self._map.filefoldmap()
142 return self._map.filefoldmap()
155
143
@@ -349,7 +337,8 b' class dirstate(object):'
349 self._map.setparents(p1, p2)
337 self._map.setparents(p1, p2)
350 copies = {}
338 copies = {}
351 if oldp2 != nullid and p2 == nullid:
339 if oldp2 != nullid and p2 == nullid:
352 candidatefiles = self._nonnormalset.union(self._otherparentset)
340 candidatefiles = self._map.nonnormalset.union(
341 self._map.otherparentset)
353 for f in candidatefiles:
342 for f in candidatefiles:
354 s = self._map.get(f)
343 s = self._map.get(f)
355 if s is None:
344 if s is None:
@@ -401,8 +390,7 b' class dirstate(object):'
401
390
402 for a in ("_map", "_identity",
391 for a in ("_map", "_identity",
403 "_filefoldmap", "_dirfoldmap", "_branch",
392 "_filefoldmap", "_dirfoldmap", "_branch",
404 "_dirs", "_ignore", "_nonnormalset",
393 "_dirs", "_ignore"):
405 "_otherparentset"):
406 if a in self.__dict__:
394 if a in self.__dict__:
407 delattr(self, a)
395 delattr(self, a)
408 self._lastnormaltime = 0
396 self._lastnormaltime = 0
@@ -460,9 +448,9 b' class dirstate(object):'
460 self._updatedfiles.add(f)
448 self._updatedfiles.add(f)
461 self._map[f] = dirstatetuple(state, mode, size, mtime)
449 self._map[f] = dirstatetuple(state, mode, size, mtime)
462 if state != 'n' or mtime == -1:
450 if state != 'n' or mtime == -1:
463 self._nonnormalset.add(f)
451 self._map.nonnormalset.add(f)
464 if size == -2:
452 if size == -2:
465 self._otherparentset.add(f)
453 self._map.otherparentset.add(f)
466
454
467 def normal(self, f):
455 def normal(self, f):
468 '''Mark a file normal and clean.'''
456 '''Mark a file normal and clean.'''
@@ -471,8 +459,8 b' class dirstate(object):'
471 self._addpath(f, 'n', s.st_mode,
459 self._addpath(f, 'n', s.st_mode,
472 s.st_size & _rangemask, mtime & _rangemask)
460 s.st_size & _rangemask, mtime & _rangemask)
473 self._map.copymap.pop(f, None)
461 self._map.copymap.pop(f, None)
474 if f in self._nonnormalset:
462 if f in self._map.nonnormalset:
475 self._nonnormalset.remove(f)
463 self._map.nonnormalset.remove(f)
476 if mtime > self._lastnormaltime:
464 if mtime > self._lastnormaltime:
477 # Remember the most recent modification timeslot for status(),
465 # Remember the most recent modification timeslot for status(),
478 # to make sure we won't miss future size-preserving file content
466 # to make sure we won't miss future size-preserving file content
@@ -500,8 +488,8 b' class dirstate(object):'
500 return
488 return
501 self._addpath(f, 'n', 0, -1, -1)
489 self._addpath(f, 'n', 0, -1, -1)
502 self._map.copymap.pop(f, None)
490 self._map.copymap.pop(f, None)
503 if f in self._nonnormalset:
491 if f in self._map.nonnormalset:
504 self._nonnormalset.remove(f)
492 self._map.nonnormalset.remove(f)
505
493
506 def otherparent(self, f):
494 def otherparent(self, f):
507 '''Mark as coming from the other parent, always dirty.'''
495 '''Mark as coming from the other parent, always dirty.'''
@@ -534,9 +522,9 b' class dirstate(object):'
534 size = -1
522 size = -1
535 elif entry[0] == 'n' and entry[2] == -2: # other parent
523 elif entry[0] == 'n' and entry[2] == -2: # other parent
536 size = -2
524 size = -2
537 self._otherparentset.add(f)
525 self._map.otherparentset.add(f)
538 self._map[f] = dirstatetuple('r', 0, size, 0)
526 self._map[f] = dirstatetuple('r', 0, size, 0)
539 self._nonnormalset.add(f)
527 self._map.nonnormalset.add(f)
540 if size == 0:
528 if size == 0:
541 self._map.copymap.pop(f, None)
529 self._map.copymap.pop(f, None)
542
530
@@ -552,8 +540,8 b' class dirstate(object):'
552 self._dirty = True
540 self._dirty = True
553 self._droppath(f)
541 self._droppath(f)
554 del self._map[f]
542 del self._map[f]
555 if f in self._nonnormalset:
543 if f in self._map.nonnormalset:
556 self._nonnormalset.remove(f)
544 self._map.nonnormalset.remove(f)
557 self._map.copymap.pop(f, None)
545 self._map.copymap.pop(f, None)
558
546
559 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
547 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
@@ -632,8 +620,6 b' class dirstate(object):'
632
620
633 def clear(self):
621 def clear(self):
634 self._map = dirstatemap(self._ui, self._opener, self._root)
622 self._map = dirstatemap(self._ui, self._opener, self._root)
635 self._nonnormalset = set()
636 self._otherparentset = set()
637 if "_dirs" in self.__dict__:
623 if "_dirs" in self.__dict__:
638 delattr(self, "_dirs")
624 delattr(self, "_dirs")
639 self._map.setparents(nullid, nullid)
625 self._map.setparents(nullid, nullid)
@@ -687,7 +673,7 b' class dirstate(object):'
687 e = dmap.get(f)
673 e = dmap.get(f)
688 if e is not None and e[0] == 'n' and e[3] == now:
674 if e is not None and e[0] == 'n' and e[3] == now:
689 dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
675 dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
690 self._nonnormalset.add(f)
676 self._map.nonnormalset.add(f)
691
677
692 # emulate that all 'dirstate.normal' results are written out
678 # emulate that all 'dirstate.normal' results are written out
693 self._lastnormaltime = 0
679 self._lastnormaltime = 0
@@ -740,7 +726,6 b' class dirstate(object):'
740 break
726 break
741
727
742 self._map.write(st, now)
728 self._map.write(st, now)
743 self._nonnormalset, self._otherparentset = self._map.nonnormalentries()
744 self._lastnormaltime = 0
729 self._lastnormaltime = 0
745 self._dirty = False
730 self._dirty = False
746
731
@@ -1405,3 +1390,17 b' class dirstatemap(object):'
1405 self.parents(), now))
1390 self.parents(), now))
1406 st.close()
1391 st.close()
1407 self._dirtyparents = False
1392 self._dirtyparents = False
1393 self.nonnormalset, self.otherparentset = self.nonnormalentries()
1394
1395 @propertycache
1396 def nonnormalset(self):
1397 nonnorm, otherparents = self.nonnormalentries()
1398 self.otherparentset = otherparents
1399 return nonnorm
1400
1401 @propertycache
1402 def otherparentset(self):
1403 nonnorm, otherparents = self.nonnormalentries()
1404 self.nonnormalset = nonnorm
1405 return otherparents
1406
General Comments 0
You need to be logged in to leave comments. Login now