##// END OF EJS Templates
dirstate: move _copymap to dirstatemap...
Durham Goode -
r34337:0865d25e default
parent child Browse files
Show More
@@ -137,11 +137,6 b' class dirstate(object):'
137 137 return self._map
138 138
139 139 @propertycache
140 def _copymap(self):
141 self._read()
142 return self._copymap
143
144 @propertycache
145 140 def _identity(self):
146 141 self._read()
147 142 return self._identity
@@ -378,13 +373,13 b' class dirstate(object):'
378 373
379 374 # Discard 'm' markers when moving away from a merge state
380 375 if s[0] == 'm':
381 source = self._copymap.get(f)
376 source = self._map.copymap.get(f)
382 377 if source:
383 378 copies[f] = source
384 379 self.normallookup(f)
385 380 # Also fix up otherparent markers
386 381 elif s[0] == 'n' and s[2] == -2:
387 source = self._copymap.get(f)
382 source = self._map.copymap.get(f)
388 383 if source:
389 384 copies[f] = source
390 385 self.add(f)
@@ -418,7 +413,6 b' class dirstate(object):'
418 413 def _read(self):
419 414 self._map = dirstatemap()
420 415
421 self._copymap = {}
422 416 # ignore HG_PENDING because identity is used only for writing
423 417 self._identity = util.filestat.frompath(
424 418 self._opener.join(self._filename))
@@ -461,7 +455,7 b' class dirstate(object):'
461 455 #
462 456 # (we cannot decorate the function directly since it is in a C module)
463 457 parse_dirstate = util.nogc(parsers.parse_dirstate)
464 p = parse_dirstate(self._map._map, self._copymap, st)
458 p = parse_dirstate(self._map._map, self._map.copymap, st)
465 459 if not self._dirtypl:
466 460 self._pl = p
467 461
@@ -472,7 +466,7 b' class dirstate(object):'
472 466 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
473 467 check whether the dirstate has changed before rereading it.'''
474 468
475 for a in ("_map", "_copymap", "_identity",
469 for a in ("_map", "_identity",
476 470 "_filefoldmap", "_dirfoldmap", "_branch",
477 471 "_pl", "_dirs", "_ignore", "_nonnormalset",
478 472 "_otherparentset"):
@@ -490,17 +484,17 b' class dirstate(object):'
490 484 return
491 485 self._dirty = True
492 486 if source is not None:
493 self._copymap[dest] = source
487 self._map.copymap[dest] = source
494 488 self._updatedfiles.add(source)
495 489 self._updatedfiles.add(dest)
496 elif self._copymap.pop(dest, None):
490 elif self._map.copymap.pop(dest, None):
497 491 self._updatedfiles.add(dest)
498 492
499 493 def copied(self, file):
500 return self._copymap.get(file, None)
494 return self._map.copymap.get(file, None)
501 495
502 496 def copies(self):
503 return self._copymap
497 return self._map.copymap
504 498
505 499 def _droppath(self, f):
506 500 if self[f] not in "?r" and "_dirs" in self.__dict__:
@@ -543,7 +537,7 b' class dirstate(object):'
543 537 mtime = s.st_mtime
544 538 self._addpath(f, 'n', s.st_mode,
545 539 s.st_size & _rangemask, mtime & _rangemask)
546 self._copymap.pop(f, None)
540 self._map.copymap.pop(f, None)
547 541 if f in self._nonnormalset:
548 542 self._nonnormalset.remove(f)
549 543 if mtime > self._lastnormaltime:
@@ -561,7 +555,7 b' class dirstate(object):'
561 555 entry = self._map.get(f)
562 556 if entry is not None:
563 557 if entry[0] == 'r' and entry[2] in (-1, -2):
564 source = self._copymap.get(f)
558 source = self._map.copymap.get(f)
565 559 if entry[2] == -1:
566 560 self.merge(f)
567 561 elif entry[2] == -2:
@@ -572,7 +566,7 b' class dirstate(object):'
572 566 if entry[0] == 'm' or entry[0] == 'n' and entry[2] == -2:
573 567 return
574 568 self._addpath(f, 'n', 0, -1, -1)
575 self._copymap.pop(f, None)
569 self._map.copymap.pop(f, None)
576 570 if f in self._nonnormalset:
577 571 self._nonnormalset.remove(f)
578 572
@@ -587,12 +581,12 b' class dirstate(object):'
587 581 else:
588 582 # add-like
589 583 self._addpath(f, 'n', 0, -2, -1)
590 self._copymap.pop(f, None)
584 self._map.copymap.pop(f, None)
591 585
592 586 def add(self, f):
593 587 '''Mark a file added.'''
594 588 self._addpath(f, 'a', 0, -1, -1)
595 self._copymap.pop(f, None)
589 self._map.copymap.pop(f, None)
596 590
597 591 def remove(self, f):
598 592 '''Mark a file removed.'''
@@ -611,7 +605,7 b' class dirstate(object):'
611 605 self._map[f] = dirstatetuple('r', 0, size, 0)
612 606 self._nonnormalset.add(f)
613 607 if size == 0:
614 self._copymap.pop(f, None)
608 self._map.copymap.pop(f, None)
615 609
616 610 def merge(self, f):
617 611 '''Mark a file merged.'''
@@ -627,7 +621,7 b' class dirstate(object):'
627 621 del self._map[f]
628 622 if f in self._nonnormalset:
629 623 self._nonnormalset.remove(f)
630 self._copymap.pop(f, None)
624 self._map.copymap.pop(f, None)
631 625
632 626 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
633 627 if exists is None:
@@ -709,7 +703,6 b' class dirstate(object):'
709 703 self._otherparentset = set()
710 704 if "_dirs" in self.__dict__:
711 705 delattr(self, "_dirs")
712 self._copymap = {}
713 706 self._pl = [nullid, nullid]
714 707 self._lastnormaltime = 0
715 708 self._updatedfiles.clear()
@@ -813,8 +806,8 b' class dirstate(object):'
813 806 now = end # trust our estimate that the end is near now
814 807 break
815 808
816 st.write(parsers.pack_dirstate(self._map._map, self._copymap, self._pl,
817 now))
809 st.write(parsers.pack_dirstate(self._map._map, self._map.copymap,
810 self._pl, now))
818 811 self._nonnormalset, self._otherparentset = self._map.nonnormalentries()
819 812 st.close()
820 813 self._lastnormaltime = 0
@@ -1188,7 +1181,7 b' class dirstate(object):'
1188 1181 mexact = match.exact
1189 1182 dirignore = self._dirignore
1190 1183 checkexec = self._checkexec
1191 copymap = self._copymap
1184 copymap = self._map.copymap
1192 1185 lastnormaltime = self._lastnormaltime
1193 1186
1194 1187 # We need to do full walks when either
@@ -1317,6 +1310,7 b' class dirstate(object):'
1317 1310 class dirstatemap(object):
1318 1311 def __init__(self):
1319 1312 self._map = {}
1313 self.copymap = {}
1320 1314
1321 1315 def iteritems(self):
1322 1316 return self._map.iteritems()
General Comments 0
You need to be logged in to leave comments. Login now