Mercurial > hg
comparison mercurial/cmdutil.py @ 45479:3dc848d5ec77
cmdutil: make walkchangerevs() gracefully handle wdir parents
This code will be completely rewritten, but test-grep.t would fail without
fixing it.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 11 Sep 2020 18:33:41 +0900 |
parents | d2b5a7659fff |
children | 8ceb5b4b2728 |
comparison
equal
deleted
inserted
replaced
45478:07c424a13811 | 45479:3dc848d5ec77 |
---|---|
2384 self.roots = set() | 2384 self.roots = set() |
2385 self.onlyfirst = onlyfirst | 2385 self.onlyfirst = onlyfirst |
2386 | 2386 |
2387 def match(self, rev): | 2387 def match(self, rev): |
2388 def realparents(rev): | 2388 def realparents(rev): |
2389 if self.onlyfirst: | 2389 try: |
2390 return self.repo.changelog.parentrevs(rev)[0:1] | 2390 if self.onlyfirst: |
2391 else: | 2391 return self.repo.changelog.parentrevs(rev)[0:1] |
2392 return filter( | 2392 else: |
2393 lambda x: x != nullrev, self.repo.changelog.parentrevs(rev) | 2393 return filter( |
2394 ) | 2394 lambda x: x != nullrev, |
2395 self.repo.changelog.parentrevs(rev), | |
2396 ) | |
2397 except error.WdirUnsupported: | |
2398 prevs = [p.rev() for p in self.repo[rev].parents()] | |
2399 if self.onlyfirst: | |
2400 return prevs[:1] | |
2401 else: | |
2402 return prevs | |
2395 | 2403 |
2396 if self.startrev == nullrev: | 2404 if self.startrev == nullrev: |
2397 self.startrev = rev | 2405 self.startrev = rev |
2398 return True | 2406 return True |
2399 | 2407 |