Changed "gclient sync -D" logic to compare against the expected DEPS version
Also add a better warning if 'gclient sync -D' fails due to a modified file.
I've tested this code via deleting a DEP and running gclient sync -D.
Bug: 981149
Change-Id: I97035ac238d163ccb1684c3ee423c223ed0f6299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891830
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
diff --git a/gclient.py b/gclient.py
index 102cd43..f6bb822 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1687,9 +1687,16 @@
should_recurse=False,
relative=None,
condition=None))
- print('\nWARNING: \'%s\' is no longer part of this client.\n'
- 'It is recommended that you manually remove it or use '
- '\'gclient sync -D\' next time.' % entry_fixed)
+ if modified_files and self._options.delete_unversioned_trees:
+ print('\nWARNING: \'%s\' is no longer part of this client.\n'
+ 'Despite running \'gclient sync -D\' no action was taken '
+ 'as there are modifications.\nIt is recommended you revert '
+ 'all changes or run \'gclient sync -D --force\' next '
+ 'time.' % entry_fixed)
+ else:
+ print('\nWARNING: \'%s\' is no longer part of this client.\n'
+ 'It is recommended that you manually remove it or use '
+ '\'gclient sync -D\' next time.' % entry_fixed)
else:
# Delete the entry
print('\n________ deleting \'%s\' in \'%s\'' % (