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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 if command: | 1150 if command: |
1151 return command(options, args) | 1151 return command(options, args) |
1152 else: | 1152 else: |
1153 raise gclient_utils.Error("unknown subcommand '%s'; see 'gclient help'" % | 1153 raise gclient_utils.Error("unknown subcommand '%s'; see 'gclient help'" % |
1154 command) | 1154 command) |
1155 | 1155 |
1156 | 1156 |
1157 def Main(argv): | 1157 def Main(argv): |
1158 option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT, | 1158 option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT, |
1159 version=__version__) | 1159 version=__version__) |
1160 option_parser.disable_interspersed_args() | 1160 option_parser.add_option("--force", action="store_true", |
1161 option_parser.add_option("", "--force", action="store_true", default=False, | 1161 help="(update/sync only) force update even " |
1162 help=("(update/sync only) force update even " | 1162 "for modules which haven't changed") |
1163 "for modules which haven't changed")) | 1163 option_parser.add_option("--nohooks", action="store_true", |
1164 option_parser.add_option("", "--nohooks", action="store_true", default=False, | 1164 help="(update/sync/revert only) prevent the hooks " |
1165 help=("(update/sync/revert only) prevent the hooks fr
om " | 1165 "from running") |
1166 "running")) | 1166 option_parser.add_option("--revision", action="append", dest="revisions", |
1167 option_parser.add_option("", "--revision", action="append", dest="revisions", | |
1168 metavar="REV", default=[], | 1167 metavar="REV", default=[], |
1169 help=("(update/sync only) sync to a specific " | 1168 help="(update/sync only) sync to a specific " |
1170 "revision, can be used multiple times for " | 1169 "revision, can be used multiple times for " |
1171 "each solution, e.g. --revision=src@123, " | 1170 "each solution, e.g. --revision=src@123, " |
1172 "--revision=internal@32")) | 1171 "--revision=internal@32") |
1173 option_parser.add_option("", "--deps", default=None, dest="deps_os", | 1172 option_parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", |
1174 metavar="OS_LIST", | 1173 help="(update/sync only) sync deps for the " |
1175 help=("(update/sync only) sync deps for the " | 1174 "specified (comma-separated) platform(s); " |
1176 "specified (comma-separated) platform(s); " | 1175 "'all' will sync all platforms") |
1177 "'all' will sync all platforms")) | 1176 option_parser.add_option("--reset", action="store_true", |
1178 option_parser.add_option("", "--reset", action="store_true", default=False, | 1177 help="(update/sync only) resets any local changes " |
1179 help=("(update/sync only) resets any local changes " | 1178 "before updating (git only)") |
1180 "before updating (git only)")) | 1179 option_parser.add_option("--spec", |
1181 option_parser.add_option("", "--spec", default=None, | 1180 help="(config only) create a gclient file " |
1182 help=("(config only) create a gclient file " | 1181 "containing the provided string") |
1183 "containing the provided string")) | |
1184 option_parser.add_option("-v", "--verbose", action="count", default=0, | 1182 option_parser.add_option("-v", "--verbose", action="count", default=0, |
1185 help="produce additional output for diagnostics") | 1183 help="produce additional output for diagnostics") |
1186 option_parser.add_option("", "--manually_grab_svn_rev", action="store_true", | 1184 option_parser.add_option("--manually_grab_svn_rev", action="store_true", |
1187 default=False, | |
1188 help="Skip svn up whenever possible by requesting " | 1185 help="Skip svn up whenever possible by requesting " |
1189 "actual HEAD revision from the repository") | 1186 "actual HEAD revision from the repository") |
1190 option_parser.add_option("", "--head", action="store_true", default=False, | 1187 option_parser.add_option("--head", action="store_true", |
1191 help=("skips any safesync_urls specified in " | 1188 help="skips any safesync_urls specified in " |
1192 "configured solutions")) | 1189 "configured solutions") |
1193 option_parser.add_option("", "--delete_unversioned_trees", | 1190 option_parser.add_option("--delete_unversioned_trees", action="store_true", |
1194 action="store_true", default=False, | 1191 help="on update, delete any unexpected " |
1195 help=("on update, delete any unexpected " | 1192 "unversioned trees that are in the checkout") |
1196 "unversioned trees that are in the checkout")) | 1193 option_parser.add_option("--snapshot", action="store_true", |
1197 option_parser.add_option("", "--snapshot", action="store_true", default=False, | 1194 help="(revinfo only), create a snapshot file " |
1198 help=("(revinfo only), create a snapshot file " | 1195 "of the current version of all repositories") |
1199 "of the current version of all repositories")) | 1196 option_parser.add_option("--name", |
1200 option_parser.add_option("", "--name", | |
1201 help="specify alternate relative solution path") | 1197 help="specify alternate relative solution path") |
1202 option_parser.add_option("", "--gclientfile", default=None, | 1198 option_parser.add_option("--gclientfile", metavar="FILENAME", |
1203 metavar="FILENAME", | 1199 help="specify an alternate .gclient file") |
1204 help=("specify an alternate .gclient file")) | |
1205 | 1200 |
1206 if len(argv) < 2: | 1201 if len(argv) < 2: |
1207 # Users don't need to be told to use the 'help' command. | 1202 # Users don't need to be told to use the 'help' command. |
1208 option_parser.print_help() | 1203 option_parser.print_help() |
1209 return 1 | 1204 return 1 |
1210 # Add manual support for --version as first argument. | 1205 # Add manual support for --version as first argument. |
1211 if argv[1] == '--version': | 1206 if argv[1] == '--version': |
1212 option_parser.print_version() | 1207 option_parser.print_version() |
1213 return 0 | 1208 return 0 |
1214 | 1209 |
(...skipping 24 matching lines...) Expand all Loading... |
1239 | 1234 |
1240 if "__main__" == __name__: | 1235 if "__main__" == __name__: |
1241 try: | 1236 try: |
1242 result = Main(sys.argv) | 1237 result = Main(sys.argv) |
1243 except gclient_utils.Error, e: | 1238 except gclient_utils.Error, e: |
1244 print >> sys.stderr, "Error: %s" % str(e) | 1239 print >> sys.stderr, "Error: %s" % str(e) |
1245 result = 1 | 1240 result = 1 |
1246 sys.exit(result) | 1241 sys.exit(result) |
1247 | 1242 |
1248 # vim: ts=2:sw=2:tw=80:et: | 1243 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |