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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 # Only delete the directory if there are no changes in it, and | 1121 # Only delete the directory if there are no changes in it, and |
1122 # delete_unversioned_trees is set to true. | 1122 # delete_unversioned_trees is set to true. |
1123 entries = [i.name for i in self.root.subtree(False) if i.url] | 1123 entries = [i.name for i in self.root.subtree(False) if i.url] |
1124 for entry, prev_url in self._ReadEntries().iteritems(): | 1124 for entry, prev_url in self._ReadEntries().iteritems(): |
1125 if not prev_url: | 1125 if not prev_url: |
1126 # entry must have been overridden via .gclient custom_deps | 1126 # entry must have been overridden via .gclient custom_deps |
1127 continue | 1127 continue |
1128 # Fix path separator on Windows. | 1128 # Fix path separator on Windows. |
1129 entry_fixed = entry.replace('/', os.path.sep) | 1129 entry_fixed = entry.replace('/', os.path.sep) |
1130 e_dir = os.path.join(self.root_dir, entry_fixed) | 1130 e_dir = os.path.join(self.root_dir, entry_fixed) |
| 1131 |
| 1132 def _IsParentOfAny(parent, path_list): |
| 1133 parent_plus_slash = parent + '/' |
| 1134 return any( |
| 1135 path[:len(parent_plus_slash)] == parent_plus_slash |
| 1136 for path in path_list) |
| 1137 |
1131 # Use entry and not entry_fixed there. | 1138 # Use entry and not entry_fixed there. |
1132 if entry not in entries and os.path.exists(e_dir): | 1139 if ((not any(path.startswith(entry + '/') for path in entries)) and |
| 1140 os.path.exists(e_dir)): |
1133 file_list = [] | 1141 file_list = [] |
1134 scm = gclient_scm.CreateSCM(prev_url, self.root_dir, entry_fixed) | 1142 scm = gclient_scm.CreateSCM(prev_url, self.root_dir, entry_fixed) |
1135 scm.status(self._options, [], file_list) | 1143 scm.status(self._options, [], file_list) |
1136 modified_files = file_list != [] | 1144 modified_files = file_list != [] |
1137 if (not self._options.delete_unversioned_trees or | 1145 if (not self._options.delete_unversioned_trees or |
1138 (modified_files and not self._options.force)): | 1146 (modified_files and not self._options.force)): |
1139 # There are modified files in this entry. Keep warning until | 1147 # There are modified files in this entry. Keep warning until |
1140 # removed. | 1148 # removed. |
1141 print(('\nWARNING: \'%s\' is no longer part of this client. ' | 1149 print(('\nWARNING: \'%s\' is no longer part of this client. ' |
1142 'It is recommended that you manually remove it.\n') % | 1150 'It is recommended that you manually remove it.\n') % |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1766 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1759 print >> sys.stderr, 'Error: %s' % str(e) | 1767 print >> sys.stderr, 'Error: %s' % str(e) |
1760 return 1 | 1768 return 1 |
1761 | 1769 |
1762 | 1770 |
1763 if '__main__' == __name__: | 1771 if '__main__' == __name__: |
1764 fix_encoding.fix_encoding() | 1772 fix_encoding.fix_encoding() |
1765 sys.exit(Main(sys.argv[1:])) | 1773 sys.exit(Main(sys.argv[1:])) |
1766 | 1774 |
1767 # vim: ts=2:sw=2:tw=80:et: | 1775 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |