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 """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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 continue | 741 continue |
742 # Fix path separator on Windows. | 742 # Fix path separator on Windows. |
743 entry_fixed = entry.replace('/', os.path.sep) | 743 entry_fixed = entry.replace('/', os.path.sep) |
744 e_dir = os.path.join(self.root_dir(), entry_fixed) | 744 e_dir = os.path.join(self.root_dir(), entry_fixed) |
745 # Use entry and not entry_fixed there. | 745 # Use entry and not entry_fixed there. |
746 if entry not in entries and os.path.exists(e_dir): | 746 if entry not in entries and os.path.exists(e_dir): |
747 file_list = [] | 747 file_list = [] |
748 scm = gclient_scm.CreateSCM(prev_url, self.root_dir(), entry_fixed) | 748 scm = gclient_scm.CreateSCM(prev_url, self.root_dir(), entry_fixed) |
749 scm.status(self._options, [], file_list) | 749 scm.status(self._options, [], file_list) |
750 modified_files = file_list != [] | 750 modified_files = file_list != [] |
751 if not self._options.delete_unversioned_trees or modified_files: | 751 if (not self._options.delete_unversioned_trees or |
752 (modified_files and not self._options.force)): | |
752 # There are modified files in this entry. Keep warning until | 753 # There are modified files in this entry. Keep warning until |
753 # removed. | 754 # removed. |
754 print(('\nWARNING: \'%s\' is no longer part of this client. ' | 755 print(('\nWARNING: \'%s\' is no longer part of this client. ' |
755 'It is recommended that you manually remove it.\n') % | 756 'It is recommended that you manually remove it.\n') % |
756 entry_fixed) | 757 entry_fixed) |
757 else: | 758 else: |
758 # Delete the entry | 759 # Delete the entry |
759 print('\n________ deleting \'%s\' in \'%s\'' % ( | 760 print('\n________ deleting \'%s\' in \'%s\'' % ( |
760 entry_fixed, self.root_dir())) | 761 entry_fixed, self.root_dir())) |
761 gclient_utils.RemoveDirectory(e_dir) | 762 gclient_utils.RemoveDirectory(e_dir) |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1037 help='Enforces revision/hash for the solutions with the ' | 1038 help='Enforces revision/hash for the solutions with the ' |
1038 'format src@rev. The src@ part is optional and can be ' | 1039 'format src@rev. The src@ part is optional and can be ' |
1039 'skipped. -r can be used multiple times when .gclient ' | 1040 'skipped. -r can be used multiple times when .gclient ' |
1040 'has multiple solutions configured and will work even ' | 1041 'has multiple solutions configured and will work even ' |
1041 'if the src@ part is skipped. Note that specifying ' | 1042 'if the src@ part is skipped. Note that specifying ' |
1042 '--revision means your safesync_url gets ignored.') | 1043 '--revision means your safesync_url gets ignored.') |
1043 parser.add_option('-H', '--head', action='store_true', | 1044 parser.add_option('-H', '--head', action='store_true', |
1044 help='skips any safesync_urls specified in ' | 1045 help='skips any safesync_urls specified in ' |
1045 'configured solutions and sync to head instead') | 1046 'configured solutions and sync to head instead') |
1046 parser.add_option('-D', '--delete_unversioned_trees', action='store_true', | 1047 parser.add_option('-D', '--delete_unversioned_trees', action='store_true', |
1047 help='delete any unexpected unversioned trees ' | 1048 help='delete any dependency that have been removed from ' |
1048 'that are in the checkout') | 1049 'last sync as long as there is no local modification. ' |
1050 'Coupled with --force, it will remove them even with ' | |
1051 'local modifications') | |
1049 parser.add_option('-R', '--reset', action='store_true', | 1052 parser.add_option('-R', '--reset', action='store_true', |
1050 help='resets any local changes before updating (git only)') | 1053 help='resets any local changes before updating (git only)') |
1051 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', | 1054 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', |
1052 help='override deps for the specified (comma-separated) ' | 1055 help='override deps for the specified (comma-separated) ' |
1053 'platform(s); \'all\' will process all deps_os ' | 1056 'platform(s); \'all\' will process all deps_os ' |
1054 'references') | 1057 'references') |
1055 parser.add_option('-m', '--manually_grab_svn_rev', action='store_true', | 1058 parser.add_option('-m', '--manually_grab_svn_rev', action='store_true', |
1056 help='Skip svn up whenever possible by requesting ' | 1059 help='Skip svn up whenever possible by requesting ' |
1057 'actual HEAD revision from the repository') | 1060 'actual HEAD revision from the repository') |
1058 (options, args) = parser.parse_args(args) | 1061 (options, args) = parser.parse_args(args) |
(...skipping 28 matching lines...) Expand all Loading... | |
1087 if not client: | 1090 if not client: |
1088 raise gclient_utils.Error('client not configured; see \'gclient config\'') | 1091 raise gclient_utils.Error('client not configured; see \'gclient config\'') |
1089 if options.verbose: | 1092 if options.verbose: |
1090 # Print out the .gclient file. This is longer than if we just printed the | 1093 # Print out the .gclient file. This is longer than if we just printed the |
1091 # client dict, but more legible, and it might contain helpful comments. | 1094 # client dict, but more legible, and it might contain helpful comments. |
1092 print(client.config_content) | 1095 print(client.config_content) |
1093 return client.RunOnDeps('diff', args) | 1096 return client.RunOnDeps('diff', args) |
1094 | 1097 |
1095 | 1098 |
1096 def CMDrevert(parser, args): | 1099 def CMDrevert(parser, args): |
1097 """Revert all modifications in every dependencies.""" | 1100 """Revert all modifications in every dependencies. |
1101 | |
1102 That's the nuclear option to get back to a 'clean' state. It removes anything | |
nsylvain
2010/11/11 20:33:39
nuclear? eh
| |
1103 that shows up in svn status.""" | |
1098 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', | 1104 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', |
1099 help='override deps for the specified (comma-separated) ' | 1105 help='override deps for the specified (comma-separated) ' |
1100 'platform(s); \'all\' will process all deps_os ' | 1106 'platform(s); \'all\' will process all deps_os ' |
1101 'references') | 1107 'references') |
1102 parser.add_option('-n', '--nohooks', action='store_true', | 1108 parser.add_option('-n', '--nohooks', action='store_true', |
1103 help='don\'t run hooks after the revert is complete') | 1109 help='don\'t run hooks after the revert is complete') |
1104 (options, args) = parser.parse_args(args) | 1110 (options, args) = parser.parse_args(args) |
1105 # --force is implied. | 1111 # --force is implied. |
1106 options.force = True | 1112 options.force = True |
1107 client = GClient.LoadCurrentConfig(options) | 1113 client = GClient.LoadCurrentConfig(options) |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1253 return CMDhelp(parser, argv) | 1259 return CMDhelp(parser, argv) |
1254 except gclient_utils.Error, e: | 1260 except gclient_utils.Error, e: |
1255 print >> sys.stderr, 'Error: %s' % str(e) | 1261 print >> sys.stderr, 'Error: %s' % str(e) |
1256 return 1 | 1262 return 1 |
1257 | 1263 |
1258 | 1264 |
1259 if '__main__' == __name__: | 1265 if '__main__' == __name__: |
1260 sys.exit(Main(sys.argv[1:])) | 1266 sys.exit(Main(sys.argv[1:])) |
1261 | 1267 |
1262 # vim: ts=2:sw=2:tw=80:et: | 1268 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |