src/topic/destination.py
changeset 1870 8dd5200b4086
child 1871 58ef5699fb35
equal deleted inserted replaced
1869:995617c7f2fc 1870:8dd5200b4086
       
     1 from mercurial import revset
       
     2 from mercurial import error
       
     3 def ngtip(repo, branch, all=False):
       
     4     """tip new generation"""
       
     5     ## search for untopiced heads of branch
       
     6     # could be heads((::branch(x) - topic()))
       
     7     # but that is expensive
       
     8     #
       
     9     # we should write plain code instead
       
    10     subquery = '''heads(
       
    11                     parents(
       
    12                        ancestor(
       
    13                          (head() and branch(%s)
       
    14                          or (topic() and branch(%s)))))
       
    15                    ::(head() and branch(%s))
       
    16                    - topic())'''
       
    17     if not all:
       
    18         subquery = 'max(%s)' % subquery
       
    19     return repo.revs(subquery, branch, branch, branch)