OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. |
7 | 7 |
8 Files | 8 Files |
9 .gclient : Current client configuration, written by 'config' command. | 9 .gclient : Current client configuration, written by 'config' command. |
10 Format is a Python script defining 'solutions', a list whose | 10 Format is a Python script defining 'solutions', a list whose |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 parser.add_option('--deps-file', default='DEPS', | 974 parser.add_option('--deps-file', default='DEPS', |
975 help='overrides the default name for the DEPS file for the' | 975 help='overrides the default name for the DEPS file for the' |
976 'main solutions and all sub-dependencies') | 976 'main solutions and all sub-dependencies') |
977 parser.add_option('--git-deps', action='store_true', | 977 parser.add_option('--git-deps', action='store_true', |
978 help='sets the deps file to ".DEPS.git" instead of "DEPS"') | 978 help='sets the deps file to ".DEPS.git" instead of "DEPS"') |
979 (options, args) = parser.parse_args(args) | 979 (options, args) = parser.parse_args(args) |
980 if ((options.spec and args) or len(args) > 2 or | 980 if ((options.spec and args) or len(args) > 2 or |
981 (not options.spec and not args)): | 981 (not options.spec and not args)): |
982 parser.error('Inconsistent arguments. Use either --spec or one or 2 args') | 982 parser.error('Inconsistent arguments. Use either --spec or one or 2 args') |
983 | 983 |
984 if os.path.exists(options.config_filename): | |
985 raise gclient_utils.Error('%s file already exists in the current directory' | |
986 % options.config_filename) | |
987 client = GClient('.', options) | 984 client = GClient('.', options) |
988 if options.spec: | 985 if options.spec: |
989 client.SetConfig(options.spec) | 986 client.SetConfig(options.spec) |
990 else: | 987 else: |
991 base_url = args[0].rstrip('/') | 988 base_url = args[0].rstrip('/') |
992 if not options.name: | 989 if not options.name: |
993 name = base_url.split('/')[-1] | 990 name = base_url.split('/')[-1] |
994 if name.endswith('.git'): | 991 if name.endswith('.git'): |
995 name = name[:-4] | 992 name = name[:-4] |
996 else: | 993 else: |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1302 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1306 print >> sys.stderr, 'Error: %s' % str(e) | 1303 print >> sys.stderr, 'Error: %s' % str(e) |
1307 return 1 | 1304 return 1 |
1308 | 1305 |
1309 | 1306 |
1310 if '__main__' == __name__: | 1307 if '__main__' == __name__: |
1311 fix_encoding.fix_encoding() | 1308 fix_encoding.fix_encoding() |
1312 sys.exit(Main(sys.argv[1:])) | 1309 sys.exit(Main(sys.argv[1:])) |
1313 | 1310 |
1314 # vim: ts=2:sw=2:tw=80:et: | 1311 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |