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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 def FileToText(file_name): | 61 def FileToText(file_name): |
62 with open(file_name) as f: | 62 with open(file_name) as f: |
63 return f.read() | 63 return f.read() |
64 | 64 |
65 | 65 |
66 def MSub(rexp, replacement, text): | 66 def MSub(rexp, replacement, text): |
67 return re.sub(rexp, replacement, text, flags=re.MULTILINE) | 67 return re.sub(rexp, replacement, text, flags=re.MULTILINE) |
68 | 68 |
69 | 69 |
| 70 def GetLastChangeLogEntries(change_log_file): |
| 71 result = [] |
| 72 for line in LinesInFile(change_log_file): |
| 73 if re.search(r"^\d{4}-\d{2}-\d{2}:", line) and result: break |
| 74 result.append(line) |
| 75 return "".join(result) |
| 76 |
| 77 |
70 # Some commands don't like the pipe, e.g. calling vi from within the script or | 78 # Some commands don't like the pipe, e.g. calling vi from within the script or |
71 # from subscripts like git cl upload. | 79 # from subscripts like git cl upload. |
72 def Command(cmd, args="", prefix="", pipe=True): | 80 def Command(cmd, args="", prefix="", pipe=True): |
73 cmd_line = "%s %s %s" % (prefix, cmd, args) | 81 cmd_line = "%s %s %s" % (prefix, cmd, args) |
74 print "Command: %s" % cmd_line | 82 print "Command: %s" % cmd_line |
75 try: | 83 try: |
76 if pipe: | 84 if pipe: |
77 return subprocess.check_output(cmd_line, shell=True) | 85 return subprocess.check_output(cmd_line, shell=True) |
78 else: | 86 else: |
79 return subprocess.check_call(cmd_line, shell=True) | 87 return subprocess.check_call(cmd_line, shell=True) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 class UploadStep(Step): | 288 class UploadStep(Step): |
281 def __init__(self): | 289 def __init__(self): |
282 Step.__init__(self, "Upload for code review.") | 290 Step.__init__(self, "Upload for code review.") |
283 | 291 |
284 def RunStep(self): | 292 def RunStep(self): |
285 print "Please enter the email address of a V8 reviewer for your patch: ", | 293 print "Please enter the email address of a V8 reviewer for your patch: ", |
286 reviewer = self.ReadLine() | 294 reviewer = self.ReadLine() |
287 args = "cl upload -r \"%s\" --send-mail" % reviewer | 295 args = "cl upload -r \"%s\" --send-mail" % reviewer |
288 if self.Git(args,pipe=False) is None: | 296 if self.Git(args,pipe=False) is None: |
289 self.Die("'git cl upload' failed, please try again.") | 297 self.Die("'git cl upload' failed, please try again.") |
OLD | NEW |