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 # Syzbot-style reported-by
40 'reported-by2': re
.compile (r
'^\s+Reported-by:\s+(.+@.+)\s*$', re
.I
),
41 'reported-and-tested-by': re
.compile (r
'^\s+reported-and-tested-by:' + _pemail
+ '.*$', re
.I
),
43 # Merges are described with a variety of lines.
45 'ExtMerge': re
.compile(r
'^ +Merge( (branch|branches|tag|tags) .* of)? ([^ ]+:[^ ]+)( into .*)?$'),
46 'IntMerge': re
.compile(r
'(Merge|Pull) .* into .*$'),
47 # PIntMerge2 = re.compile(r"^ +Merge branch(es)? '.*$"),
48 'IntMerge2': re
.compile(r
"^ +Merge .*$"),
49 # Another way to get the statistics (per file).
50 # It implies --numstat
51 'numstat': re
.compile(r
'^(\d+|-)\s+(\d+|-)\s+(.*)$'),
52 'rename' : re
.compile(r
'(.*)\{(.*) => (.*)\}(.*)'),
53 # Detect errors on svn conversions
54 'svn-tag': re
.compile("^svn path=/tags/(.*)/?; revision=([0-9]+)$"),