Commit cdcee80c authored by ajwong@chromium.org's avatar ajwong@chromium.org

Modify gclient to only delete unversioned trees during an update if

the --delete_unversioned flag is specified.  This only affects the update
command.  Reverts will still delete the unversioned tree.

Review URL: http://codereview.chromium.org/125147

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@19021 0039d316-1c4b-4281-b951-d872f2087c98
parent 76256af3
...@@ -1347,14 +1347,14 @@ class GClient(object): ...@@ -1347,14 +1347,14 @@ class GClient(object):
self._RunHooks(command, file_list, is_using_git) self._RunHooks(command, file_list, is_using_git)
if command == 'update': if command == 'update':
# notify the user if there is an orphaned entry in their working copy. # Notify the user if there is an orphaned entry in their working copy.
# TODO(darin): we should delete this directory manually if it doesn't # Only delete the directory if there are no changes in it, and
# have any changes in it. # delete_unversioned_trees is set to true.
prev_entries = self._ReadEntries() prev_entries = self._ReadEntries()
for entry in prev_entries: for entry in prev_entries:
e_dir = os.path.join(self._root_dir, entry) e_dir = os.path.join(self._root_dir, entry)
if entry not in entries and os.path.exists(e_dir): if entry not in entries and os.path.exists(e_dir):
if CaptureSVNStatus(e_dir): if not options.delete_unversioned_trees or CaptureSVNStatus(e_dir):
# There are modified files in this entry # There are modified files in this entry
entries[entry] = None # Keep warning until removed. entries[entry] = None # Keep warning until removed.
print("\nWARNING: \"%s\" is no longer part of this client. " print("\nWARNING: \"%s\" is no longer part of this client. "
...@@ -1704,6 +1704,10 @@ def Main(argv): ...@@ -1704,6 +1704,10 @@ def Main(argv):
option_parser.add_option("", "--head", action="store_true", default=False, option_parser.add_option("", "--head", action="store_true", default=False,
help=("skips any safesync_urls specified in " help=("skips any safesync_urls specified in "
"configured solutions")) "configured solutions"))
option_parser.add_option("", "--delete_unversioned_trees",
action="store_true", default=False,
help=("on update, delete any unexpected "
"unversioned trees that are in the checkout"))
if len(argv) < 2: if len(argv) < 2:
# Users don't need to be told to use the 'help' command. # Users don't need to be told to use the 'help' command.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment