Mercurial > hg-stable
changeset 4613:3a645af7fb76
localrepo and dirstate: rename reload to invalidate
We want to avoid actually reloading if possible.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 18 Jun 2007 13:24:34 -0500 |
parents | 17ee7407097f |
children | a8be3c875988 |
files | hgext/mq.py mercurial/dirstate.py mercurial/localrepo.py |
diffstat | 3 files changed, 15 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Mon Jun 18 13:24:34 2007 -0500 +++ b/hgext/mq.py Mon Jun 18 13:24:34 2007 -0500 @@ -453,8 +453,8 @@ try: tr.abort() finally: - repo.reload() - repo.wreload() + repo.invalidate() + repo.dirstate.invalidate() raise def _apply(self, tr, repo, series, list=False, update_status=True,
--- a/mercurial/dirstate.py Mon Jun 18 13:24:34 2007 -0500 +++ b/mercurial/dirstate.py Mon Jun 18 13:24:34 2007 -0500 @@ -149,7 +149,7 @@ dmap[f] = e[:4] pos = newpos - def reload(self): + def invalidate(self): for a in "map copymap _branch pl dirs _ignore".split(): if hasattr(self, a): self.__delattr__(a) @@ -228,7 +228,7 @@ pass def rebuild(self, parent, files): - self.reload() + self.invalidate() for f in files: if files.execf(f): self.map[f] = ('n', 0777, -1, 0)
--- a/mercurial/localrepo.py Mon Jun 18 13:24:34 2007 -0500 +++ b/mercurial/localrepo.py Mon Jun 18 13:24:34 2007 -0500 @@ -586,7 +586,7 @@ if os.path.exists(self.sjoin("journal")): self.ui.status(_("rolling back interrupted transaction\n")) transaction.rollback(self.sopener, self.sjoin("journal")) - self.reload() + self.invalidate() return True else: self.ui.warn(_("no interrupted transaction available\n")) @@ -601,17 +601,15 @@ self.ui.status(_("rolling back last transaction\n")) transaction.rollback(self.sopener, self.sjoin("undo")) util.rename(self.join("undo.dirstate"), self.join("dirstate")) - self.reload() - self.wreload() + self.invalidate() + self.dirstate.invalidate() else: self.ui.warn(_("no rollback information available\n")) - def wreload(self): - self.dirstate.reload() - - def reload(self): - self.changelog.load() - self.manifest.load() + def invalidate(self): + for a in "changelog manifest".split(): + if hasattr(self, a): + self.__delattr__(a) self.tagscache = None self.nodetagscache = None @@ -632,12 +630,13 @@ return l def lock(self, wait=1): - return self.do_lock(self.sjoin("lock"), wait, acquirefn=self.reload, + return self.do_lock(self.sjoin("lock"), wait, + acquirefn=self.invalidate, desc=_('repository %s') % self.origroot) def wlock(self, wait=1): return self.do_lock(self.join("wlock"), wait, self.dirstate.write, - self.wreload, + self.dirstate.invalidate, desc=_('working directory of %s') % self.origroot) def filecommit(self, fn, manifest1, manifest2, linkrev, transaction, changelist): @@ -1932,7 +1931,7 @@ self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % (util.bytecount(total_bytes), elapsed, util.bytecount(total_bytes / elapsed))) - self.reload() + self.invalidate() return len(self.heads()) + 1 def clone(self, remote, heads=[], stream=False):