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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 update files from SCM according to current configuration, | 931 update files from SCM according to current configuration, |
932 *for modules which have changed since last update or sync* | 932 *for modules which have changed since last update or sync* |
933 gclient sync --force | 933 gclient sync --force |
934 update files from SCM according to current configuration, for | 934 update files from SCM according to current configuration, for |
935 all modules (useful for recovering files deleted from local copy) | 935 all modules (useful for recovering files deleted from local copy) |
936 gclient sync --revision src@31000 | 936 gclient sync --revision src@31000 |
937 update src directory to r31000 | 937 update src directory to r31000 |
938 """) | 938 """) |
939 def CMDsync(parser, args): | 939 def CMDsync(parser, args): |
940 """Checkout/update all modules.""" | 940 """Checkout/update all modules.""" |
941 parser.add_option("--force", action="store_true", | 941 parser.add_option("-f", "--force", action="store_true", |
942 help="force update even for unchanged modules") | 942 help="force update even for unchanged modules") |
943 parser.add_option("--nohooks", action="store_true", | 943 parser.add_option("-n", "--nohooks", action="store_true", |
944 help="don't run hooks after the update is complete") | 944 help="don't run hooks after the update is complete") |
945 parser.add_option("-r", "--revision", action="append", | 945 parser.add_option("-r", "--revision", action="append", |
946 dest="revisions", metavar="REV", default=[], | 946 dest="revisions", metavar="REV", default=[], |
947 help="Enforces revision/hash for the solutions with the " | 947 help="Enforces revision/hash for the solutions with the " |
948 "format src@rev. The src@ part is optional and can be " | 948 "format src@rev. The src@ part is optional and can be " |
949 "skipped. -r can be used multiple times when .gclient " | 949 "skipped. -r can be used multiple times when .gclient " |
950 "has multiple solutions configured and will work even " | 950 "has multiple solutions configured and will work even " |
951 "if the src@ part is skipped.") | 951 "if the src@ part is skipped.") |
952 parser.add_option("--head", action="store_true", | 952 parser.add_option("-H", "--head", action="store_true", |
953 help="skips any safesync_urls specified in " | 953 help="skips any safesync_urls specified in " |
954 "configured solutions and sync to head instead") | 954 "configured solutions and sync to head instead") |
955 parser.add_option("--delete_unversioned_trees", action="store_true", | 955 parser.add_option("-D", "--delete_unversioned_trees", action="store_true", |
956 help="delete any unexpected unversioned trees " | 956 help="delete any unexpected unversioned trees " |
957 "that are in the checkout") | 957 "that are in the checkout") |
958 parser.add_option("--reset", action="store_true", | 958 parser.add_option("-R", "--reset", action="store_true", |
959 help="resets any local changes before updating (git only)") | 959 help="resets any local changes before updating (git only)") |
960 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", | 960 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", |
961 help="override deps for the specified (comma-separated) " | 961 help="override deps for the specified (comma-separated) " |
962 "platform(s); 'all' will process all deps_os " | 962 "platform(s); 'all' will process all deps_os " |
963 "references") | 963 "references") |
964 parser.add_option("--manually_grab_svn_rev", action="store_true", | 964 parser.add_option("-m", "--manually_grab_svn_rev", action="store_true", |
965 help="Skip svn up whenever possible by requesting " | 965 help="Skip svn up whenever possible by requesting " |
966 "actual HEAD revision from the repository") | 966 "actual HEAD revision from the repository") |
967 (options, args) = parser.parse_args(args) | 967 (options, args) = parser.parse_args(args) |
968 client = GClient.LoadCurrentConfig(options) | 968 client = GClient.LoadCurrentConfig(options) |
969 | 969 |
970 if not client: | 970 if not client: |
971 raise gclient_utils.Error("client not configured; see 'gclient config'") | 971 raise gclient_utils.Error("client not configured; see 'gclient config'") |
972 | 972 |
973 if options.revisions and options.head: | 973 if options.revisions and options.head: |
974 # TODO(maruel): Make it a parser.error if it doesn't break any builder. | 974 # TODO(maruel): Make it a parser.error if it doesn't break any builder. |
(...skipping 26 matching lines...) Expand all Loading... |
1001 print(client.ConfigContent()) | 1001 print(client.ConfigContent()) |
1002 return client.RunOnDeps('diff', args) | 1002 return client.RunOnDeps('diff', args) |
1003 | 1003 |
1004 | 1004 |
1005 def CMDrevert(parser, args): | 1005 def CMDrevert(parser, args): |
1006 """Revert all modifications in every dependencies.""" | 1006 """Revert all modifications in every dependencies.""" |
1007 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", | 1007 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", |
1008 help="override deps for the specified (comma-separated) " | 1008 help="override deps for the specified (comma-separated) " |
1009 "platform(s); 'all' will process all deps_os " | 1009 "platform(s); 'all' will process all deps_os " |
1010 "references") | 1010 "references") |
1011 parser.add_option("--nohooks", action="store_true", | 1011 parser.add_option("-n", "--nohooks", action="store_true", |
1012 help="don't run hooks after the revert is complete") | 1012 help="don't run hooks after the revert is complete") |
1013 (options, args) = parser.parse_args(args) | 1013 (options, args) = parser.parse_args(args) |
1014 # --force is implied. | 1014 # --force is implied. |
1015 options.force = True | 1015 options.force = True |
1016 client = GClient.LoadCurrentConfig(options) | 1016 client = GClient.LoadCurrentConfig(options) |
1017 if not client: | 1017 if not client: |
1018 raise gclient_utils.Error("client not configured; see 'gclient config'") | 1018 raise gclient_utils.Error("client not configured; see 'gclient config'") |
1019 return client.RunOnDeps('revert', args) | 1019 return client.RunOnDeps('revert', args) |
1020 | 1020 |
1021 | 1021 |
1022 def CMDrunhooks(parser, args): | 1022 def CMDrunhooks(parser, args): |
1023 """Runs hooks for files that have been modified in the local working copy.""" | 1023 """Runs hooks for files that have been modified in the local working copy.""" |
1024 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", | 1024 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", |
1025 help="override deps for the specified (comma-separated) " | 1025 help="override deps for the specified (comma-separated) " |
1026 "platform(s); 'all' will process all deps_os " | 1026 "platform(s); 'all' will process all deps_os " |
1027 "references") | 1027 "references") |
1028 parser.add_option("--force", action="store_true", default=True, | 1028 parser.add_option("-f", "--force", action="store_true", default=True, |
1029 help="Deprecated. No effect.") | 1029 help="Deprecated. No effect.") |
1030 (options, args) = parser.parse_args(args) | 1030 (options, args) = parser.parse_args(args) |
1031 client = GClient.LoadCurrentConfig(options) | 1031 client = GClient.LoadCurrentConfig(options) |
1032 if not client: | 1032 if not client: |
1033 raise gclient_utils.Error("client not configured; see 'gclient config'") | 1033 raise gclient_utils.Error("client not configured; see 'gclient config'") |
1034 if options.verbose: | 1034 if options.verbose: |
1035 # Print out the .gclient file. This is longer than if we just printed the | 1035 # Print out the .gclient file. This is longer than if we just printed the |
1036 # client dict, but more legible, and it might contain helpful comments. | 1036 # client dict, but more legible, and it might contain helpful comments. |
1037 print(client.ConfigContent()) | 1037 print(client.ConfigContent()) |
1038 options.force = True | 1038 options.force = True |
1039 options.nohooks = False | 1039 options.nohooks = False |
1040 return client.RunOnDeps('runhooks', args) | 1040 return client.RunOnDeps('runhooks', args) |
1041 | 1041 |
1042 | 1042 |
1043 def CMDrevinfo(parser, args): | 1043 def CMDrevinfo(parser, args): |
1044 """Outputs details for every dependencies.""" | 1044 """Outputs details for every dependencies.""" |
1045 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", | 1045 parser.add_option("--deps", dest="deps_os", metavar="OS_LIST", |
1046 help="override deps for the specified (comma-separated) " | 1046 help="override deps for the specified (comma-separated) " |
1047 "platform(s); 'all' will process all deps_os " | 1047 "platform(s); 'all' will process all deps_os " |
1048 "references") | 1048 "references") |
1049 parser.add_option("--snapshot", action="store_true", | 1049 parser.add_option("-s", "--snapshot", action="store_true", |
1050 help="create a snapshot file of the current " | 1050 help="create a snapshot file of the current " |
1051 "version of all repositories") | 1051 "version of all repositories") |
1052 (options, args) = parser.parse_args(args) | 1052 (options, args) = parser.parse_args(args) |
1053 client = GClient.LoadCurrentConfig(options) | 1053 client = GClient.LoadCurrentConfig(options) |
1054 if not client: | 1054 if not client: |
1055 raise gclient_utils.Error("client not configured; see 'gclient config'") | 1055 raise gclient_utils.Error("client not configured; see 'gclient config'") |
1056 client.PrintRevInfo() | 1056 client.PrintRevInfo() |
1057 return 0 | 1057 return 0 |
1058 | 1058 |
1059 | 1059 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 | 1126 |
1127 | 1127 |
1128 if "__main__" == __name__: | 1128 if "__main__" == __name__: |
1129 try: | 1129 try: |
1130 sys.exit(Main(sys.argv[1:])) | 1130 sys.exit(Main(sys.argv[1:])) |
1131 except gclient_utils.Error, e: | 1131 except gclient_utils.Error, e: |
1132 print >> sys.stderr, "Error: %s" % str(e) | 1132 print >> sys.stderr, "Error: %s" % str(e) |
1133 sys.exit(1) | 1133 sys.exit(1) |
1134 | 1134 |
1135 # vim: ts=2:sw=2:tw=80:et: | 1135 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |