generatorset: use 'next()' to simplify the code
The 'next()' built-in accept a default value. This remove the needs to check if
self non-empty before returning a value.
--- a/mercurial/revset.py Sun May 17 18:00:38 2015 -0700
+++ b/mercurial/revset.py Sun May 17 18:06:09 2015 -0700
@@ -3322,9 +3322,7 @@
for x in self._consumegen():
pass
return self.first()
- if self:
- return it().next()
- return None
+ return next(it(), None)
def last(self):
if self._ascending:
@@ -3336,9 +3334,7 @@
for x in self._consumegen():
pass
return self.first()
- if self:
- return it().next()
- return None
+ return next(it(), None)
def __repr__(self):
d = {False: '-', True: '+'}[self._ascending]