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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 def Fill80(line): | 78 def Fill80(line): |
79 # Replace tabs and remove surrounding space. | 79 # Replace tabs and remove surrounding space. |
80 line = re.sub(r"\t", r" ", line.strip()) | 80 line = re.sub(r"\t", r" ", line.strip()) |
81 | 81 |
82 # Format with 8 characters indentation and line width 80. | 82 # Format with 8 characters indentation and line width 80. |
83 return textwrap.fill(line, width=80, initial_indent=" ", | 83 return textwrap.fill(line, width=80, initial_indent=" ", |
84 subsequent_indent=" ") | 84 subsequent_indent=" ") |
85 | 85 |
86 | 86 |
87 def GetLastChangeLogEntries(change_log_file): | |
88 result = [] | |
89 for line in LinesInFile(change_log_file): | |
90 if re.search(r"^\d{4}-\d{2}-\d{2}:", line) and result: break | |
91 result.append(line) | |
92 return "".join(result) | |
93 | |
94 | |
95 def MakeComment(text): | 87 def MakeComment(text): |
96 return MSub(r"^( ?)", "#", text) | 88 return MSub(r"^( ?)", "#", text) |
97 | 89 |
98 | 90 |
99 def StripComments(text): | 91 def StripComments(text): |
100 # Use split not splitlines to keep terminal newlines. | 92 # Use split not splitlines to keep terminal newlines. |
101 return "\n".join(filter(lambda x: not x.startswith("#"), text.split("\n"))) | 93 return "\n".join(filter(lambda x: not x.startswith("#"), text.split("\n"))) |
102 | 94 |
103 | 95 |
104 def MakeChangeLogBody(commit_messages, auto_format=False): | 96 def MakeChangeLogBody(commit_messages, auto_format=False): |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 steps = [] | 553 steps = [] |
562 for (number, step_class) in enumerate(step_classes): | 554 for (number, step_class) in enumerate(step_classes): |
563 steps.append(MakeStep(step_class, number, self._state, self._config, | 555 steps.append(MakeStep(step_class, number, self._state, self._config, |
564 options, self._side_effect_handler)) | 556 options, self._side_effect_handler)) |
565 for step in steps[options.step:]: | 557 for step in steps[options.step:]: |
566 step.Run() | 558 step.Run() |
567 return 0 | 559 return 0 |
568 | 560 |
569 def Run(self, args=None): | 561 def Run(self, args=None): |
570 return self.RunSteps(self._Steps(), args) | 562 return self.RunSteps(self._Steps(), args) |
OLD | NEW |