Chromium Code Reviews| 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 """This scripts takes the path to a dep and a git or svn revision, and updates | 6 """This scripts takes the path to a dep and a git or svn revision, and updates |
|
Dirk Pranke
2015/05/20 20:03:51
Do we really want this script to support taking gi
ghost stip (do not use)
2015/05/20 23:08:16
Yeah, please update the doc here
M-A Ruel
2015/05/21 00:10:52
Done
M-A Ruel
2015/05/21 00:10:52
There is still sadly git-svn repositories still ma
| |
| 7 the parent repo's DEPS file with the corresponding git revision. Sample | 7 the parent repo's DEPS file with the corresponding git revision. Sample |
| 8 invocation: | 8 invocation: |
| 9 | 9 |
| 10 [chromium/src]$ roll-dep third_party/WebKit 12345 | 10 [chromium/src]$ roll-dep-svn third_party/WebKit 12345 |
| 11 | 11 |
| 12 After the script completes, the DEPS file will be dirty with the new revision. | 12 After the script completes, the DEPS file will be dirty with the new revision. |
| 13 The user can then: | 13 The user can then: |
| 14 | 14 |
| 15 $ git add DEPS | 15 $ git add DEPS |
| 16 $ git commit | 16 $ git commit |
| 17 """ | 17 """ |
| 18 | 18 |
| 19 import ast | 19 import ast |
| 20 import optparse | 20 import optparse |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 deps_file_dir = os.path.normpath(os.path.dirname(deps_file)) | 353 deps_file_dir = os.path.normpath(os.path.dirname(deps_file)) |
| 354 deps_file_root = Popen( | 354 deps_file_root = Popen( |
| 355 ['git', 'rev-parse', '--show-toplevel'], | 355 ['git', 'rev-parse', '--show-toplevel'], |
| 356 cwd=deps_file_dir, stdout=PIPE).communicate()[0].strip() | 356 cwd=deps_file_dir, stdout=PIPE).communicate()[0].strip() |
| 357 with open(os.path.join(deps_file_root, '.git', 'MERGE_MSG'), 'w') as fh: | 357 with open(os.path.join(deps_file_root, '.git', 'MERGE_MSG'), 'w') as fh: |
| 358 fh.write(commit_msg) | 358 fh.write(commit_msg) |
| 359 return 0 | 359 return 0 |
| 360 | 360 |
| 361 | 361 |
| 362 def main(argv): | 362 def main(argv): |
| 363 usage = 'Usage: roll_dep.py [options] <dep path> <rev> [ <DEPS file> ]' | 363 usage = 'Usage: roll-dep-svn [options] <dep path> <rev> [ <DEPS file> ]' |
| 364 parser = optparse.OptionParser(usage=usage, description=__doc__) | 364 parser = optparse.OptionParser(usage=usage, description=__doc__) |
| 365 parser.add_option('--no-verify-revision', | 365 parser.add_option('--no-verify-revision', |
| 366 help='Don\'t verify the revision passed in. This ' | 366 help='Don\'t verify the revision passed in. This ' |
| 367 'also skips adding an svn revision comment ' | 367 'also skips adding an svn revision comment ' |
| 368 'for git dependencies and requires the passed ' | 368 'for git dependencies and requires the passed ' |
| 369 'revision to be a git hash.', | 369 'revision to be a git hash.', |
| 370 default=False, action='store_true') | 370 default=False, action='store_true') |
| 371 options, args = parser.parse_args(argv) | 371 options, args = parser.parse_args(argv) |
| 372 if len(args) not in (2, 3): | 372 if len(args) not in (2, 3): |
| 373 parser.error('Expected either 2 or 3 positional parameters.') | 373 parser.error('Expected either 2 or 3 positional parameters.') |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 return 1 | 405 return 1 |
| 406 return update_deps(deps_file, dep_path, dep_name, git_rev, comment) | 406 return update_deps(deps_file, dep_path, dep_name, git_rev, comment) |
| 407 | 407 |
| 408 | 408 |
| 409 if __name__ == '__main__': | 409 if __name__ == '__main__': |
| 410 try: | 410 try: |
| 411 sys.exit(main(sys.argv[1:])) | 411 sys.exit(main(sys.argv[1:])) |
| 412 except KeyboardInterrupt: | 412 except KeyboardInterrupt: |
| 413 sys.stderr.write('interrupted\n') | 413 sys.stderr.write('interrupted\n') |
| 414 sys.exit(1) | 414 sys.exit(1) |
| OLD | NEW |