1 # Copyright (c) 2011 The Chromium OS Authors.
3 # See file CREDITS for list of people who contributed to this
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; either version 2 of
9 # the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 # Separates a tag: at the beginning of the subject from the rest of it
25 re_subject_tag = re.compile('([^:\s]*):\s*(.*)')
28 """Holds information about a single commit/patch in the series.
31 hash: Commit hash (as a string)
36 tags: List of maintainer tag strings
37 changes: Dict containing a list of changes (single line strings).
38 The dict is indexed by change version (an integer)
39 cc_list: List of people to aliases/emails to cc on this commit
41 def __init__(self, hash):
48 def AddChange(self, version, info):
49 """Add a new change line to the change list for a version.
52 version: Patch set version (integer: 1, 2, 3)
53 info: Description of change in this version
55 if not self.changes.get(version):
56 self.changes[version] = []
57 self.changes[version].append(info)
60 """Create a list of subject tags in the commit
62 Subject tags look like this:
64 propounder: fort: Change the widget to propound correctly
66 Here the tags are propounder and fort. Multiple tags are supported.
67 The list is updated in self.tag.
70 None if ok, else the name of a tag with no email alias
75 m = re_subject_tag.match(str)
82 def AddCc(self, cc_list):
83 """Add a list of people to Cc when we send this patch.
86 cc_list: List of aliases or email addresses
88 self.cc_list += cc_list