revset: use try-except instead of if-else because of perf
For wdir(), we now raises an exception which will be raised when wdir() will be
passed, so catching that exception is better checking for wdir() using if-else.
--- a/mercurial/revset.py Mon May 22 01:38:00 2017 +0530
+++ b/mercurial/revset.py Mon May 22 02:03:43 2017 +0530
@@ -1456,10 +1456,10 @@
up = ps.update
parentrevs = cl.parentrevs
for r in getset(repo, fullreposet(repo), x):
- if r == node.wdirrev:
+ try:
+ up(parentrevs(r))
+ except error.WdirUnsupported:
up(p.rev() for p in repo[r].parents())
- else:
- up(parentrevs(r))
ps -= {node.nullrev}
return subset & ps