You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matt Doran <ma...@papercut.biz> on 2005/12/01 12:24:04 UTC

Messed up WC after switch (SVN 1.2.3)

Hi all,

I've been using svn daily for over a year ... but only been working with 
branches more recently.  Today I encountered a problem switching from a 
feature branch back to trunk.   The branch added a new subproject with 
it's own build output (that was svn:ignore'd).   After committing my 
work I tried to 'switch' back to trunk that's when the trouble started.  
Although I originally encountered this using the latest TSVN release, I 
have been able to reproduce it using svn 1.2.3 on Debian (repro recipe 
attached).

The switch fails with the unfriendly message:

    svn: Won't delete locally modified directory '.'
    svn: Left locally modified or unversioned files


That really confused me.  For one the '.' indicated that the current 
directory was the modified (when it wasn't), but in fact the problem was 
deeper down.   Not knowing what the problem was I tried a number of 
things to fix (try switching again, try switching back, revert, update, 
cleanup, etc) .... nothing worked.   And the errors got worse ...

        svn: Working copy '<foldername>' is missing or not locked

I eventually figured out that the problem was due to some unversioned 
and ignored files in the new subproject on the branch.  And I don't 
remember how I fix the WC .... but it wasn't obvious.   

I've attached a recipe that reproduces this problem (and my unhelpful 
attempts to clean things up).  I've also attached the output of the script.

Could someone explain how I could avoid this situation in the future.... 
and resolve it if it happens again?

Should this be raised as an issue?  In the very least the initial error 
that is displayed could be improved to make it clearer what went wrong, 
and how to fix.....

Cheers,
Matt





Re: Messed up WC after switch (SVN 1.2.3)

Posted by Erik Huelsmann <eh...@gmail.com>.
On 12/7/05, Matt Doran <ma...@papercut.biz> wrote:
>  Hi Erik,
>
>  Will do.
>
>  I'd just like to clarify what I should make the focus of the raised issue?
>
>  The fact that the particular repro recipe I produced breaks the WC?  e.g.
> "Switch from branch that contains new directory with ignores breaks WC"

'Switch can break working copy' would be a good first choice. I think
it needs a better summary, but I have no idea what it should be
atm....

>  Or a way to fix up the WC after it gets broken like this?

I'll try to figure out what makes you unable to recover it. After I do
that, I can tell you how to recover from it.

bye,

Erik.

Re: Messed up WC after switch (SVN 1.2.3)

Posted by Matt Doran <ma...@papercut.biz>.
Hi Erik,

Will do.  

I'd just like to clarify what I should make the focus of the raised issue? 

The fact that the particular repro recipe I produced breaks the WC?  
e.g. "Switch from branch that contains new directory with ignores breaks WC"

Or a way to fix up the WC after it gets broken like this?

Cheers,

Matt Doran
PaperCut Software Pty. Ltd.
Phone:   +61 (3) 9571 1151
E-mail:  matt.doran@papercut.biz
Profile: http://www.papercut.biz/company.htm#matt
Blog:    http://blogs.papercutsoftware.com/matt.doran/



Erik Huelsmann wrote:

>On 12/6/05, Matt Doran <ma...@papercut.biz> wrote:
>  
>
>>Hi,
>>
>>Does anyone know the best way to recover your WC after the switch fails half
>>way though (like I've encountered below)?
>>
>>Toby Johnson ... also asked a similar question and hasn't been answered:
>>http://svn.haxx.se/users/archive-2005-12/0165.shtml
>>    
>>
>
>Matt,
>
>Could you log this in the issue tracker as a DEFECT for the libsvn_wc
>subcomponent? Thanks!
>
>bye,
>
>Erik.
>
>  
>
>>Matt Doran wrote:
>>Hi all,
>>
>>I've been using svn daily for over a year ... but only been working with
>>branches more recently.  Today I encountered a problem switching from a
>>feature branch back to trunk.   The branch added a new subproject with it's
>>own build output (that was svn:ignore'd).   After committing my work I tried
>>to 'switch' back to trunk that's when the trouble started.  Although I
>>originally encountered this using the latest TSVN release, I have been able
>>to reproduce it using svn 1.2.3 on Debian (repro recipe attached).
>>
>>The switch fails with the unfriendly message:
>>svn: Won't delete locally modified directory '.'
>>svn: Left locally modified or unversioned files
>>
>>That really confused me.  For one the '.' indicated that the current
>>directory was the modified (when it wasn't), but in fact the problem was
>>deeper down.   Not knowing what the problem was I tried a number of things
>>to fix (try switching again, try switching back, revert, update, cleanup,
>>etc) .... nothing worked.   And the errors got worse ...
>>
>>        svn: Working copy '<foldername>' is missing or not locked
>>
>>I eventually figured out that the problem was due to some unversioned and
>>ignored files in the new subproject on the branch.  And I don't remember how
>>I fix the WC .... but it wasn't obvious.
>>
>>I've attached a recipe that reproduces this problem (and my unhelpful
>>attempts to clean things up).  I've also attached the output of the script.
>>
>>Could someone explain how I could avoid this situation in the future.... and
>>resolve it if it happens again?
>>
>>Should this be raised as an issue?  In the very least the initial error that
>>is displayed could be improved to make it clearer what went wrong, and how
>>to fix.....
>>
>>Cheers,
>>Matt
>>
>>    
>>

Re: Messed up WC after switch (SVN 1.2.3)

Posted by Erik Huelsmann <eh...@gmail.com>.
On 12/6/05, Matt Doran <ma...@papercut.biz> wrote:
> Hi,
>
> Does anyone know the best way to recover your WC after the switch fails half
> way though (like I've encountered below)?
>
> Toby Johnson ... also asked a similar question and hasn't been answered:
> http://svn.haxx.se/users/archive-2005-12/0165.shtml

Matt,

Could you log this in the issue tracker as a DEFECT for the libsvn_wc
subcomponent? Thanks!

bye,

Erik.

> Matt Doran wrote:
> Hi all,
>
> I've been using svn daily for over a year ... but only been working with
> branches more recently.  Today I encountered a problem switching from a
> feature branch back to trunk.   The branch added a new subproject with it's
> own build output (that was svn:ignore'd).   After committing my work I tried
> to 'switch' back to trunk that's when the trouble started.  Although I
> originally encountered this using the latest TSVN release, I have been able
> to reproduce it using svn 1.2.3 on Debian (repro recipe attached).
>
> The switch fails with the unfriendly message:
> svn: Won't delete locally modified directory '.'
> svn: Left locally modified or unversioned files
>
> That really confused me.  For one the '.' indicated that the current
> directory was the modified (when it wasn't), but in fact the problem was
> deeper down.   Not knowing what the problem was I tried a number of things
> to fix (try switching again, try switching back, revert, update, cleanup,
> etc) .... nothing worked.   And the errors got worse ...
>
>         svn: Working copy '<foldername>' is missing or not locked
>
> I eventually figured out that the problem was due to some unversioned and
> ignored files in the new subproject on the branch.  And I don't remember how
> I fix the WC .... but it wasn't obvious.
>
> I've attached a recipe that reproduces this problem (and my unhelpful
> attempts to clean things up).  I've also attached the output of the script.
>
> Could someone explain how I could avoid this situation in the future.... and
> resolve it if it happens again?
>
> Should this be raised as an issue?  In the very least the initial error that
> is displayed could be improved to make it clearer what went wrong, and how
> to fix.....
>
> Cheers,
> Matt
>

Re: Messed up WC after switch (SVN 1.2.3)

Posted by Matt Doran <ma...@papercut.biz>.
Hi,

Does anyone know the best way to recover your WC after the switch fails 
half way though (like I've encountered below)?

Toby Johnson ... also asked a similar question and hasn't been 
answered:  http://svn.haxx.se/users/archive-2005-12/0165.shtml

Thanks,
Matt


Matt Doran wrote:
> Hi all,
>
> I've been using svn daily for over a year ... but only been working 
> with branches more recently.  Today I encountered a problem switching 
> from a feature branch back to trunk.   The branch added a new 
> subproject with it's own build output (that was svn:ignore'd).   After 
> committing my work I tried to 'switch' back to trunk that's when the 
> trouble started.  Although I originally encountered this using the 
> latest TSVN release, I have been able to reproduce it using svn 1.2.3 
> on Debian (repro recipe attached).
>
> The switch fails with the unfriendly message:
>
>     svn: Won't delete locally modified directory '.'
>     svn: Left locally modified or unversioned files
>
>
> That really confused me.  For one the '.' indicated that the current 
> directory was the modified (when it wasn't), but in fact the problem 
> was deeper down.   Not knowing what the problem was I tried a number 
> of things to fix (try switching again, try switching back, revert, 
> update, cleanup, etc) .... nothing worked.   And the errors got worse ...
>
>         svn: Working copy '<foldername>' is missing or not locked
>
> I eventually figured out that the problem was due to some unversioned 
> and ignored files in the new subproject on the branch.  And I don't 
> remember how I fix the WC .... but it wasn't obvious.   
>
> I've attached a recipe that reproduces this problem (and my unhelpful 
> attempts to clean things up).  I've also attached the output of the 
> script.
>
> Could someone explain how I could avoid this situation in the 
> future.... and resolve it if it happens again?
>
> Should this be raised as an issue?  In the very least the initial 
> error that is displayed could be improved to make it clearer what went 
> wrong, and how to fix.....
>
> Cheers,
> Matt
>
>
>
>
> ------------------------------------------------------------------------
>
> $ switch-repro.sh
> 1.2.3
>
> Committed revision 1.
> Checked out revision 1.
>
> Committed revision 2.
> At revision 2.
> A         subproj
> A         subproj/src.c
> property 'svn:ignore' set on 'subproj'
> Adding         subproj
> Adding         subproj/src.c
> Transmitting file data .
> Committed revision 3.
> svn: Won't delete locally modified directory '.'
> svn: Left locally modified or unversioned files
> try reverting ... nope
> try updating ... nope
> svn: Working copy 'subproj' is missing or not locked
> try switching again ... nope
> svn: Working copy 'subproj' is missing or not locked
> try switching back ... nope
> svn: Working copy 'subproj' is missing or not locked
> delete offending dir ... now I am in real trouble
> and the switch still fails
> svn: Working copy 'subproj' is missing or not locked
> try cleanup ... this does not help
> svn: 'subproj' is not a working copy directory
> $
> ------------------------------------------------------------------------
>
> #!/bin/sh
>
> svn --version -q
>
> svnadmin create repo
>
> # Create a project
> REPO=file://`pwd`/repo
> svn mkdir $REPO/trunk -m "create trunk"
> svn co $REPO/trunk wc
>
> cd wc
>
> # Create a branch where we are adding a new subproject
> svn copy $REPO/trunk $REPO/branch -m "create branch"
>
> # Start working on a new branch
> svn switch $REPO/branch
>
> # Create a new subproject
> mkdir subproj
> echo source > subproj/src.c
> svn add subproj
>
> # Simulates creating build output
> mkdir subproj/build-output
> svn ps "svn:ignore" build-output subproj
>
> svn commit -m "add new subproject"
>
> # Switch back to trunk ... boom
> svn switch $REPO/trunk
>
> # At this point the working copy is stuffed, try various fixes
> echo try reverting  ... nope
> svn revert .
>
> echo try updating  ... nope
> svn up
>
> echo try switching again ... nope
> svn switch $REPO/trunk
>
> echo try switching back ... nope
> svn switch $REPO/branch
>
> echo delete offending dir ... now I am in real trouble
> rm -Rf subprj/build-output
>
> echo and the switch still fails
> svn switch $REPO/trunk
>
> echo try cleanup ... this does not help
> svn cleanup
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org

Re: Messed up WC after switch (SVN 1.2.3)

Posted by Eric Hanchrow <of...@blarg.net>.
>>>>> "Matt" == Matt Doran <ma...@papercut.biz> writes:

    Matt> Could someone explain how I could avoid this situation in
    Matt> the future....  and resolve it if it happens again?

Here's what I often do: after checking in, and before switching, I
delete every file that isn't under subversion's control, like this:

        svn status --no-ignore . | egrep '^(\?|I)' | cut -c8- | xargs rm -rf

    Matt> In the very least the initial error that is displayed could
    Matt> be improved 

In my experience, misleading error messages are the single worst thing
about subversion.
-- 
Keaton, Chaplin, Garbo - let them now make room for Gromit.
        A. O. Scott, in The New York Times


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org