Mercurial > public > mercurial-scm > hg-stable
diff mercurial/store.py @ 10577:d5bd1beff794 stable
store: only add new entries to the fncache file
Newly added fncache entries were not added to the in-memory cache,
making it possible for 'hg convert' to cause duplicates in
.hg/store/fncache.
Duplicates in the fncache file are harmless, but excessive numbers
of duplicates from large converted repositories may slow down
execution speed considerably.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 03 Mar 2010 14:50:35 +0100 |
parents | 23e608f42f2c |
children | ba9957bcfb7c |
line wrap: on
line diff
--- a/mercurial/store.py Wed Mar 03 16:00:02 2010 +0100 +++ b/mercurial/store.py Wed Mar 03 14:50:35 2010 +0100 @@ -267,7 +267,9 @@ def add(self, fn): if self.entries is None: self._load() - self.opener('fncache', 'ab').write(encodedir(fn) + '\n') + if fn not in self.entries: + self.opener('fncache', 'ab').write(encodedir(fn) + '\n') + self.entries.add(fn) def __contains__(self, fn): if self.entries is None: @@ -290,9 +292,7 @@ self.fncache = fnc def fncacheopener(path, mode='r', *args, **kw): - if (mode not in ('r', 'rb') - and path.startswith('data/') - and path not in fnc): + if mode not in ('r', 'rb') and path.startswith('data/'): fnc.add(path) return op(hybridencode(path), mode, *args, **kw) self.opener = fncacheopener