[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] tolerate locally modified dirs on switch

From: Danil Shopyrin <danil.shopyrin_at_gmail.com>
Date: Thu, 14 Aug 2008 14:58:21 +0400

Hi all!

There is an annoying behavior in the switch command when there are
locally modified directories to delete. Use case is as follows:
* user creates a development branch to do some experiments;
* new folders are created and added to Subversion in the development
branch. There are some unversioned (and ignored) items in
  the added folders (intermediate compiler output files, for example);
* and when user wants to switch back to the trunk he/she gets the
following error from the switch command:
  'Won't delete locally modified directory';
* working copy becomes broken and it is needed to perform long and
nondeterministic (for me, at least) sequence of svn cleanup, svn up
  svn switch commands to heal the working copy.

The problem can be reproduced by the following script:
set REPOS_DIR=C:\test\db
set REPOS=file:///C:/test/db
set WC=C:\test\wc

rd /q /s %REPOS_DIR%
rd /q /s %WC%

svnadmin create %REPOS_DIR%
svn mkdir %REPOS%/branch1 -m ""
svn cp %REPOS%/branch1 %REPOS%/branch2 -m ""

svn co %REPOS%/branch1 %WC%
mkdir %WC%\dir
svn add %WC%\dir
svn ci -m "r1" %WC%

echo file >%WC%\dir\file

svn sw %REPOS%/branch2 %WC%

The better behavior is to leave locally modified directory unversioned
just like svn update command does. Here is a patch.

Please note that the patch doesn't introduce really new behavior. It
just makes switch command behavior more consistent with
other commands behavior.

The log message is as follows:
Make switch continue after deleting locally modified directories, as
it update and merge do.

* subversion/libsvn_wc/update_editor:
 (leftmod_error_chain): Remove unused helper.
 (do_entry_deletion): Ignore SVN_ERR_WC_LEFT_LOCAL_MOD error as it
 log.c:log_do_delete_entry() does.

* subversion/tests/cmdline/switch_tests.py:
 (tollerate_local_mods): New test.
 (test_list): Run the new test.

The patch itself is in attachment.

With best regards,
Danil Shopyrin
VisualSVN Team

To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-08-14 20:50:09 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.