OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 self.Git(MakeArgs(["checkout -b", name, branch])) | 56 self.Git(MakeArgs(["checkout -b", name, branch])) |
57 | 57 |
58 def GitDeleteBranch(self, name): | 58 def GitDeleteBranch(self, name): |
59 assert name | 59 assert name |
60 self.Git(MakeArgs(["branch -D", name])) | 60 self.Git(MakeArgs(["branch -D", name])) |
61 | 61 |
62 def GitCheckout(self, name): | 62 def GitCheckout(self, name): |
63 assert name | 63 assert name |
64 self.Git(MakeArgs(["checkout -f", name])) | 64 self.Git(MakeArgs(["checkout -f", name])) |
65 | 65 |
66 def GitCheckoutFile(self, name, branch): | 66 def GitCheckoutFile(self, name, branch_or_hash): |
67 assert name | 67 assert name |
68 assert branch | 68 assert branch_or_hash |
69 self.Git(MakeArgs(["checkout -f", branch, "--", name])) | 69 self.Git(MakeArgs(["checkout -f", branch_or_hash, "--", name])) |
70 | 70 |
71 @Strip | 71 @Strip |
72 def GitCurrentBranch(self): | 72 def GitCurrentBranch(self): |
73 for line in self.Git("status -s -b -uno").strip().splitlines(): | 73 for line in self.Git("status -s -b -uno").strip().splitlines(): |
74 match = re.match(r"^## (.+)", line) | 74 match = re.match(r"^## (.+)", line) |
75 if match: return match.group(1) | 75 if match: return match.group(1) |
76 raise Exception("Couldn't find curent branch.") # pragma: no cover | 76 raise Exception("Couldn't find curent branch.") # pragma: no cover |
77 | 77 |
78 @Strip | 78 @Strip |
79 def GitLog(self, n=0, format="", grep="", git_hash="", parent_hash="", | 79 def GitLog(self, n=0, format="", grep="", git_hash="", parent_hash="", |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 @Strip | 159 @Strip |
160 def GitSVNFindSVNRev(self, git_hash, branch=""): | 160 def GitSVNFindSVNRev(self, git_hash, branch=""): |
161 return self.Git(MakeArgs(["svn find-rev", git_hash, branch])) | 161 return self.Git(MakeArgs(["svn find-rev", git_hash, branch])) |
162 | 162 |
163 def GitSVNDCommit(self): | 163 def GitSVNDCommit(self): |
164 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None) | 164 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None) |
165 | 165 |
166 def GitSVNTag(self, version): | 166 def GitSVNTag(self, version): |
167 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)), | 167 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)), |
168 retry_on=lambda x: x is None) | 168 retry_on=lambda x: x is None) |
OLD | NEW |