comparison mercurial/revset.py @ 41388: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 431cf2c8c839
children 0bd56c291359
comparison
equal deleted inserted replaced
41387:947b81560583 41388:ee7791f2515b
256 return ancdepths, descdepths 256 return ancdepths, descdepths
257 257
258 def generationsrel(repo, subset, x, rel, a, b, order): 258 def generationsrel(repo, subset, x, rel, a, b, order):
259 # TODO: rewrite tests, and drop startdepth argument from ancestors() and 259 # TODO: rewrite tests, and drop startdepth argument from ancestors() and
260 # descendants() predicates 260 # descendants() predicates
261 if a is None:
262 a = -(dagop.maxlogdepth - 1)
263 if b is None:
264 b = +(dagop.maxlogdepth - 1)
265
261 (ancstart, ancstop), (descstart, descstop) = _splitrange(a, b) 266 (ancstart, ancstop), (descstart, descstop) = _splitrange(a, b)
262 267
263 if ancstart is None and descstart is None: 268 if ancstart is None and descstart is None:
264 return baseset() 269 return baseset()
265 270
292 if i is None: 297 if i is None:
293 return None 298 return None
294 msg = _("relation subscript bounds must be integers") 299 msg = _("relation subscript bounds must be integers")
295 return getinteger(i, msg) 300 return getinteger(i, msg)
296 a, b = [getbound(i) for i in (a, b)] 301 a, b = [getbound(i) for i in (a, b)]
297 if a is None:
298 a = -(dagop.maxlogdepth - 1)
299 if b is None:
300 b = +(dagop.maxlogdepth - 1)
301 302
302 if rel in subscriptrelations: 303 if rel in subscriptrelations:
303 return subscriptrelations[rel](repo, subset, x, rel, a, b, order) 304 return subscriptrelations[rel](repo, subset, x, rel, a, b, order)
304 305
305 relnames = [r for r in subscriptrelations.keys() if len(r) > 1] 306 relnames = [r for r in subscriptrelations.keys() if len(r) > 1]