Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: tools/push-to-trunk/push_to_trunk.py

Issue 98173003: Mock out date call in push-to-trunk script for testability. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 # disclaimer in the documentation and/or other materials provided 11 # disclaimer in the documentation and/or other materials provided
12 # with the distribution. 12 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its 13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived 14 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission. 15 # from this software without specific prior written permission.
16 # 16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import datetime
30 import optparse 29 import optparse
31 import sys 30 import sys
32 import tempfile 31 import tempfile
33 import urllib2 32 import urllib2
34 33
35 from common_includes import * 34 from common_includes import *
36 35
37 TRUNKBRANCH = "TRUNKBRANCH" 36 TRUNKBRANCH = "TRUNKBRANCH"
38 CHROMIUM = "CHROMIUM" 37 CHROMIUM = "CHROMIUM"
39 DEPS_FILE = "DEPS_FILE" 38 DEPS_FILE = "DEPS_FILE"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 except urllib2.URLError: 107 except urllib2.URLError:
109 pass 108 pass
110 return body 109 return body
111 110
112 def RunStep(self): 111 def RunStep(self):
113 self.RestoreIfUnset("last_push") 112 self.RestoreIfUnset("last_push")
114 113
115 # These version numbers are used again later for the trunk commit. 114 # These version numbers are used again later for the trunk commit.
116 self.ReadAndPersistVersion() 115 self.ReadAndPersistVersion()
117 116
118 date = datetime.date.today().strftime("%Y-%m-%d") 117 date = self.GetDate()
119 self.Persist("date", date) 118 self.Persist("date", date)
120 output = "%s: Version %s.%s.%s\n\n" % (date, 119 output = "%s: Version %s.%s.%s\n\n" % (date,
121 self._state["major"], 120 self._state["major"],
122 self._state["minor"], 121 self._state["minor"],
123 self._state["build"]) 122 self._state["build"])
124 TextToFile(output, self.Config(CHANGELOG_ENTRY_FILE)) 123 TextToFile(output, self.Config(CHANGELOG_ENTRY_FILE))
125 124
126 args = "log %s..HEAD --format=%%H" % self._state["last_push"] 125 args = "log %s..HEAD --format=%%H" % self._state["last_push"]
127 commits = self.Git(args).strip() 126 commits = self.Git(args).strip()
128 127
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 def Main(): 571 def Main():
573 parser = BuildOptions() 572 parser = BuildOptions()
574 (options, args) = parser.parse_args() 573 (options, args) = parser.parse_args()
575 if not ProcessOptions(options): 574 if not ProcessOptions(options):
576 parser.print_help() 575 parser.print_help()
577 return 1 576 return 1
578 RunPushToTrunk(CONFIG, options) 577 RunPushToTrunk(CONFIG, options)
579 578
580 if __name__ == "__main__": 579 if __name__ == "__main__":
581 sys.exit(Main()) 580 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698