Files
gitdm/patterns.py
Jonathan Corbet d25572552b Reduce the number of "funky email" gripes
Addresses of the form "user at host.wherever" can be trivially repaired, so
let's do so.

A couple of other minor tweaks are included here as well; nothing which
changes behavior.
2009-07-24 13:56:21 -06:00

40 lines
1.3 KiB
Python

#
# Pull together regular expressions used in multiple places.
#
# This code is part of the LWN git data miner.
#
# Copyright 2007-8 LWN.net
# Copyright 2007-8 Jonathan Corbet <corbet@lwn.net>
#
# This file may be distributed under the terms of the GNU General
# Public License, version 2.
#
import re
#
# Some people, when confronted with a problem, think "I know, I'll use regular
# expressions." Now they have two problems.
# -- Jamie Zawinski
#
Pemail = r'\s+"?([^<"]+)"?\s<([^>]+)>' # just email addr + name
Pcommit = re.compile (r'^commit ([0-9a-f ]+)$')
Pauthor = re.compile (r'^Author:' + Pemail + '$')
Psob = re.compile (r'Signed-off-by:' + Pemail)
Pmerge = re.compile (r'^Merge:.*$')
Padd = re.compile (r'^\+[^+].*$')
Prem = re.compile (r'^-[^-].*$')
Pdate = re.compile (r'^(Commit)?Date:\s+(.*)$')
Pfilea = re.compile (r'^---\s+(.*)$')
Pfileb = re.compile (r'^\+\+\+\s+(.*)$')
Preview = re.compile (r'Reviewed-by:' + Pemail)
Ptest = re.compile (r' tested-by:' + Pemail, re.I)
Prep = re.compile (r'Reported-by:' + Pemail)
Preptest = re.compile (r'reported-and-tested-by:' + Pemail, re.I)
#
# Merges are described with a variety of lines.
#
PExtMerge = re.compile(r'^ +Merge( branch .* of)? ([^ ]+:[^ ]+)\n$')
PIntMerge = re.compile(r'^ +(Merge|Pull) .* into .*$')
# PIntMerge2 = re.compile(r"^ +Merge branch(es)? '.*$")
PIntMerge2 = re.compile(r"^ +Merge .*$")