Patchwork [2,of,3,follow-up] revset: move dagop.maxlogdepth usage to generationsrel()

login
register
mail settings
Submitter Anton Shestakov
Date Jan. 26, 2019, 4:58 a.m.
Message ID <88aef4c81971a828462c.1548478700@neuro>
Download mbox | patch
Permalink /patch/38065/
State Accepted
Headers show

Comments

Anton Shestakov - Jan. 26, 2019, 4:58 a.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1548476480 -28800
#      Sat Jan 26 12:21:20 2019 +0800
# Node ID 88aef4c81971a828462c22f24e18246116c6715b
# Parent  b57f637ff71ae812fe78722666fec025cbf8b75e
revset: move dagop.maxlogdepth usage to generationsrel()

Not all subscript operations would want (maxlogdepth - 1) in place of None.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -258,6 +258,11 @@  def _splitrange(a, b):
 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 @@  def relsubscriptset(repo, subset, x, y, 
             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)