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

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

Issue 500023003: Teach v8rel script to read git hashes from DEPS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review Created 6 years, 3 months 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 | « no previous file | tools/push-to-trunk/releases.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 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 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 10 matching lines...) Expand all
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 re 29 import re
30 30
31 SHA1_RE = re.compile('^[a-fA-F0-9]{40}$')
32 GIT_SVN_ID_RE = re.compile('^git-svn-id: .*@([0-9]+) .*$')
33
31 34
32 class GitFailedException(Exception): 35 class GitFailedException(Exception):
33 pass 36 pass
34 37
35 38
36 def Strip(f): 39 def Strip(f):
37 def new_f(*args, **kwargs): 40 def new_f(*args, **kwargs):
38 return f(*args, **kwargs).strip() 41 return f(*args, **kwargs).strip()
39 return new_f 42 return new_f
40 43
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 181
179 def GitDCommit(self): 182 def GitDCommit(self):
180 self.Git("cl dcommit -f --bypass-hooks", retry_on=lambda x: x is None) 183 self.Git("cl dcommit -f --bypass-hooks", retry_on=lambda x: x is None)
181 184
182 def GitDiff(self, loc1, loc2): 185 def GitDiff(self, loc1, loc2):
183 return self.Git(MakeArgs(["diff", loc1, loc2])) 186 return self.Git(MakeArgs(["diff", loc1, loc2]))
184 187
185 def GitPull(self): 188 def GitPull(self):
186 self.Git("pull") 189 self.Git("pull")
187 190
191 def GitFetchOrigin(self):
192 self.Git("fetch origin")
193
194 def GitConvertToSVNRevision(self, git_hash):
195 result = self.Git(MakeArgs(["rev-list", "-n", "1", git_hash]))
196 if not result or not SHA1_RE.match(result):
197 raise GitFailedException("Git hash %s is unknown." % git_hash)
198 log = self.GitLog(n=1, format="%B", git_hash=git_hash)
199 for line in reversed(log.splitlines()):
200 match = GIT_SVN_ID_RE.match(line.strip())
201 if match:
202 return match.group(1)
203 raise GitFailedException("Couldn't convert %s to SVN." % git_hash)
204
188 def GitSVNFetch(self): 205 def GitSVNFetch(self):
189 self.Git("svn fetch") 206 self.Git("svn fetch")
190 207
191 def GitSVNRebase(self): 208 def GitSVNRebase(self):
192 self.Git("svn rebase") 209 self.Git("svn rebase")
193 210
194 # TODO(machenbach): Unused? Remove. 211 # TODO(machenbach): Unused? Remove.
195 @Strip 212 @Strip
196 def GitSVNLog(self): 213 def GitSVNLog(self):
197 return self.Git("svn log -1 --oneline") 214 return self.Git("svn log -1 --oneline")
198 215
199 @Strip 216 @Strip
200 def GitSVNFindGitHash(self, revision, branch=""): 217 def GitSVNFindGitHash(self, revision, branch=""):
201 assert revision 218 assert revision
202 return self.Git(MakeArgs(["svn find-rev", "r%s" % revision, branch])) 219 return self.Git(MakeArgs(["svn find-rev", "r%s" % revision, branch]))
203 220
204 @Strip 221 @Strip
205 def GitSVNFindSVNRev(self, git_hash, branch=""): 222 def GitSVNFindSVNRev(self, git_hash, branch=""):
206 return self.Git(MakeArgs(["svn find-rev", git_hash, branch])) 223 return self.Git(MakeArgs(["svn find-rev", git_hash, branch]))
207 224
208 def GitSVNDCommit(self): 225 def GitSVNDCommit(self):
209 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None) 226 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None)
210 227
211 def GitSVNTag(self, version): 228 def GitSVNTag(self, version):
212 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)), 229 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)),
213 retry_on=lambda x: x is None) 230 retry_on=lambda x: x is None)
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/releases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698