hgkw/kwexpander.py
branchupdatehook
changeset 23 9fdf507badfc
parent 21 536c1797202d
child 24 1083d250d1b2
equal deleted inserted replaced
22:bd97d6fde324 23:9fdf507badfc
    22 def expandkw(ui, repo, node, cid, candidates, update=False):
    22 def expandkw(ui, repo, node, cid, candidates, update=False):
    23     '''Important: returns False on success, True on failure.'''
    23     '''Important: returns False on success, True on failure.'''
    24 
    24 
    25     # only check files that have hgkwencode assigned as encode filter
    25     # only check files that have hgkwencode assigned as encode filter
    26     files = []
    26     files = []
       
    27     # python2.4: files = set()
    27     for pat, cmd in repo.ui.configitems('encode'):
    28     for pat, cmd in repo.ui.configitems('encode'):
    28         if cmd.endswith(kwencodefilter):
    29         if cmd.endswith(kwencodefilter):
    29             mf = mercurial.util.matcher(repo.root, '', [pat], [], [])[1]
    30             mf = mercurial.util.matcher(repo.root, '', [pat], [], [])[1]
    30             for candidate in candidates:
    31             for candidate in candidates:
    31                 if mf(candidate):
    32                 if mf(candidate) and candidate not in files:
    32                     # check again that there really are no duplicates
       
    33                     # if candidate not in files ???
       
    34                     files.append(candidate)
    33                     files.append(candidate)
       
    34                 # python2.4:
       
    35                 # if mf(candidate): files.add(candidate)
    35 
    36 
    36     if not files: # nothing to do
    37     if not files: # nothing to do
    37         return False
    38         return False
    38 
    39 
    39     user, date = repo.changelog.read(node)[1:3]
    40     user, date = repo.changelog.read(node)[1:3]