[PATCH 2 of 3] export patkind() from util
Robin Farine
robin.farine at terminus.org
Sun Nov 27 19:39:22 UTC 2005
# HG changeset patch
# User Robin Farine <robin.farine at terminus.org>
# Node ID 7bee89c3dd77dd3db828d7850c668184a852270e
# Parent 5512a8a7d5fb58a90ccd41e338656917603609d2
export patkind() from util
diff -r 5512a8a7d5fb -r 7bee89c3dd77 mercurial/util.py
--- a/mercurial/util.py Sun Nov 27 14:34:08 2005 +0100
+++ b/mercurial/util.py Sun Nov 27 14:36:58 2005 +0100
@@ -105,6 +105,13 @@
def always(fn): return True
def never(fn): return False
+
+def patkind(name, dflt_pat='glob'):
+ """Split a string into an optional pattern kind prefix and the
+ actual pattern."""
+ for prefix in 're', 'glob', 'path', 'relglob', 'relpath', 'relre':
+ if name.startswith(prefix + ':'): return name.split(':', 1)
+ return dflt_pat, name
def globre(pat, head='^', tail='$'):
"convert a glob pattern into a regexp"
@@ -220,11 +227,6 @@
make head regex a rooted bool
"""
- def patkind(name, dflt_pat='glob'):
- for prefix in 're', 'glob', 'path', 'relglob', 'relpath', 'relre':
- if name.startswith(prefix + ':'): return name.split(':', 1)
- return dflt_pat, name
-
def contains_glob(name):
for c in name:
if c in _globchars: return True
More information about the Mercurial
mailing list