Mercurial > hg-stable
changeset 4559:eda59019dc69
localrepo: demand-load changeset, manifest, and dirstate
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 13 Jun 2007 13:15:51 -0500 |
parents | 9338be783398 |
children | 3daed3680554 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Jun 12 10:34:54 2007 -0500 +++ b/mercurial/localrepo.py Wed Jun 13 13:15:51 2007 -0500 @@ -79,10 +79,6 @@ except IOError: pass - self.changelog = changelog.changelog(self.sopener) - self.sopener.defversion = self.changelog.version - self.manifest = manifest.manifest(self.sopener) - fallback = self.ui.config('ui', 'fallbackencoding') if fallback: util._fallbackencoding = fallback @@ -93,7 +89,20 @@ self.filterpats = {} self.transhandle = None - self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) + def __getattr__(self, name): + if name == 'changelog': + self.changelog = changelog.changelog(self.sopener) + self.sopener.defversion = self.changelog.version + return self.changelog + if name == 'manifest': + self.changelog + self.manifest = manifest.manifest(self.sopener) + return self.manifest + if name == 'dirstate': + self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) + return self.dirstate + else: + raise AttributeError, name def url(self): return 'file:' + self.root