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

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

Issue 607893004: Add tag write access to merge script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More docu. Created 6 years, 2 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 95
96 class GitRecipesMixin(object): 96 class GitRecipesMixin(object):
97 def GitIsWorkdirClean(self, **kwargs): 97 def GitIsWorkdirClean(self, **kwargs):
98 return self.Git("status -s -uno", **kwargs).strip() == "" 98 return self.Git("status -s -uno", **kwargs).strip() == ""
99 99
100 @Strip 100 @Strip
101 def GitBranch(self, **kwargs): 101 def GitBranch(self, **kwargs):
102 return self.Git("branch", **kwargs) 102 return self.Git("branch", **kwargs)
103 103
104 @Strip
105 def GitRemoteContains(self, hsh, **kwargs):
agable 2014/09/29 09:49:12 I'd be scared that someone might use this who does
Michael Achenbach 2014/09/29 10:46:25 I'll rename the function as it should be just used
106 """Returns the remote branch for a given commit.
107
108 Returns an empty string in case the commit doesn't exist on any remote
agable 2014/09/29 09:49:11 None is a better sentinel value than "".
Michael Achenbach 2014/09/29 10:46:25 Done. Was because of the @Strip wrapper. But I mak
109 branch.
110 Returns the last remote branch in case the commit exists on more than one.
111 """
112 branches = self.Git(MakeArgs(["branch -r --contains", hsh]),
113 **kwargs).strip().splitlines()
114 return (branches or [""])[-1]
115
104 def GitCreateBranch(self, name, branch="", **kwargs): 116 def GitCreateBranch(self, name, branch="", **kwargs):
105 assert name 117 assert name
106 self.Git(MakeArgs(["checkout -b", name, branch]), **kwargs) 118 self.Git(MakeArgs(["checkout -b", name, branch]), **kwargs)
107 119
108 def GitDeleteBranch(self, name, **kwargs): 120 def GitDeleteBranch(self, name, **kwargs):
109 assert name 121 assert name
110 self.Git(MakeArgs(["branch -D", name]), **kwargs) 122 self.Git(MakeArgs(["branch -D", name]), **kwargs)
111 123
112 def GitReset(self, name, **kwargs): 124 def GitReset(self, name, **kwargs):
113 assert name 125 assert name
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 def GitSVNFindSVNRev(self, git_hash, branch="", **kwargs): 317 def GitSVNFindSVNRev(self, git_hash, branch="", **kwargs):
306 return self.Git(MakeArgs(["svn find-rev", git_hash, branch]), **kwargs) 318 return self.Git(MakeArgs(["svn find-rev", git_hash, branch]), **kwargs)
307 319
308 def GitSVNDCommit(self, **kwargs): 320 def GitSVNDCommit(self, **kwargs):
309 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None, **kwargs) 321 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None, **kwargs)
310 322
311 def GitSVNTag(self, version, **kwargs): 323 def GitSVNTag(self, version, **kwargs):
312 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)), 324 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)),
313 retry_on=lambda x: x is None, 325 retry_on=lambda x: x is None,
314 **kwargs) 326 **kwargs)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698