Mercurial > hg
changeset 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 | 07c424a13811 |
children | 8ceb5b4b2728 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Sep 10 13:30:34 2020 +0900 +++ b/mercurial/cmdutil.py Fri Sep 11 18:33:41 2020 +0900 @@ -2386,12 +2386,20 @@ def match(self, rev): def realparents(rev): - if self.onlyfirst: - return self.repo.changelog.parentrevs(rev)[0:1] - else: - return filter( - lambda x: x != nullrev, self.repo.changelog.parentrevs(rev) - ) + try: + if self.onlyfirst: + return self.repo.changelog.parentrevs(rev)[0:1] + else: + return filter( + lambda x: x != nullrev, + self.repo.changelog.parentrevs(rev), + ) + except error.WdirUnsupported: + prevs = [p.rev() for p in self.repo[rev].parents()] + if self.onlyfirst: + return prevs[:1] + else: + return prevs if self.startrev == nullrev: self.startrev = rev