Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 # Once all the dependencies have been processed, it's now safe to run the | 1127 # Once all the dependencies have been processed, it's now safe to run the |
| 1128 # hooks. | 1128 # hooks. |
| 1129 if not self._options.nohooks: | 1129 if not self._options.nohooks: |
| 1130 self.RunHooksRecursively(self._options) | 1130 self.RunHooksRecursively(self._options) |
| 1131 | 1131 |
| 1132 if command == 'update': | 1132 if command == 'update': |
| 1133 # Notify the user if there is an orphaned entry in their working copy. | 1133 # Notify the user if there is an orphaned entry in their working copy. |
| 1134 # Only delete the directory if there are no changes in it, and | 1134 # Only delete the directory if there are no changes in it, and |
| 1135 # delete_unversioned_trees is set to true. | 1135 # delete_unversioned_trees is set to true. |
| 1136 entries = [i.name for i in self.root.subtree(False) if i.url] | 1136 entries = [i.name for i in self.root.subtree(False) if i.url] |
| 1137 full_entries = [os.path.join(self.root_dir, e.replace('/', os.path.sep)) | |
| 1138 for e in entries] | |
|
M-A Ruel
2013/05/06 17:07:05
alignment
| |
| 1139 | |
| 1137 for entry, prev_url in self._ReadEntries().iteritems(): | 1140 for entry, prev_url in self._ReadEntries().iteritems(): |
| 1138 if not prev_url: | 1141 if not prev_url: |
| 1139 # entry must have been overridden via .gclient custom_deps | 1142 # entry must have been overridden via .gclient custom_deps |
| 1140 continue | 1143 continue |
| 1141 # Fix path separator on Windows. | 1144 # Fix path separator on Windows. |
| 1142 entry_fixed = entry.replace('/', os.path.sep) | 1145 entry_fixed = entry.replace('/', os.path.sep) |
| 1143 e_dir = os.path.join(self.root_dir, entry_fixed) | 1146 e_dir = os.path.join(self.root_dir, entry_fixed) |
| 1144 | 1147 |
| 1145 def _IsParentOfAny(parent, path_list): | 1148 def _IsParentOfAny(parent, path_list): |
| 1146 parent_plus_slash = parent + '/' | 1149 parent_plus_slash = parent + '/' |
| 1147 return any( | 1150 return any( |
| 1148 path[:len(parent_plus_slash)] == parent_plus_slash | 1151 path[:len(parent_plus_slash)] == parent_plus_slash |
| 1149 for path in path_list) | 1152 for path in path_list) |
| 1150 | 1153 |
| 1151 # Use entry and not entry_fixed there. | 1154 # Use entry and not entry_fixed there. |
| 1152 if (entry not in entries and | 1155 if (entry not in entries and |
| 1153 (not any(path.startswith(entry + '/') for path in entries)) and | 1156 (not any(path.startswith(entry + '/') for path in entries)) and |
| 1154 os.path.exists(e_dir)): | 1157 os.path.exists(e_dir)): |
| 1158 scm = gclient_scm.CreateSCM(prev_url, self.root_dir, entry_fixed) | |
| 1159 | |
| 1160 # Check to see if this directory is now part of a higher-up checkout. | |
| 1161 if scm.GetCheckoutRoot() in full_entries: | |
|
M-A Ruel
2013/05/06 17:07:05
Add a logging.info() here.
Also, I'm not sure it
Dirk Pranke
2013/05/06 19:44:35
I don't follow this comment. Can you give a specif
| |
| 1162 continue | |
| 1163 | |
| 1155 file_list = [] | 1164 file_list = [] |
| 1156 scm = gclient_scm.CreateSCM(prev_url, self.root_dir, entry_fixed) | |
| 1157 scm.status(self._options, [], file_list) | 1165 scm.status(self._options, [], file_list) |
| 1158 modified_files = file_list != [] | 1166 modified_files = file_list != [] |
| 1159 if (not self._options.delete_unversioned_trees or | 1167 if (not self._options.delete_unversioned_trees or |
| 1160 (modified_files and not self._options.force)): | 1168 (modified_files and not self._options.force)): |
| 1161 # There are modified files in this entry. Keep warning until | 1169 # There are modified files in this entry. Keep warning until |
| 1162 # removed. | 1170 # removed. |
| 1163 print(('\nWARNING: \'%s\' is no longer part of this client. ' | 1171 print(('\nWARNING: \'%s\' is no longer part of this client. ' |
| 1164 'It is recommended that you manually remove it.\n') % | 1172 'It is recommended that you manually remove it.\n') % |
| 1165 entry_fixed) | 1173 entry_fixed) |
| 1166 else: | 1174 else: |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1783 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1791 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 1784 print >> sys.stderr, 'Error: %s' % str(e) | 1792 print >> sys.stderr, 'Error: %s' % str(e) |
| 1785 return 1 | 1793 return 1 |
| 1786 | 1794 |
| 1787 | 1795 |
| 1788 if '__main__' == __name__: | 1796 if '__main__' == __name__: |
| 1789 fix_encoding.fix_encoding() | 1797 fix_encoding.fix_encoding() |
| 1790 sys.exit(Main(sys.argv[1:])) | 1798 sys.exit(Main(sys.argv[1:])) |
| 1791 | 1799 |
| 1792 # vim: ts=2:sw=2:tw=80:et: | 1800 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |