Mercurial > hg
changeset 10024:2b630e4c8f2f
log --follow: use a set instead of a list
benchmarked with hg log -qf on the linux kernel:
before:
Time: real 39.010 secs (user 38.840+0.000 sys 0.060+0.000)
after:
Time: real 8.560 secs (user 8.440+0.000 sys 0.080+0.000)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Thu, 10 Dec 2009 00:14:22 +0100 |
parents | 15fbbc939373 |
children | 0b0a46607ac9 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Dec 08 23:36:06 2009 +0100 +++ b/mercurial/cmdutil.py Thu Dec 10 00:14:22 2009 +0100 @@ -1169,7 +1169,7 @@ class followfilter(object): def __init__(self, onlyfirst=False): self.startrev = nullrev - self.roots = [] + self.roots = set() self.onlyfirst = onlyfirst def match(self, rev): @@ -1187,18 +1187,18 @@ if rev > self.startrev: # forward: all descendants if not self.roots: - self.roots.append(self.startrev) + self.roots.add(self.startrev) for parent in realparents(rev): if parent in self.roots: - self.roots.append(rev) + self.roots.add(rev) return True else: # backwards: all parents if not self.roots: - self.roots.extend(realparents(self.startrev)) + self.roots.update(realparents(self.startrev)) if rev in self.roots: self.roots.remove(rev) - self.roots.extend(realparents(rev)) + self.roots.update(realparents(rev)) return True return False