If both -R and -D are specified when updating, remove all untracked directories
This is required to avoid the need to clobber the bots when moving a directory
to deps/. Currently, the directory in question is likely to remain in the
working copy, despite having been removed, due to the presence of untracked
files. This causes the checkout from deps/ to fail.
With this change, when both --reset and --delete_unversioned_trees are
specified, the the directory in question will be removed from the working copy,
thereby allowing the copy in deps/ to be checked out correctly.
Note that untracked directories which are explicitly ignored (ie in .gitignore
or svn:ignore) will not be removed.
Note that this was previously landed in http://codereview.chromium.org/9348054
but reverted due to problems with symlinks in the chromeos build.
BUG=112887, chromium-os:20759
Review URL: http://codereview.chromium.org/9404014
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@122300 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index a9b14bf..6267dc2 100644
--- a/gclient.py
+++ b/gclient.py
@@ -1300,10 +1300,14 @@
help='skips any safesync_urls specified in '
'configured solutions and sync to head instead')
parser.add_option('-D', '--delete_unversioned_trees', action='store_true',
- help='delete any dependency that have been removed from '
- 'last sync as long as there is no local modification. '
- 'Coupled with --force, it will remove them even with '
- 'local modifications')
+ help='Deletes from the working copy any dependencies that '
+ 'have been removed since the last sync, as long as '
+ 'there are no local modifications. When used with '
+ '--force, such dependencies are removed even if they '
+ 'have local modifications. When used with --reset, '
+ 'all untracked directories are removed from the '
+ 'working copy, exclusing those which are explicitly '
+ 'ignored in the repository.')
parser.add_option('-R', '--reset', action='store_true',
help='resets any local changes before updating (git only)')
parser.add_option('-M', '--merge', action='store_true',
@@ -1368,6 +1372,8 @@
(options, args) = parser.parse_args(args)
# --force is implied.
options.force = True
+ options.reset = False
+ options.delete_unversioned_trees = False
client = GClient.LoadCurrentConfig(options)
if not client:
raise gclient_utils.Error('client not configured; see \'gclient config\'')