changeset 41410:ee7791f2515b

revset: move dagop.maxlogdepth usage to generationsrel() Not all subscript operations would want (maxlogdepth - 1) in place of None.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 26 Jan 2019 12:21:20 +0800
parents 947b81560583
children 7e55ca658e4b
files mercurial/revset.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Sat Jan 26 12:20:05 2019 +0800
+++ b/mercurial/revset.py	Sat Jan 26 12:21:20 2019 +0800
@@ -258,6 +258,11 @@
 def generationsrel(repo, subset, x, rel, a, b, order):
     # TODO: rewrite tests, and drop startdepth argument from ancestors() and
     # descendants() predicates
+    if a is None:
+        a = -(dagop.maxlogdepth - 1)
+    if b is None:
+        b = +(dagop.maxlogdepth - 1)
+
     (ancstart, ancstop), (descstart, descstop) = _splitrange(a, b)
 
     if ancstart is None and descstart is None:
@@ -294,10 +299,6 @@
             msg = _("relation subscript bounds must be integers")
             return getinteger(i, msg)
         a, b = [getbound(i) for i in (a, b)]
-        if a is None:
-            a = -(dagop.maxlogdepth - 1)
-        if b is None:
-            b = +(dagop.maxlogdepth - 1)
 
     if rel in subscriptrelations:
         return subscriptrelations[rel](repo, subset, x, rel, a, b, order)