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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 it will be removed from the list and the list will be extended | 42 it will be removed from the list and the list will be extended |
43 by the list of matching files. | 43 by the list of matching files. |
44 | 44 |
45 Example: | 45 Example: |
46 hooks = [ | 46 hooks = [ |
47 { "pattern": "\\.(gif|jpe?g|pr0n|png)$", | 47 { "pattern": "\\.(gif|jpe?g|pr0n|png)$", |
48 "action": ["python", "image_indexer.py", "--all"]}, | 48 "action": ["python", "image_indexer.py", "--all"]}, |
49 ] | 49 ] |
50 """ | 50 """ |
51 | 51 |
52 __version__ = "0.6.1" | 52 __version__ = "0.6.2" |
53 | 53 |
54 import copy | 54 import copy |
55 import logging | 55 import logging |
56 import optparse | 56 import optparse |
57 import os | 57 import os |
58 import posixpath | 58 import posixpath |
59 import pprint | 59 import pprint |
60 import re | 60 import re |
61 import sys | 61 import sys |
62 import urlparse | 62 import urlparse |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 # specify an alternate relpath for the given URL. | 983 # specify an alternate relpath for the given URL. |
984 name = options.name | 984 name = options.name |
985 safesync_url = '' | 985 safesync_url = '' |
986 if len(args) > 1: | 986 if len(args) > 1: |
987 safesync_url = args[1] | 987 safesync_url = args[1] |
988 client.SetDefaultConfig(name, base_url, safesync_url) | 988 client.SetDefaultConfig(name, base_url, safesync_url) |
989 client.SaveConfig() | 989 client.SaveConfig() |
990 return 0 | 990 return 0 |
991 | 991 |
992 | 992 |
993 def CMDexport(parser, args): | |
994 """Wrapper for svn export for all managed directories.""" | |
995 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', | |
996 help='override deps for the specified (comma-separated) ' | |
997 'platform(s); \'all\' will process all deps_os ' | |
998 'references') | |
999 (options, args) = parser.parse_args(args) | |
1000 if len(args) != 1: | |
1001 raise gclient_utils.Error('Need directory name') | |
1002 client = GClient.LoadCurrentConfig(options) | |
1003 | |
1004 if not client: | |
1005 raise gclient_utils.Error('client not configured; see \'gclient config\'') | |
1006 | |
1007 if options.verbose: | |
1008 # Print out the .gclient file. This is longer than if we just printed the | |
1009 # client dict, but more legible, and it might contain helpful comments. | |
1010 print(client.config_content) | |
1011 return client.RunOnDeps('export', args) | |
1012 | |
1013 | |
1014 @attr('epilog', """Example: | 993 @attr('epilog', """Example: |
1015 gclient pack > patch.txt | 994 gclient pack > patch.txt |
1016 generate simple patch for configured client and dependences | 995 generate simple patch for configured client and dependences |
1017 """) | 996 """) |
1018 def CMDpack(parser, args): | 997 def CMDpack(parser, args): |
1019 """Generate a patch which can be applied at the root of the tree. | 998 """Generate a patch which can be applied at the root of the tree. |
1020 | 999 |
1021 Internally, runs 'svn diff'/'git diff' on each checked out module and | 1000 Internally, runs 'svn diff'/'git diff' on each checked out module and |
1022 dependencies, and performs minimal postprocessing of the output. The | 1001 dependencies, and performs minimal postprocessing of the output. The |
1023 resulting patch is printed to stdout and can be applied to a freshly | 1002 resulting patch is printed to stdout and can be applied to a freshly |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1285 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1307 print >> sys.stderr, 'Error: %s' % str(e) | 1286 print >> sys.stderr, 'Error: %s' % str(e) |
1308 return 1 | 1287 return 1 |
1309 | 1288 |
1310 | 1289 |
1311 if '__main__' == __name__: | 1290 if '__main__' == __name__: |
1312 fix_encoding.fix_encoding() | 1291 fix_encoding.fix_encoding() |
1313 sys.exit(Main(sys.argv[1:])) | 1292 sys.exit(Main(sys.argv[1:])) |
1314 | 1293 |
1315 # vim: ts=2:sw=2:tw=80:et: | 1294 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |