From cdcee80cd808685c13e4b0735fd058fb395297f2 Mon Sep 17 00:00:00 2001 From: "ajwong@chromium.org" Date: Tue, 23 Jun 2009 15:30:42 +0000 Subject: [PATCH] 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 --- gclient.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gclient.py b/gclient.py index 76373f084..90d7e1cd1 100755 --- a/gclient.py +++ b/gclient.py @@ -1347,14 +1347,14 @@ class GClient(object): self._RunHooks(command, file_list, is_using_git) if command == 'update': - # 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 - # have any changes in it. + # Notify the user if there is an orphaned entry in their working copy. + # Only delete the directory if there are no changes in it, and + # delete_unversioned_trees is set to true. prev_entries = self._ReadEntries() for entry in prev_entries: e_dir = os.path.join(self._root_dir, entry) 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 entries[entry] = None # Keep warning until removed. print("\nWARNING: \"%s\" is no longer part of this client. " @@ -1704,6 +1704,10 @@ def Main(argv): option_parser.add_option("", "--head", action="store_true", default=False, help=("skips any safesync_urls specified in " "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: # Users don't need to be told to use the 'help' command.