OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright 2008 Google Inc. All Rights Reserved. | 3 # Copyright 2008 Google Inc. All Rights Reserved. |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 Raises: | 885 Raises: |
886 Error: if client isn't configured properly. | 886 Error: if client isn't configured properly. |
887 """ | 887 """ |
888 client = GClient.LoadCurrentConfig(options) | 888 client = GClient.LoadCurrentConfig(options) |
889 if not client: | 889 if not client: |
890 raise Error("client not configured; see 'gclient config'") | 890 raise Error("client not configured; see 'gclient config'") |
891 if options.verbose: | 891 if options.verbose: |
892 # Print out the .gclient file. This is longer than if we just printed the | 892 # Print out the .gclient file. This is longer than if we just printed the |
893 # client dict, but more legible, and it might contain helpful comments. | 893 # client dict, but more legible, and it might contain helpful comments. |
894 print(client.ConfigContent()) | 894 print(client.ConfigContent()) |
895 options.verbose = True | |
896 return client.RunOnDeps('cleanup', args) | 895 return client.RunOnDeps('cleanup', args) |
897 | 896 |
898 | 897 |
899 def DoConfig(options, args): | 898 def DoConfig(options, args): |
900 """Handle the config subcommand. | 899 """Handle the config subcommand. |
901 | 900 |
902 Args: | 901 Args: |
903 options: If options.spec set, a string providing contents of config file. | 902 options: If options.spec set, a string providing contents of config file. |
904 args: The command line args. If spec is not set, | 903 args: The command line args. If spec is not set, |
905 then args[0] is a string URL to get for config file. | 904 then args[0] is a string URL to get for config file. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 Raises: | 963 Raises: |
965 Error: if client isn't configured properly. | 964 Error: if client isn't configured properly. |
966 """ | 965 """ |
967 client = GClient.LoadCurrentConfig(options) | 966 client = GClient.LoadCurrentConfig(options) |
968 if not client: | 967 if not client: |
969 raise Error("client not configured; see 'gclient config'") | 968 raise Error("client not configured; see 'gclient config'") |
970 if options.verbose: | 969 if options.verbose: |
971 # Print out the .gclient file. This is longer than if we just printed the | 970 # Print out the .gclient file. This is longer than if we just printed the |
972 # client dict, but more legible, and it might contain helpful comments. | 971 # client dict, but more legible, and it might contain helpful comments. |
973 print(client.ConfigContent()) | 972 print(client.ConfigContent()) |
974 options.verbose = True | |
975 return client.RunOnDeps('pack', args) | 973 return client.RunOnDeps('pack', args) |
976 | 974 |
977 | 975 |
978 def DoStatus(options, args): | 976 def DoStatus(options, args): |
979 """Handle the status subcommand. | 977 """Handle the status subcommand. |
980 | 978 |
981 Raises: | 979 Raises: |
982 Error: if client isn't configured properly. | 980 Error: if client isn't configured properly. |
983 """ | 981 """ |
984 client = GClient.LoadCurrentConfig(options) | 982 client = GClient.LoadCurrentConfig(options) |
985 if not client: | 983 if not client: |
986 raise Error("client not configured; see 'gclient config'") | 984 raise Error("client not configured; see 'gclient config'") |
987 if options.verbose: | 985 if options.verbose: |
988 # Print out the .gclient file. This is longer than if we just printed the | 986 # Print out the .gclient file. This is longer than if we just printed the |
989 # client dict, but more legible, and it might contain helpful comments. | 987 # client dict, but more legible, and it might contain helpful comments. |
990 print(client.ConfigContent()) | 988 print(client.ConfigContent()) |
991 options.verbose = True | |
992 return client.RunOnDeps('status', args) | 989 return client.RunOnDeps('status', args) |
993 | 990 |
994 | 991 |
995 def DoUpdate(options, args): | 992 def DoUpdate(options, args): |
996 """Handle the update and sync subcommands. | 993 """Handle the update and sync subcommands. |
997 | 994 |
998 Raises: | 995 Raises: |
999 Error: if client isn't configured properly. | 996 Error: if client isn't configured properly. |
1000 """ | 997 """ |
1001 client = GClient.LoadCurrentConfig(options) | 998 client = GClient.LoadCurrentConfig(options) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 Raises: | 1033 Raises: |
1037 Error: if client isn't configured properly. | 1034 Error: if client isn't configured properly. |
1038 """ | 1035 """ |
1039 client = GClient.LoadCurrentConfig(options) | 1036 client = GClient.LoadCurrentConfig(options) |
1040 if not client: | 1037 if not client: |
1041 raise Error("client not configured; see 'gclient config'") | 1038 raise Error("client not configured; see 'gclient config'") |
1042 if options.verbose: | 1039 if options.verbose: |
1043 # Print out the .gclient file. This is longer than if we just printed the | 1040 # Print out the .gclient file. This is longer than if we just printed the |
1044 # client dict, but more legible, and it might contain helpful comments. | 1041 # client dict, but more legible, and it might contain helpful comments. |
1045 print(client.ConfigContent()) | 1042 print(client.ConfigContent()) |
1046 options.verbose = True | |
1047 return client.RunOnDeps('diff', args) | 1043 return client.RunOnDeps('diff', args) |
1048 | 1044 |
1049 | 1045 |
1050 def DoRevert(options, args): | 1046 def DoRevert(options, args): |
1051 """Handle the revert subcommand. | 1047 """Handle the revert subcommand. |
1052 | 1048 |
1053 Raises: | 1049 Raises: |
1054 Error: if client isn't configured properly. | 1050 Error: if client isn't configured properly. |
1055 """ | 1051 """ |
1056 client = GClient.LoadCurrentConfig(options) | 1052 client = GClient.LoadCurrentConfig(options) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 | 1185 |
1190 if "__main__" == __name__: | 1186 if "__main__" == __name__: |
1191 try: | 1187 try: |
1192 result = Main(sys.argv) | 1188 result = Main(sys.argv) |
1193 except Error, e: | 1189 except Error, e: |
1194 print >> sys.stderr, "Error: %s" % str(e) | 1190 print >> sys.stderr, "Error: %s" % str(e) |
1195 result = 1 | 1191 result = 1 |
1196 sys.exit(result) | 1192 sys.exit(result) |
1197 | 1193 |
1198 # vim: ts=2:sw=2:tw=80:et: | 1194 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |