Mercurial > hg > mercurial-source
comparison mercurial/changelog.py @ 22484:2b5940f64750
obsolete: use C code for headrevs calculation
Previously, if there were filtered revs the repository could not use the C fast
path for computing the head revs in the changelog. This slowed down many
operations in large repositories.
This adds the ability to filter revs to the C fast path. This speeds up histedit
on repositories with filtered revs by 30% (13s to 9s). This could be improved
further by sorting the filtered revs and walking the sorted list while we walk
the changelog, but even this initial version that just calls __contains__ is
still massively faster.
The new C api is compatible for both new and old python clients, and the new
python client can call both new and old C apis.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 16 Sep 2014 16:03:21 -0700 |
parents | 667df8f478d1 |
children | f00813325c5a |
comparison
equal
deleted
inserted
replaced
22483:a21d04848359 | 22484:2b5940f64750 |
---|---|
169 except KeyError: | 169 except KeyError: |
170 return False | 170 return False |
171 | 171 |
172 def headrevs(self): | 172 def headrevs(self): |
173 if self.filteredrevs: | 173 if self.filteredrevs: |
174 # XXX we should fix and use the C version | 174 try: |
175 return self._headrevs() | 175 return self.index.headrevs(self.filteredrevs) |
176 # AttributeError covers non-c-extension environments. | |
177 # TypeError allows us work with old c extensions. | |
178 except (AttributeError, TypeError): | |
179 return self._headrevs() | |
180 | |
176 return super(changelog, self).headrevs() | 181 return super(changelog, self).headrevs() |
177 | 182 |
178 def strip(self, *args, **kwargs): | 183 def strip(self, *args, **kwargs): |
179 # XXX make something better than assert | 184 # XXX make something better than assert |
180 # We can't expect proper strip behavior if we are filtered. | 185 # We can't expect proper strip behavior if we are filtered. |