3 # Pull together regular expressions used in multiple places.
5 # This code is part of the LWN git data miner.
7 # Copyright 2007-11 Eklektix, Inc.
8 # Copyright 2007-11 Jonathan Corbet <corbet@lwn.net>
9 # Copyright 2011 Germán Póo-Caamaño <gpoo@gnome.org>
11 # This file may be distributed under the terms of the GNU General
12 # Public License, version 2.
17 # Some people, when confronted with a problem, think "I know, I'll use regular
18 # expressions." Now they have two problems.
21 _pemail
= r
'\s+"?([^<]+)"?\s<([^>]+)>' # just email addr + name
24 'tagcommit': re
.compile (r
'^commit ([\da-f]+) .*tag: (v[23]\.\d(\.\d\d?)?)'),
25 'commit': re
.compile (r
'^commit ([0-9a-f ]+)'),
26 'author': re
.compile (r
'^Author:' + _pemail
+ '$'),
27 'signed-off-by': re
.compile (r
'^\s+signed-off-by:' + _pemail
+ '.*$', re
.I
),
28 'merge': re
.compile (r
'^Merge:.*$'),
29 'add': re
.compile (r
'^\+[^+].*$'),
30 'rem': re
.compile (r
'^-[^-].*$'),
31 'date': re
.compile (r
'^(Commit)?Date:\s+(.*)$'),
32 # filea, fileb are used only in 'parche mode' (-p)
33 'filea': re
.compile (r
'^---\s+(.*)$'),
34 'fileb': re
.compile (r
'^\+\+\+\s+(.*)$'),
35 'acked-by': re
.compile (r
'^\s+Acked-by:' + _pemail
+ '.*$', re
.I
),
36 'reviewed-by': re
.compile (r
'^\s+Reviewed-by:' + _pemail
+ '.*$', re
.I
),
37 'tested-by': re
.compile (r
'^\s+tested-by:' + _pemail
+ '.*$', re
.I
),
38 'reported-by': re
.compile (r
'^\s+Reported-by:' + _pemail
+ '.*$', re
.I
),
39 'reported-and-tested-by': re
.compile (r
'^\s+reported-and-tested-by:' + _pemail
+ '.*$', re
.I
),
41 # Merges are described with a variety of lines.
43 'ExtMerge': re
.compile(r
'^ +Merge( (branch|branches|tag|tags) .* of)? ([^ ]+:[^ ]+)( into .*)?\n$'),
44 'IntMerge': re
.compile(r
'(Merge|Pull) .* into .*$'),
45 # PIntMerge2 = re.compile(r"^ +Merge branch(es)? '.*$"),
46 'IntMerge2': re
.compile(r
"^ +Merge .*$"),
47 # Another way to get the statistics (per file).
48 # It implies --numstat
49 'numstat': re
.compile('^(\d+|-)\s+(\d+|-)\s+(.*)$'),
50 'rename' : re
.compile('(.*)\{(.*) => (.*)\}(.*)'),
51 # Detect errors on svn conversions
52 'svn-tag': re
.compile("^svn path=/tags/(.*)/?; revision=([0-9]+)$"),