[PATCH 3 of 8] match: add doctest examples for patkind()
Denis Laxalde
denis at laxalde.org
Mon Apr 8 04:23:47 EDT 2019
# HG changeset patch
# User Denis Laxalde <denis at laxalde.org>
# Date 1554566053 -7200
# Sat Apr 06 17:54:13 2019 +0200
# Node ID a507b64705f6ce78c4ad74b45a798668d8770cb7
# Parent 490dbf4f3e1668a186e14e95a119684dafcf496b
match: add doctest examples for patkind()
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -1024,7 +1024,18 @@ class unionmatcher(basematcher):
return ('<unionmatcher matchers=%r>' % self._matchers)
def patkind(pattern, default=None):
- '''If pattern is 'kind:pat' with a known kind, return kind.'''
+ '''If pattern is 'kind:pat' with a known kind, return kind.
+
+ >>> patkind('re:.*\.c$')
+ 're'
+ >>> patkind('glob:*.c')
+ 'glob'
+ >>> patkind('relpath:test.py')
+ 'relpath'
+ >>> patkind('main.py')
+ >>> patkind('main.py', default='re')
+ 're'
+ '''
return _patsplit(pattern, default)[0]
def _patsplit(pattern, default):
More information about the Mercurial-devel
mailing list