hgext3rd/topic/revset.py
changeset 4057 054d288680b4
parent 3613 bf583a8dc637
child 4058 90783c9c8609
equal deleted inserted replaced
4056:235f15c40556 4057:054d288680b4
    31     as a regular expression.
    31     as a regular expression.
    32 
    32 
    33     TODO: make `topic(revset)` work the same as `branch(revset)`.
    33     TODO: make `topic(revset)` work the same as `branch(revset)`.
    34     """
    34     """
    35     args = revset.getargs(x, 0, 1, 'topic takes one or no arguments')
    35     args = revset.getargs(x, 0, 1, 'topic takes one or no arguments')
    36     if args:
    36 
       
    37     mutable = revset._notpublic(repo, revset.fullreposet(repo), ())
       
    38 
       
    39     if not args:
       
    40         return (subset & mutable).filter(lambda r: bool(repo[r].topic()))
       
    41     else:
    37         # match a specific topic
    42         # match a specific topic
    38         topic = revset.getstring(args[0], 'topic() argument must be a string')
    43         topic = revset.getstring(args[0], 'topic() argument must be a string')
    39         if topic == '.':
    44         if topic == '.':
    40             topic = repo['.'].extra().get('topic', '')
    45             topic = repo['.'].extra().get('topic', '')
    41         _kind, _pattern, matcher = mkmatcher(topic)
    46         _kind, _pattern, matcher = mkmatcher(topic)
    42     else:
       
    43         matcher = lambda t: bool(t)
       
    44 
       
    45     mutable = revset._notpublic(repo, revset.fullreposet(repo), ())
       
    46 
    47 
    47     rawchange = repo.changelog.changelogrevision
    48     rawchange = repo.changelog.changelogrevision
    48     key = constants.extrakey
    49     key = constants.extrakey
    49 
    50 
    50     def matchtopic(r):
    51     def matchtopic(r):