Mercurial > hg-stable
comparison mercurial/revset.py @ 42457:43c8f72184f4
revset: fix merge() to fall back to changectx API if wdir specified
I have a code which basically runs "0:wdir() & <user-revset>", and it crashed
if merge() were passed in.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 09 Jun 2019 22:23:41 +0900 |
parents | d279e4f453c4 |
children | 911e25dc9d8c |
comparison
equal
deleted
inserted
replaced
42456:d279e4f453c4 | 42457:43c8f72184f4 |
---|---|
1360 """ | 1360 """ |
1361 # i18n: "merge" is a keyword | 1361 # i18n: "merge" is a keyword |
1362 getargs(x, 0, 0, _("merge takes no arguments")) | 1362 getargs(x, 0, 0, _("merge takes no arguments")) |
1363 cl = repo.changelog | 1363 cl = repo.changelog |
1364 nullrev = node.nullrev | 1364 nullrev = node.nullrev |
1365 return subset.filter(lambda r: cl.parentrevs(r)[1] != nullrev, | 1365 def ismerge(r): |
1366 condrepr='<merge>') | 1366 try: |
1367 return cl.parentrevs(r)[1] != nullrev | |
1368 except error.WdirUnsupported: | |
1369 return bool(repo[r].p2()) | |
1370 return subset.filter(ismerge, condrepr='<merge>') | |
1367 | 1371 |
1368 @predicate('branchpoint()', safe=True) | 1372 @predicate('branchpoint()', safe=True) |
1369 def branchpoint(repo, subset, x): | 1373 def branchpoint(repo, subset, x): |
1370 """Changesets with more than one child. | 1374 """Changesets with more than one child. |
1371 """ | 1375 """ |