comparison mercurial/manifest.py @ 26401:e93e12e2ff9a

manifest: rename treemanifest load functions to ease debugging I'm hunting an infinite recursion bug at the moment, and having both of these methods named just _load is muddying the waters slightly.
author Augie Fackler <augie@google.com>
date Fri, 25 Sep 2015 17:18:28 -0400
parents 6f9d9e2a661f
children 05871262acd5
comparison
equal deleted inserted replaced
26400:6f9d9e2a661f 26401:e93e12e2ff9a
613 613
614 def copy(self): 614 def copy(self):
615 copy = treemanifest(self._dir) 615 copy = treemanifest(self._dir)
616 copy._node = self._node 616 copy._node = self._node
617 copy._dirty = self._dirty 617 copy._dirty = self._dirty
618 def _load(): 618 def _load_for_copy():
619 self._load() 619 self._load()
620 for d in self._dirs: 620 for d in self._dirs:
621 copy._dirs[d] = self._dirs[d].copy() 621 copy._dirs[d] = self._dirs[d].copy()
622 copy._files = dict.copy(self._files) 622 copy._files = dict.copy(self._files)
623 copy._flags = dict.copy(self._flags) 623 copy._flags = dict.copy(self._flags)
624 copy._load = _noop 624 copy._load = _noop
625 copy._load = _load 625 copy._load = _load_for_copy
626 if self._load == _noop: 626 if self._load == _noop:
627 # Chaining _load if it's _noop is functionally correct, but the 627 # Chaining _load if it's _noop is functionally correct, but the
628 # chain may end up excessively long (stack overflow), and 628 # chain may end up excessively long (stack overflow), and
629 # will prevent garbage collection of 'self'. 629 # will prevent garbage collection of 'self'.
630 copy._load() 630 copy._load()
832 dirs = [(d[:-1], self._dirs[d]._node, 'd') for d in self._dirs] 832 dirs = [(d[:-1], self._dirs[d]._node, 'd') for d in self._dirs]
833 files = [(f, self._files[f], flags(f)) for f in self._files] 833 files = [(f, self._files[f], flags(f)) for f in self._files]
834 return _text(sorted(dirs + files), usemanifestv2) 834 return _text(sorted(dirs + files), usemanifestv2)
835 835
836 def read(self, gettext, readsubtree): 836 def read(self, gettext, readsubtree):
837 def _load(): 837 def _load_for_read():
838 # Mark as loaded already here, so __setitem__ and setflag() don't 838 # Mark as loaded already here, so __setitem__ and setflag() don't
839 # cause infinite loops when they try to load. 839 # cause infinite loops when they try to load.
840 self._load = _noop 840 self._load = _noop
841 self.parse(gettext(), readsubtree) 841 self.parse(gettext(), readsubtree)
842 self._dirty = False 842 self._dirty = False
843 self._load = _load 843 self._load = _load_for_read
844 844
845 def writesubtrees(self, m1, m2, writesubtree): 845 def writesubtrees(self, m1, m2, writesubtree):
846 self._load() # for consistency; should never have any effect here 846 self._load() # for consistency; should never have any effect here
847 emptytree = treemanifest() 847 emptytree = treemanifest()
848 for d, subm in self._dirs.iteritems(): 848 for d, subm in self._dirs.iteritems():