hgext3rd/topic/revset.py
changeset 4390 312b9e8a4c9c
parent 4381 5f1d0cff514d
child 4717 7b36f9728351
equal deleted inserted replaced
4389:88887b2be07c 4390:312b9e8a4c9c
   106     else:
   106     else:
   107         branch = repo[None].branch()
   107         branch = repo[None].branch()
   108     return revset.baseset(stack.stack(repo, branch=branch, topic=topic)[1:]) & subset
   108     return revset.baseset(stack.stack(repo, branch=branch, topic=topic)[1:]) & subset
   109 
   109 
   110 if util.safehasattr(revset, 'subscriptrelations'):
   110 if util.safehasattr(revset, 'subscriptrelations'):
   111     def stackrel(repo, subset, x, rel, a, *args):
   111     def stackrel(repo, subset, x, rel, z, order):
   112         """This is a revset-flavored implementation of stack aliases.
   112         """This is a revset-flavored implementation of stack aliases.
   113 
   113 
   114         The syntax is: rev#stack[n] or rev#s[n]. Plenty of logic is borrowed
   114         The syntax is: rev#stack[n] or rev#s[n]. Plenty of logic is borrowed
   115         from topic._namemap, but unlike that function, which prefers to abort
   115         from topic._namemap, but unlike that function, which prefers to abort
   116         (e.g. when stack index is too high), this returns empty set to be more
   116         (e.g. when stack index is too high), this returns empty set to be more
   117         revset-friendly.
   117         revset-friendly.
   118         """
   118         """
   119         # hg 4.9 provides one bound, hg 5.0 provides two
   119         # hg 4.9 provides a number or None, hg 5.0 provides a tuple of tokens
   120         if len(args) == 2:
   120         if isinstance(z, tuple):
   121             b = args[0]
   121             a, b = revset.getintrange(
       
   122                 z,
       
   123                 'relation subscript must be an integer or a range',
       
   124                 'relation subscript bounds must be integers',
       
   125                 None, None)
   122         else:
   126         else:
   123             b = a
   127             a = b = z
   124 
   128 
   125         s = revset.getset(repo, revset.fullreposet(repo), x)
   129         s = revset.getset(repo, revset.fullreposet(repo), x)
   126         if not s:
   130         if not s:
   127             return revset.baseset()
   131             return revset.baseset()
   128 
   132