Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: gclient.py

Issue 14583004: Don't delete directories that have been superseded by a broader checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Rebase onto latest master. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index f71eccc4c3d412ed8e09b47ed7771fb86d4d681c..5b159edb0442639b8f656ceb2e25b28e3e1a5e9d 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1134,6 +1134,9 @@ solutions = [
# Only delete the directory if there are no changes in it, and
# delete_unversioned_trees is set to true.
entries = [i.name for i in self.root.subtree(False) if i.url]
+ full_entries = [os.path.join(self.root_dir, e.replace('/', os.path.sep))
+ for e in entries]
+
for entry, prev_url in self._ReadEntries().iteritems():
if not prev_url:
# entry must have been overridden via .gclient custom_deps
@@ -1152,8 +1155,15 @@ solutions = [
if (entry not in entries and
(not any(path.startswith(entry + '/') for path in entries)) and
os.path.exists(e_dir)):
- file_list = []
scm = gclient_scm.CreateSCM(prev_url, self.root_dir, entry_fixed)
+
+ # Check to see if this directory is now part of a higher-up checkout.
+ if scm.GetCheckoutRoot() in full_entries:
+ logging.info('%s is part of a higher level checkout, not '
+ 'removing.', scm.GetCheckoutRoot())
+ continue
+
+ file_list = []
scm.status(self._options, [], file_list)
modified_files = file_list != []
if (not self._options.delete_unversioned_trees or
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698