src/mercurialserver/ruleset.py
changeset 297 9875791ab421
parent 242 03d8f07230b3
child 300 31c2c6b383fd
equal deleted inserted replaced
296:6feeef02c057 297:9875791ab421
    17 # False for a definite non-match
    17 # False for a definite non-match
    18 # None where we can't be sure because a key is None
    18 # None where we can't be sure because a key is None
    19 def rule(pairs):
    19 def rule(pairs):
    20     matchers = [(k, globmatcher(v)) for k, v in pairs]
    20     matchers = [(k, globmatcher(v)) for k, v in pairs]
    21     def c(kw):
    21     def c(kw):
       
    22         best = True
    22         for k, m in matchers:
    23         for k, m in matchers:
    23             if k not in kw:
    24             if k not in kw:
    24                 return False
    25                 return False
    25             kkw = kw[k]
    26             kkw = kw[k]
    26             if kkw is None:
    27             if kkw is None:
    27                 return None
    28                 best = None
    28             if m.match(kkw) is None:
    29             elif m.match(kkw) is None:
    29                 return False
    30                 return False
    30         return True
    31         return best
    31     return c
    32     return c
    32 
    33 
    33 class Ruleset(object):
    34 class Ruleset(object):
    34     '''Class representing the rules in a rule file'''
    35     '''Class representing the rules in a rule file'''
    35     
    36