OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 | 6 |
7 """Merge Skia into Android.""" | 7 """Merge Skia into Android.""" |
8 | 8 |
9 | 9 |
10 import os | 10 import os |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 | 49 |
50 | 50 |
51 class MergeIntoAndroid(BuildStep): | 51 class MergeIntoAndroid(BuildStep): |
52 """BuildStep which merges Skia into Android, with a generated Android.mk and | 52 """BuildStep which merges Skia into Android, with a generated Android.mk and |
53 SkUserConfig.h""" | 53 SkUserConfig.h""" |
54 | 54 |
55 def _Run(self): | 55 def _Run(self): |
56 with misc.ChDir(EXTERNAL_SKIA): | 56 with misc.ChDir(EXTERNAL_SKIA): |
57 # Check to see whether there is an upstream yet. | 57 # Check to see whether there is an upstream yet. |
58 if not UPSTREAM_REMOTE_NAME in shell_utils.run([GIT, 'remote', 'show']): | 58 if not UPSTREAM_REMOTE_NAME in shell_utils.run([GIT, 'remote', 'show']): |
59 shell_utils.run([GIT, 'remote', 'add', UPSTREAM_REMOTE_NAME, | 59 try: |
60 SKIA_REPO_URL]) | 60 shell_utils.run([GIT, 'remote', 'add', UPSTREAM_REMOTE_NAME, |
61 SKIA_REPO_URL]) | |
62 except shell_utils.CommandFailedException: | |
borenet
2014/06/05 18:40:44
It'd probably be a good idea to do something like
scroggo
2014/06/05 18:53:08
Done.
| |
63 # Accept this error. If it failed for a reason other than the | |
64 # remote already existing, we'll see the error when we attempt to do | |
65 # a git fetch. | |
66 print ('%s was already added. Why did it not show in git remote' | |
67 ' show?' % UPSTREAM_REMOTE_NAME) | |
61 | 68 |
62 # Update the upstream remote. | 69 # Update the upstream remote. |
63 shell_utils.run([GIT, 'fetch', UPSTREAM_REMOTE_NAME]) | 70 shell_utils.run([GIT, 'fetch', UPSTREAM_REMOTE_NAME]) |
64 | 71 |
65 # Create a stack of commits to submit, one at a time, until we reach a | 72 # Create a stack of commits to submit, one at a time, until we reach a |
66 # commit that has already been merged. | 73 # commit that has already been merged. |
67 commit_stack = [] | 74 commit_stack = [] |
68 head = git_utils.ShortHash('HEAD') | 75 head = git_utils.ShortHash('HEAD') |
69 | 76 |
70 print 'HEAD is at %s' % head | 77 print 'HEAD is at %s' % head |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 RepoAbandon(LOCAL_BRANCH_NAME) | 179 RepoAbandon(LOCAL_BRANCH_NAME) |
173 raise BuildStepFailure('git push failed!') | 180 raise BuildStepFailure('git push failed!') |
174 | 181 |
175 # Our branch is no longer needed. Remove it. | 182 # Our branch is no longer needed. Remove it. |
176 shell_utils.run([REPO, 'sync', '-j32', '.']) | 183 shell_utils.run([REPO, 'sync', '-j32', '.']) |
177 shell_utils.run([REPO, 'prune', '.']) | 184 shell_utils.run([REPO, 'prune', '.']) |
178 | 185 |
179 | 186 |
180 if '__main__' == __name__: | 187 if '__main__' == __name__: |
181 sys.exit(BuildStep.RunBuildStep(MergeIntoAndroid)) | 188 sys.exit(BuildStep.RunBuildStep(MergeIntoAndroid)) |
OLD | NEW |