Show More
@@ -22,6 +22,7 from . import ( | |||
|
22 | 22 | error, |
|
23 | 23 | pycompat, |
|
24 | 24 | revlog, |
|
25 | util, | |
|
25 | 26 | ) |
|
26 | 27 | from .utils import ( |
|
27 | 28 | dateutil, |
@@ -350,6 +351,27 class changelog(revlog.revlog): | |||
|
350 | 351 | def reachableroots(self, minroot, heads, roots, includepath=False): |
|
351 | 352 | return self.index.reachableroots2(minroot, heads, roots, includepath) |
|
352 | 353 | |
|
354 | def _checknofilteredinrevs(self, revs): | |
|
355 | """raise the appropriate error if 'revs' contains a filtered revision | |
|
356 | ||
|
357 | This returns a version of 'revs' to be used thereafter by the caller. | |
|
358 | In particular, if revs is an iterator, it is converted into a set. | |
|
359 | """ | |
|
360 | safehasattr = util.safehasattr | |
|
361 | if safehasattr(revs, '__next__'): | |
|
362 | # Note that inspect.isgenerator() is not true for iterators, | |
|
363 | revs = set(revs) | |
|
364 | ||
|
365 | filteredrevs = self.filteredrevs | |
|
366 | if safehasattr(revs, 'first'): # smartset | |
|
367 | offenders = revs & filteredrevs | |
|
368 | else: | |
|
369 | offenders = filteredrevs.intersection(revs) | |
|
370 | ||
|
371 | for rev in offenders: | |
|
372 | raise error.FilteredIndexError(rev) | |
|
373 | return revs | |
|
374 | ||
|
353 | 375 | def headrevs(self, revs=None): |
|
354 | 376 | if revs is None and self.filteredrevs: |
|
355 | 377 | try: |
@@ -359,6 +381,8 class changelog(revlog.revlog): | |||
|
359 | 381 | except AttributeError: |
|
360 | 382 | return self._headrevs() |
|
361 | 383 | |
|
384 | if self.filteredrevs: | |
|
385 | revs = self._checknofilteredinrevs(revs) | |
|
362 | 386 | return super(changelog, self).headrevs(revs) |
|
363 | 387 | |
|
364 | 388 | def strip(self, *args, **kwargs): |
@@ -1121,7 +1121,7 class revlog(object): | |||
|
1121 | 1121 | return self.index.headrevs() |
|
1122 | 1122 | except AttributeError: |
|
1123 | 1123 | return self._headrevs() |
|
1124 | return dagop.headrevs(revs, self.parentrevs) | |
|
1124 | return dagop.headrevs(revs, self._uncheckedparentrevs) | |
|
1125 | 1125 | |
|
1126 | 1126 | def computephases(self, roots): |
|
1127 | 1127 | return self.index.computephasesmapsets(roots) |
General Comments 0
You need to be logged in to leave comments.
Login now