equal
deleted
inserted
replaced
53 vfs.unlink(tmpname) |
53 vfs.unlink(tmpname) |
54 |
54 |
55 def nonnormalentries(dmap): |
55 def nonnormalentries(dmap): |
56 '''Compute the nonnormal dirstate entries from the dmap''' |
56 '''Compute the nonnormal dirstate entries from the dmap''' |
57 try: |
57 try: |
58 return parsers.nonnormalentries(dmap) |
58 return parsers.nonnormalotherparententries(dmap) |
59 except AttributeError: |
59 except AttributeError: |
60 return set(fname for fname, e in dmap.iteritems() |
60 nonnorm = set() |
61 if e[0] != 'n' or e[3] == -1) |
61 otherparent = set() |
|
62 for fname, e in dmap.iteritems(): |
|
63 if e[0] != 'n' or e[3] == -1: |
|
64 nonnorm.add(fname) |
|
65 if e[0] == 'n' and e[2] == -2: |
|
66 otherparent.add(fname) |
|
67 return nonnorm, otherparent |
62 |
68 |
63 class dirstate(object): |
69 class dirstate(object): |
64 |
70 |
65 def __init__(self, opener, ui, root, validate): |
71 def __init__(self, opener, ui, root, validate): |
66 '''Create a new dirstate object. |
72 '''Create a new dirstate object. |
129 self._read() |
135 self._read() |
130 return self._copymap |
136 return self._copymap |
131 |
137 |
132 @propertycache |
138 @propertycache |
133 def _nonnormalset(self): |
139 def _nonnormalset(self): |
134 return nonnormalentries(self._map) |
140 nonnorm, otherparents = nonnormalentries(self._map) |
|
141 self._otherparentset = otherparents |
|
142 return nonnorm |
|
143 |
|
144 @propertycache |
|
145 def _otherparentset(self): |
|
146 nonnorm, otherparents = nonnormalentries(self._map) |
|
147 self._nonnormalset = nonnorm |
|
148 return otherparents |
135 |
149 |
136 @propertycache |
150 @propertycache |
137 def _filefoldmap(self): |
151 def _filefoldmap(self): |
138 try: |
152 try: |
139 makefilefoldmap = parsers.make_file_foldmap |
153 makefilefoldmap = parsers.make_file_foldmap |
339 if self._origpl is None: |
353 if self._origpl is None: |
340 self._origpl = self._pl |
354 self._origpl = self._pl |
341 self._pl = p1, p2 |
355 self._pl = p1, p2 |
342 copies = {} |
356 copies = {} |
343 if oldp2 != nullid and p2 == nullid: |
357 if oldp2 != nullid and p2 == nullid: |
344 for f, s in self._map.iteritems(): |
358 candidatefiles = self._nonnormalset.union(self._otherparentset) |
|
359 for f in candidatefiles: |
|
360 s = self._map.get(f) |
|
361 if s is None: |
|
362 continue |
|
363 |
345 # Discard 'm' markers when moving away from a merge state |
364 # Discard 'm' markers when moving away from a merge state |
346 if s[0] == 'm': |
365 if s[0] == 'm': |
347 if f in self._copymap: |
366 if f in self._copymap: |
348 copies[f] = self._copymap[f] |
367 copies[f] = self._copymap[f] |
349 self.normallookup(f) |
368 self.normallookup(f) |
425 if not self._dirtypl: |
444 if not self._dirtypl: |
426 self._pl = p |
445 self._pl = p |
427 |
446 |
428 def invalidate(self): |
447 def invalidate(self): |
429 for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch", |
448 for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch", |
430 "_pl", "_dirs", "_ignore", "_nonnormalset"): |
449 "_pl", "_dirs", "_ignore", "_nonnormalset", |
|
450 "_otherparentset"): |
431 if a in self.__dict__: |
451 if a in self.__dict__: |
432 delattr(self, a) |
452 delattr(self, a) |
433 self._lastnormaltime = 0 |
453 self._lastnormaltime = 0 |
434 self._dirty = False |
454 self._dirty = False |
435 self._updatedfiles.clear() |
455 self._updatedfiles.clear() |
484 self._dirty = True |
504 self._dirty = True |
485 self._updatedfiles.add(f) |
505 self._updatedfiles.add(f) |
486 self._map[f] = dirstatetuple(state, mode, size, mtime) |
506 self._map[f] = dirstatetuple(state, mode, size, mtime) |
487 if state != 'n' or mtime == -1: |
507 if state != 'n' or mtime == -1: |
488 self._nonnormalset.add(f) |
508 self._nonnormalset.add(f) |
|
509 if size == -2: |
|
510 self._otherparentset.add(f) |
489 |
511 |
490 def normal(self, f): |
512 def normal(self, f): |
491 '''Mark a file normal and clean.''' |
513 '''Mark a file normal and clean.''' |
492 s = os.lstat(self._join(f)) |
514 s = os.lstat(self._join(f)) |
493 mtime = s.st_mtime |
515 mtime = s.st_mtime |
558 entry = self._map[f] |
580 entry = self._map[f] |
559 if entry[0] == 'm': # merge |
581 if entry[0] == 'm': # merge |
560 size = -1 |
582 size = -1 |
561 elif entry[0] == 'n' and entry[2] == -2: # other parent |
583 elif entry[0] == 'n' and entry[2] == -2: # other parent |
562 size = -2 |
584 size = -2 |
|
585 self._otherparentset.add(f) |
563 self._map[f] = dirstatetuple('r', 0, size, 0) |
586 self._map[f] = dirstatetuple('r', 0, size, 0) |
564 self._nonnormalset.add(f) |
587 self._nonnormalset.add(f) |
565 if size == 0 and f in self._copymap: |
588 if size == 0 and f in self._copymap: |
566 del self._copymap[f] |
589 del self._copymap[f] |
567 |
590 |
657 return path |
680 return path |
658 |
681 |
659 def clear(self): |
682 def clear(self): |
660 self._map = {} |
683 self._map = {} |
661 self._nonnormalset = set() |
684 self._nonnormalset = set() |
|
685 self._otherparentset = set() |
662 if "_dirs" in self.__dict__: |
686 if "_dirs" in self.__dict__: |
663 delattr(self, "_dirs") |
687 delattr(self, "_dirs") |
664 self._copymap = {} |
688 self._copymap = {} |
665 self._pl = [nullid, nullid] |
689 self._pl = [nullid, nullid] |
666 self._lastnormaltime = 0 |
690 self._lastnormaltime = 0 |
756 time.sleep(end - clock) |
780 time.sleep(end - clock) |
757 now = end # trust our estimate that the end is near now |
781 now = end # trust our estimate that the end is near now |
758 break |
782 break |
759 |
783 |
760 st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now)) |
784 st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now)) |
761 self._nonnormalset = nonnormalentries(self._map) |
785 self._nonnormalset, self._otherparentset = nonnormalentries(self._map) |
762 st.close() |
786 st.close() |
763 self._lastnormaltime = 0 |
787 self._lastnormaltime = 0 |
764 self._dirty = self._dirtypl = False |
788 self._dirty = self._dirtypl = False |
765 |
789 |
766 def _dirignore(self, f): |
790 def _dirignore(self, f): |