mercurial/util.py
changeset 1062 6d5a62a549fa
parent 1031 503aaf19a040
child 1075 e254bcbfe636
equal deleted inserted replaced
1061:fed8d078840b 1062:6d5a62a549fa
    25     """Raised if a command needs to print an error and exit."""
    25     """Raised if a command needs to print an error and exit."""
    26 
    26 
    27 def always(fn): return True
    27 def always(fn): return True
    28 def never(fn): return False
    28 def never(fn): return False
    29 
    29 
    30 def globre(pat, head = '^', tail = '$'):
    30 def globre(pat, head='^', tail='$'):
    31     "convert a glob pattern into a regexp"
    31     "convert a glob pattern into a regexp"
    32     i, n = 0, len(pat)
    32     i, n = 0, len(pat)
    33     res = ''
    33     res = ''
    34     group = False
    34     group = False
    35     def peek(): return i < n and pat[i]
    35     def peek(): return i < n and pat[i]
    96     elif name == repo.root:
    96     elif name == repo.root:
    97         return ''
    97         return ''
    98     else:
    98     else:
    99         raise Abort('%s not under repository root' % myname)
    99         raise Abort('%s not under repository root' % myname)
   100 
   100 
   101 def matcher(repo, cwd, names, inc, exc, head = ''):
   101 def matcher(repo, cwd, names, inc, exc, head=''):
   102     def patkind(name):
   102     def patkind(name):
   103         for prefix in 're:', 'glob:', 'path:', 'relpath:':
   103         for prefix in 're:', 'glob:', 'path:', 'relpath:':
   104             if name.startswith(prefix): return name.split(':', 1)
   104             if name.startswith(prefix): return name.split(':', 1)
   105         for c in name:
   105         for c in name:
   106             if c in _globchars: return 'glob', name
   106             if c in _globchars: return 'glob', name