| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """A wrapper script to manage a set of client modules in different SCM. | 6 """A wrapper script to manage a set of client modules in different SCM. |
| 7 | 7 |
| 8 This script is intended to be used to help basic management of client | 8 This script is intended to be used to help basic management of client |
| 9 program sources residing in one or more Subversion modules and Git | 9 program sources residing in one or more Subversion modules and Git |
| 10 repositories, along with other modules it depends on, also in Subversion or Git, | 10 repositories, along with other modules it depends on, also in Subversion or Git, |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 provided, then configuration is read from a specified Subversion server | 827 provided, then configuration is read from a specified Subversion server |
| 828 URL. | 828 URL. |
| 829 """ | 829 """ |
| 830 parser.add_option("--spec", | 830 parser.add_option("--spec", |
| 831 help="create a gclient file containing the provided " | 831 help="create a gclient file containing the provided " |
| 832 "string. Due to Cygwin/Python brokenness, it " | 832 "string. Due to Cygwin/Python brokenness, it " |
| 833 "probably can't contain any newlines.") | 833 "probably can't contain any newlines.") |
| 834 parser.add_option("--name", | 834 parser.add_option("--name", |
| 835 help="overrides the default name for the solution") | 835 help="overrides the default name for the solution") |
| 836 (options, args) = parser.parse_args(args) | 836 (options, args) = parser.parse_args(args) |
| 837 if len(args) < 1 and not options.spec: | 837 if ((options.spec and args) or len(args) > 2 or |
| 838 raise gclient_utils.Error("required argument missing; see 'gclient help " | 838 (not options.spec and not args)): |
| 839 "config'") | 839 parser.error('Inconsistent arguments. Use either --spec or one or 2 args') |
| 840 |
| 840 if os.path.exists(options.config_filename): | 841 if os.path.exists(options.config_filename): |
| 841 raise gclient_utils.Error("%s file already exists in the current directory" | 842 raise gclient_utils.Error("%s file already exists in the current directory" |
| 842 % options.config_filename) | 843 % options.config_filename) |
| 843 client = GClient('.', options) | 844 client = GClient('.', options) |
| 844 if options.spec: | 845 if options.spec: |
| 845 client.SetConfig(options.spec) | 846 client.SetConfig(options.spec) |
| 846 else: | 847 else: |
| 847 base_url = args[0].rstrip('/') | 848 base_url = args[0].rstrip('/') |
| 848 if not options.name: | 849 if not options.name: |
| 849 name = base_url.split("/")[-1] | 850 name = base_url.split("/")[-1] |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 | 1108 |
| 1108 | 1109 |
| 1109 if "__main__" == __name__: | 1110 if "__main__" == __name__: |
| 1110 try: | 1111 try: |
| 1111 sys.exit(Main(sys.argv[1:])) | 1112 sys.exit(Main(sys.argv[1:])) |
| 1112 except gclient_utils.Error, e: | 1113 except gclient_utils.Error, e: |
| 1113 print >> sys.stderr, "Error: %s" % str(e) | 1114 print >> sys.stderr, "Error: %s" % str(e) |
| 1114 sys.exit(1) | 1115 sys.exit(1) |
| 1115 | 1116 |
| 1116 # vim: ts=2:sw=2:tw=80:et: | 1117 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |