OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 date = datetime.date.today().strftime("%Y-%m-%d") | 103 date = datetime.date.today().strftime("%Y-%m-%d") |
104 self.Persist("date", date) | 104 self.Persist("date", date) |
105 output = "%s: Version %s.%s.%s\n\n" % (date, | 105 output = "%s: Version %s.%s.%s\n\n" % (date, |
106 self._state["major"], | 106 self._state["major"], |
107 self._state["minor"], | 107 self._state["minor"], |
108 self._state["build"]) | 108 self._state["build"]) |
109 TextToFile(output, self.Config(CHANGELOG_ENTRY_FILE)) | 109 TextToFile(output, self.Config(CHANGELOG_ENTRY_FILE)) |
110 | 110 |
111 args = "log %s..HEAD --format=%%H" % self._state["last_push"] | 111 args = "log %s..HEAD --format=%%H" % self._state["last_push"] |
112 commits = self.Git(args).strip() | 112 commits = self.Git(args).strip() |
113 for commit in commits.splitlines(): | |
114 # Get the commit's title line. | |
115 args = "log -1 %s --format=\"%%w(80,8,8)%%s\"" % commit | |
116 title = "%s\n" % self.Git(args).rstrip() | |
117 AppendToFile(title, self.Config(CHANGELOG_ENTRY_FILE)) | |
118 | 113 |
119 # Grep for "BUG=xxxx" lines in the commit message and convert them to | 114 def GetCommitMessages(): |
120 # "(issue xxxx)". | 115 for commit in commits.splitlines(): |
121 out = self.Git("log -1 %s --format=\"%%B\"" % commit).splitlines() | 116 yield [ |
122 out = filter(lambda x: re.search(r"^BUG=", x), out) | 117 self.Git("log -1 %s --format=\"%%w(80,8,8)%%s\"" % commit), |
123 out = filter(lambda x: not re.search(r"BUG=$", x), out) | 118 self.Git("log -1 %s --format=\"%%B\"" % commit), |
124 out = filter(lambda x: not re.search(r"BUG=none$", x), out) | 119 self.Git("log -1 %s --format=\"%%w(80,8,8)(%%an)\"" % commit), |
| 120 ] |
125 | 121 |
126 # TODO(machenbach): Handle multiple entries (e.g. BUG=123, 234). | 122 body = MakeChangeLogBody(GetCommitMessages) |
127 def FormatIssue(text): | 123 AppendToFile(body, self.Config(CHANGELOG_ENTRY_FILE)) |
128 text = re.sub(r"BUG=v8:(.*)$", r"(issue \1)", text) | |
129 text = re.sub(r"BUG=chromium:(.*)$", r"(Chromium issue \1)", text) | |
130 text = re.sub(r"BUG=(.*)$", r"(Chromium issue \1)", text) | |
131 return " %s\n" % text | |
132 | |
133 for line in map(FormatIssue, out): | |
134 AppendToFile(line, self.Config(CHANGELOG_ENTRY_FILE)) | |
135 | |
136 # Append the commit's author for reference. | |
137 args = "log -1 %s --format=\"%%w(80,8,8)(%%an)\"" % commit | |
138 author = self.Git(args).rstrip() | |
139 AppendToFile("%s\n\n" % author, self.Config(CHANGELOG_ENTRY_FILE)) | |
140 | 124 |
141 msg = " Performance and stability improvements on all platforms.\n" | 125 msg = " Performance and stability improvements on all platforms.\n" |
142 AppendToFile(msg, self.Config(CHANGELOG_ENTRY_FILE)) | 126 AppendToFile(msg, self.Config(CHANGELOG_ENTRY_FILE)) |
143 | 127 |
| 128 |
144 class EditChangeLog(Step): | 129 class EditChangeLog(Step): |
145 def __init__(self): | 130 def __init__(self): |
146 Step.__init__(self, "Edit ChangeLog entry.") | 131 Step.__init__(self, "Edit ChangeLog entry.") |
147 | 132 |
148 def RunStep(self): | 133 def RunStep(self): |
149 print ("Please press <Return> to have your EDITOR open the ChangeLog " | 134 print ("Please press <Return> to have your EDITOR open the ChangeLog " |
150 "entry, then edit its contents to your liking. When you're done, " | 135 "entry, then edit its contents to your liking. When you're done, " |
151 "save the file and exit your EDITOR. ") | 136 "save the file and exit your EDITOR. ") |
152 self.ReadLine() | 137 self.ReadLine() |
153 | 138 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 def Main(): | 560 def Main(): |
576 parser = BuildOptions() | 561 parser = BuildOptions() |
577 (options, args) = parser.parse_args() | 562 (options, args) = parser.parse_args() |
578 if not ProcessOptions(options): | 563 if not ProcessOptions(options): |
579 parser.print_help() | 564 parser.print_help() |
580 return 1 | 565 return 1 |
581 RunScript(CONFIG, options) | 566 RunScript(CONFIG, options) |
582 | 567 |
583 if __name__ == "__main__": | 568 if __name__ == "__main__": |
584 sys.exit(Main()) | 569 sys.exit(Main()) |
OLD | NEW |