Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/changelog.py @ 26053:b68c9d232db6
reachableroots: use internal "revstates" array to test if rev is a root
The main goal of this patch series is to reduce the use of PyXxx() function
that is likely to require ugly error handling and inc/decref. Plus, this is
faster than using PySet_Contains().
revset #0: 0::tip
0) 0.004168
1) 0.003678 88%
This patch ignores out-of-range roots as they are in the pure implementation.
Because reachable sets are calculated from heads, and out-of-range heads raise
IndexError, we can just take out-of-range roots as unreachable. Otherwise,
the test of "hg log -Gr '. + wdir()'" would fail.
"heads" argument is changed to a list. Should we have to rename the C function
as its signature is changed?
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 14 Aug 2015 15:43:29 +0900 |
parents | ce77436162a5 |
children | be8a4e0800d8 |
comparison
equal
deleted
inserted
replaced
26052:b970418bbafe | 26053:b68c9d232db6 |
---|---|
185 self.rev(self.node(0)) | 185 self.rev(self.node(0)) |
186 return self._nodecache | 186 return self._nodecache |
187 | 187 |
188 def reachableroots(self, minroot, heads, roots, includepath=False): | 188 def reachableroots(self, minroot, heads, roots, includepath=False): |
189 return revset.baseset(sorted( | 189 return revset.baseset(sorted( |
190 self.index.reachableroots(minroot, heads, roots, includepath))) | 190 self.index.reachableroots2(minroot, heads, roots, includepath))) |
191 | 191 |
192 def headrevs(self): | 192 def headrevs(self): |
193 if self.filteredrevs: | 193 if self.filteredrevs: |
194 try: | 194 try: |
195 return self.index.headrevsfiltered(self.filteredrevs) | 195 return self.index.headrevsfiltered(self.filteredrevs) |