You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by james coleman <ja...@dspsrv.com> on 2007/07/11 14:47:52 UTC

svn switch problem - cannot switch from ''unclean'' checkout

Hello,

We had a bit of a problem with using svn switch.
If doing a switch and there are unversioned (maybe ignored) items in the checkout
then you can get errors and end up with an unusable repository.
We now keep a ''pristine'' clean checkout of any trunk or branch that is worked off of
and update it then copy and switch when we need to checkout.

I think this is this issue:
http://subversion.tigris.org/issues/show_bug.cgi?id=2505
http://subversion.tigris.org/issues/show_bug.cgi?id=2466

The bugs there last had activity July 2006 so I don't think they're in line to be
fixed?

Do many large projects with lots of parallel development and branches use svn?
I wonder are people seeing this issue and giving up on using svn switch?
I was surprised this isn't better known? Or is it?

I think any project that made use of branches could benefit from having this
documented. A "bugfix" and better error would be nice also in time :)
It would be very nice if there was a note in FAQ or manual on svn switch.
If people agree this is an issue we could submit some content for that.
For now I'd like to hear what you think.

The switch is used at sites remote to the svn server to avoid doing a checkout
every time a developer moves to working in another branch.
Move to another branch is done frequently enough as all work is done on branches
using Trac tickets.

I think the switch problem is a puzzling one as to me it seems natural that if
an svn status reported that there were no changes to versioned files then a
svn switch would do the right thing and warn and move unversioned files out
of the way. The need to do switch only from pristine checkout is also not
mentioned in svn manual.

Thanks,

James.

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Russ <rs...@istandfor.com>.
I've gotten the obstructed update many times, but I don't think it ever hoard my wc. I believe the fix is to move the offending directories to a temp folder outside the wc and then repeat the switch.  After the switch completes, the directories can be copied back to the wc. 

Russ
Sent wirelessly via BlackBerry from T-Mobile.

-----Original Message-----
From: Abhinandan Jain <ja...@helios.jpl.nasa.gov>

Date: Thu, 12 Jul 2007 18:27:05 
To:users@subversion.tigris.org
Subject:  Re: svn switch problem - cannot switch from ''unclean'' checkout

We use branches extensively and switches from branches with new
directories fail often. However the error we get is something like
"Obstructed update: ...." and the working directory is left in a completely
hosed state.

The recovery process has been to delete the working directory and
start with a new checkout. However having unversioned files in the new
checkout does not appear to cause a problem. I imagine this is the
same problem even though the error message is different. This is with
svn 1.4.3.

Abhi


On Fri, Jul 13, 2007 at 01:47:59AM +0100, james coleman wrote:
> Karl Fogel wrote:
> >james coleman <ja...@dspsrv.com> writes:
> >>Here is the text of the FAQ entry I think would work:
> >
> >Thanks, I think this is worth having in the FAQ.  Can you send it to
> >dev@ as a patch, using the instructions at
> >
> >   http://subversion.tigris.org/mailing-list-guidelines.html#patches
>
> Thanks Karl, I've been composing my submission for a while now :-P :)
> Wondering what mime type Thunderbird will think a .patch is?
> Content-Type: text/x-patch;   good. :)
>
> >
> >See comments below...
> >
> >>Why doesn't svn switch work in some cases?
> >>
> >>In some cases where there are unversioned (and maybe ignored) items
> >>in the working copy then you can get errors and end up with an
> >>unusable working copy. The more complex the changes on branch and trunk
> >>the more likely this is. See issue 2505.
> >
> >If you could provide some examples of local changes that are *not*
> >likely to interfere with switch, that would help; adding other
> >examples of changes that are likely to interfere would be great too.
>
> I didn't want to delve into detail and confuse people but Hmmm, yes.
> Seeing the exact error svn reports might make people searching for it hit
> the FAQ entry.
>
>
> One scenario:
>
> If any directory has been moved or renamed between the branches then
> anything unversioned in there will cause a problem. A switch requires that
> the
> directory doesn't exist after the switch so what to do with unversioned
> content?
> svn plays it safe and doesn't want to delete it.
>
> This is recoverable from actually, you have a half-switched working copy.
> You can rm the directory left behind (now also unversioned without .svn) and
> then run the svn switch again.
>
> If multiple things have been renamed the switch will trip up and break on
> each
> one so cleaning unversioned files would help.
>
> wc/$ svn switch $SVNROOT/foobar/branches/br1
> wc/$ mkdir foo
> wc/$ svn add foo
> wc/$ svn ci -m"add dir foo" foo
> wc/$ touch foo/unversioned_file
> wc/$ svn switch $SVNROOT/foobar/branches/br2
> svn: Won't delete locally modified directory '.'
> svn: Left locally modified or unversioned files
>
> # to recover:
>
> wc/$ svn status
> !      .
>     S  foo.c
> ~      foo
>
> wc/$ rm -rf foo
> wc/$ svn switch
>
> wc/$ svn up
> svn: Directory 'foo/.svn' containing working copy admin area is missing
>
> wc/$ svn switch $SVNROOT/foobar/branches/br2
> D    foo
>  U   .
> Updated to revision 19.
>
>
>
> It is the first case listed by bug #2466 though I think.
> The error message is confusing and the user did not know what the error was
> telling them.
> The user did an svn revert which then put the working copy in broken state.
> It could do with a FAQ entry too:
> What does svn switch error "svn: Won't delete locally modified directory
> '.'" mean?
>
>
>
> Actually!
>
>
>  ............
>
>
>   Hmmmmmmmmmmmmmmmmmmmmmmm.
>
>
> I'm wondering is this example all there is to #2505?
> A confusing error followed by wrong corrective action then useless working
> copy.
> http://subversion.tigris.org/issues/show_bug.cgi?id=2505
>
> It could be.  Both recipies in #2505 and #2466 could have been
> recovered from by removing the offending unversioned files and
> continuing the svn switch.
> And I did not know you could recover like this until starting to
> investigate this.
>
> Now there could be a nastier issue lurking here.
> But after thinking about this so much I'm beginning to think this _could_
> be all there
> is to the issue.
>
>
> If so it could be fixed by getting svn to fix error and direct user to rm
> all unversioned files and continue the script.
> It would be nice if there was a --force or --allow-delete-unversioned or
> something
> which would make svn brutally delete things in the way of a switch.
>
>
> Actually I'm wrecked and it's 1:30am here so I'm going to collapse to bed.
> :-7
> I could be completely delusional right now so will leave it here for now.
>
> This is taking me a while as I've started testing this more.
> I think I'll comment on 2505 about this. Tomorrow.
> I'll test and stop cleaning before I svn switch and see if I can recover
> every time.
>  (Two dirty switches I started between branches that had problems before I
>  have
>   now recovered from.)
>
>
> >
> >Remember, the reader will be asking themselves "Am I in trouble or
> >not?"  Anything we can do to help them know the answer to that
> >question is good.
> >
> >>A switch from a pristine clean checkout always works. There are two
> >>ways of working if you are using svn switch as part of your development
> >>process:
> >>
> >>   1. Fully clean your working copy of unversioned (including ignored)
> >>      files before switch.
> >>      WARNING! This deletes all unversioned dirs/files.
> >>      Be VERY sure that you do not need anything that will be removed.
> >>
> >>          alias svn-unversioned='svn status --no-ignore | grep "^[I?]" |
> >>          sed 's/^[I?]//''
> >>          alias svn-clean-wc='svn-unversioned |xargs rm -rf'
> >
> >Just show the commands as commands; aliasing mechanisms may differ
> >from shell to shell, and some people don't know what aliases are.
>
> Okay.
> I also see in contrib/client-side/svn-clean
> But it's a good few lines of perl and I'm thinking the simpler the better.
> Maybe these one-liners fit in contrib?
>
> >
> >-Karl
> >
>
> Sheesh. :-7  And thanks Karl.
>
> James.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org

--
Abhinandan Jain, Ph.D.
Dynamics and Real-Time Simulation (DARTS) Lab
Mobilty and Robotic Systems Section
Jet Propulsion Laboratory
4800 Oak Grove Drive, Pasadena, CA 91109
(818)-354-3412	  (818)-393-5007 (fax)

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Abhinandan Jain <ja...@helios.jpl.nasa.gov>.
We use branches extensively and switches from branches with new
directories fail often. However the error we get is something like
"Obstructed update: ...." and the working directory is left in a completely
hosed state.

The recovery process has been to delete the working directory and
start with a new checkout. However having unversioned files in the new
checkout does not appear to cause a problem. I imagine this is the
same problem even though the error message is different. This is with
svn 1.4.3.

Abhi


On Fri, Jul 13, 2007 at 01:47:59AM +0100, james coleman wrote:
> Karl Fogel wrote:
> >james coleman <ja...@dspsrv.com> writes:
> >>Here is the text of the FAQ entry I think would work:
> >
> >Thanks, I think this is worth having in the FAQ.  Can you send it to
> >dev@ as a patch, using the instructions at
> >
> >   http://subversion.tigris.org/mailing-list-guidelines.html#patches
> 
> Thanks Karl, I've been composing my submission for a while now :-P :)
> Wondering what mime type Thunderbird will think a .patch is?
> Content-Type: text/x-patch;   good. :)
> 
> >
> >See comments below...
> >
> >>Why doesn't svn switch work in some cases?
> >>
> >>In some cases where there are unversioned (and maybe ignored) items
> >>in the working copy then you can get errors and end up with an
> >>unusable working copy. The more complex the changes on branch and trunk
> >>the more likely this is. See issue 2505.
> >
> >If you could provide some examples of local changes that are *not*
> >likely to interfere with switch, that would help; adding other
> >examples of changes that are likely to interfere would be great too.
> 
> I didn't want to delve into detail and confuse people but Hmmm, yes.
> Seeing the exact error svn reports might make people searching for it hit 
> the FAQ entry.
> 
> 
> One scenario:
> 
> If any directory has been moved or renamed between the branches then
> anything unversioned in there will cause a problem. A switch requires that 
> the
> directory doesn't exist after the switch so what to do with unversioned 
> content?
> svn plays it safe and doesn't want to delete it.
> 
> This is recoverable from actually, you have a half-switched working copy.
> You can rm the directory left behind (now also unversioned without .svn) and
> then run the svn switch again.
> 
> If multiple things have been renamed the switch will trip up and break on 
> each
> one so cleaning unversioned files would help.
> 
> wc/$ svn switch $SVNROOT/foobar/branches/br1
> wc/$ mkdir foo
> wc/$ svn add foo
> wc/$ svn ci -m"add dir foo" foo
> wc/$ touch foo/unversioned_file
> wc/$ svn switch $SVNROOT/foobar/branches/br2
> svn: Won't delete locally modified directory '.'
> svn: Left locally modified or unversioned files
> 
> # to recover:
> 
> wc/$ svn status
> !      .
>     S  foo.c
> ~      foo
> 
> wc/$ rm -rf foo
> wc/$ svn switch
> 
> wc/$ svn up
> svn: Directory 'foo/.svn' containing working copy admin area is missing
> 
> wc/$ svn switch $SVNROOT/foobar/branches/br2
> D    foo
>  U   .
> Updated to revision 19.
> 
> 
> 
> It is the first case listed by bug #2466 though I think.
> The error message is confusing and the user did not know what the error was 
> telling them.
> The user did an svn revert which then put the working copy in broken state.
> It could do with a FAQ entry too:
> What does svn switch error "svn: Won't delete locally modified directory 
> '.'" mean?
> 
> 
> 
> Actually!
> 
> 
>  ............
> 
> 
>   Hmmmmmmmmmmmmmmmmmmmmmmm.
> 
> 
> I'm wondering is this example all there is to #2505?
> A confusing error followed by wrong corrective action then useless working 
> copy.
> http://subversion.tigris.org/issues/show_bug.cgi?id=2505
> 
> It could be.  Both recipies in #2505 and #2466 could have been
> recovered from by removing the offending unversioned files and
> continuing the svn switch.
> And I did not know you could recover like this until starting to 
> investigate this.
> 
> Now there could be a nastier issue lurking here.
> But after thinking about this so much I'm beginning to think this _could_ 
> be all there
> is to the issue.
> 
> 
> If so it could be fixed by getting svn to fix error and direct user to rm
> all unversioned files and continue the script.
> It would be nice if there was a --force or --allow-delete-unversioned or 
> something
> which would make svn brutally delete things in the way of a switch.
> 
> 
> Actually I'm wrecked and it's 1:30am here so I'm going to collapse to bed. 
> :-7
> I could be completely delusional right now so will leave it here for now.
> 
> This is taking me a while as I've started testing this more.
> I think I'll comment on 2505 about this. Tomorrow.
> I'll test and stop cleaning before I svn switch and see if I can recover 
> every time.
>  (Two dirty switches I started between branches that had problems before I 
>  have
>   now recovered from.)
> 
> 
> >
> >Remember, the reader will be asking themselves "Am I in trouble or
> >not?"  Anything we can do to help them know the answer to that
> >question is good.
> >
> >>A switch from a pristine clean checkout always works. There are two
> >>ways of working if you are using svn switch as part of your development
> >>process:
> >>
> >>   1. Fully clean your working copy of unversioned (including ignored)
> >>      files before switch.
> >>      WARNING! This deletes all unversioned dirs/files.
> >>      Be VERY sure that you do not need anything that will be removed.
> >>
> >>          alias svn-unversioned='svn status --no-ignore | grep "^[I?]" | 
> >>          sed 's/^[I?]//''
> >>          alias svn-clean-wc='svn-unversioned |xargs rm -rf'
> >
> >Just show the commands as commands; aliasing mechanisms may differ
> >from shell to shell, and some people don't know what aliases are.
> 
> Okay.
> I also see in contrib/client-side/svn-clean
> But it's a good few lines of perl and I'm thinking the simpler the better.
> Maybe these one-liners fit in contrib?
> 
> >
> >-Karl
> >
> 
> Sheesh. :-7  And thanks Karl.
> 
> James.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org

-- 
Abhinandan Jain, Ph.D.
Dynamics and Real-Time Simulation (DARTS) Lab
Mobilty and Robotic Systems Section
Jet Propulsion Laboratory
4800 Oak Grove Drive, Pasadena, CA 91109
(818)-354-3412	  (818)-393-5007 (fax)

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Karl Fogel <kf...@red-bean.com>.
Abhinandan Jain <ja...@helios.jpl.nasa.gov> writes:
> To me this looks like an SVN bug rather than a usage error. Virtually
> all other SVN operations (copy, commit, delete et.) simply ignore
> unversioned files that ight be around. I would expect switch to behave
> the same way. At the minimum it would be useful to have an extra
> option to switch to get such consistent behavior instead of insisting
> on users manually clearing out unversioned files.

Oh, I think we all agree it's an SVN bug.  But until we have a fix, a
FAQ entry will help people.

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by James Coleman <ja...@dspsrv.com>.
Abhinandan Jain wrote:
>> Karl Fogel wrote:
>>> james coleman <ja...@dspsrv.com> writes:
>>>> I didn't want to delve into detail and confuse people but Hmmm, yes.
>>> You can just say your list of examples isn't complete.
>> Good idea.
>>
>> Also searching for the error turns up a few threads and most of them are 
>> because
>> of this problem. It's more of a user confusion issue really.
>> So FAQ entry definately would be good.
>>
>> User just is not told they have to remove the offending files/directories.
>>  It's obvious to me now.
>>
> 
> To me this looks like an SVN bug rather than a usage error. Virtually
> all other SVN operations (copy, commit, delete et.) simply ignore
> unversioned files that ight be around. I would expect switch to behave
> the same way. At the minimum it would be useful to have an extra
> option to switch to get such consistent behavior instead of insisting
> on users manually clearing out unversioned files.
> 
> Abhi
> 

Hello Abhi,

I think that makes sense and would be useful to take further so I've logged
it to the bug in here:
  http://subversion.tigris.org/issues/show_bug.cgi?id=2505

Hope you don't mind. :)

Thanks!

James.

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Abhinandan Jain <ja...@helios.jpl.nasa.gov>.
> Karl Fogel wrote:
> >james coleman <ja...@dspsrv.com> writes:
> >>I didn't want to delve into detail and confuse people but Hmmm, yes.
> >
> >You can just say your list of examples isn't complete.
> 
> Good idea.
> 
> Also searching for the error turns up a few threads and most of them are 
> because
> of this problem. It's more of a user confusion issue really.
> So FAQ entry definately would be good.
> 
> User just is not told they have to remove the offending files/directories.
>  It's obvious to me now.
> 

To me this looks like an SVN bug rather than a usage error. Virtually
all other SVN operations (copy, commit, delete et.) simply ignore
unversioned files that ight be around. I would expect switch to behave
the same way. At the minimum it would be useful to have an extra
option to switch to get such consistent behavior instead of insisting
on users manually clearing out unversioned files.

Abhi

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by James Coleman <ja...@dspsrv.com>.
Karl Fogel wrote:
> james coleman <ja...@dspsrv.com> writes:
>> I didn't want to delve into detail and confuse people but Hmmm, yes.
> 
> You can just say your list of examples isn't complete.

Good idea.

Also searching for the error turns up a few threads and most of them are because
of this problem. It's more of a user confusion issue really.
So FAQ entry definately would be good.

User just is not told they have to remove the offending files/directories.
  It's obvious to me now.

http://www.google.ie/search?q=+site%3Asvn.haxx.se+-translate+%22Won%27t+delete+locally+modified+directory%22


> 
>> Seeing the exact error svn reports might make people searching for
>> it hit the FAQ entry.
> 
> Yup.
> 
>> This is taking me a while as I've started testing this more.
> 
> Now you see why I palmed it off on you :-).

:) and :-P

another situation (for me to log to bug and try and summarize in FAQ entry):

Also isolated a alightly harder to recover from situation.
I think this is also what we were seeing.
User is directed to cleanup but cleanup doesn't work.
Using TortoiseSVN to be realistic to real user scenario here.
Again cleaning repository manually before switch or even after switch error recovers this situation
IF you clean the right things.

Realistic situation if a temporary build file is accidentally checked in and removed.
 From then on a svn switch after build that generates that temp file will encounter
this situation.

1. using TortoiseSVN to do switch:

Error: Won't delete locally modified directory 
'C:\cygwin\home\james_coleman\checkedout\quantiqa-718\source\ticket'
Error: Left locally modified or unversioned files

Little yellow exclaimation mark warning. on offending file/dirs

2. svn-unversioned |xargs rm -rf  #(or remove by hand)

3. then switch again:

Error: Directory 'C:\cygwin\home\james_coleman\checkedout\quantiqa-718\source\ticket\ticketgen\.svn' 
containing working copy admin area is missing
Error: Please execute the "Cleanup" command.

okay. Command-line can't switch either.

james_coleman@IEl02 ~/checkedout/quantiqa-718
$ svn switch https://source.commprove.internal/repository/quantiqa/branches/ticket-718
svn: Directory 'source/ticket/ticketgen/.svn' containing working copy admin area is missing

4. TortoiseSVN cleanup:

Error reported in pop-up dialog. A bit differently to other errors:

Subversion reported an error while doing a cleanup!
source/<dir>/<yetanotherdir> is not a working copy directory

svn-unversioned doesn't see anything

$ svn status
! L    .
! L    source
! L    source/<dir>
     S  source/<dir>/<otherdir>
~      source/<dir>/<yetanotherdir>

$ svn-unversioned

$ ls source/<dir>/<yetanotherdir>
<file>.o

5. At this point the user is not sure what to do.
    They might try a revert which seems to cause trouble.
    The correct thing to do is to Remove that manually

$ rm -rf source/<dir>/<yetanotherdir>

6. Then TortoiseSVN cleanup and then switch successful



This is because at one time the object file was checked in by accident.
It was removed but now an svn switch doesn't like deleting it decause of history.



wc/$ touch br/foo.o
wc/$ svn add  br/foo.o
A         br/foo.o
wc/$ svn ci -m "oops - commit foo.o by accident" br/foo.o
Adding         br/foo.o
Transmitting file data .
Committed revision 20.
wc/$ svn rm br/foo.o
D         br/foo.o
wc/$ svn ci -m "unversion foo.o (committed by accident)" br/foo.o
Deleting       br/foo.o

Committed revision 21.
wc/$ touch br/foo.o

## now try switch

wc/$ svn switch $SVNROOT/$project/branches/br1
svn: Won't delete locally modified directory '.'
svn: Left locally modified or unversioned files


### essence of problem
### how do you know from that error you should remove this file:

wc/$ ls br
foo.o

__ACTUALLY__ now you have to remove directory br to recover

### nothing to delete anyway:
wc/$ svn-unversioned  |xargs rm -rf


### user is confused. huh huh huh?
wc/$ svn switch $SVNROOT/$project/branches/br1
svn: Directory 'br/.svn' containing working copy admin area is missing
wc/$ svn cleanup
svn: 'br' is not a working copy directory
wc/$ svn switch $SVNROOT/$project/branches/br1
svn: Working copy '.' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
wc/$ svn cleanup
svn: 'br' is not a working copy directory
wc/$ svn switch $SVNROOT/$project/branches/br1
svn: Working copy '.' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)


### user might spot and remove this file but in a complex repository
### there may have been lots of unversioned files

wc/$ rm -rf br
wc/$ svn switch $SVNROOT/$project/branches/br1
svn: Working copy '.' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
wc/$ svn cleanup
wc/$ svn switch $SVNROOT/$project/branches/br1
A    br_moved
A    br_moved/README
D    br
  U   .
Updated to revision 21.


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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Karl Fogel <kf...@red-bean.com>.
james coleman <ja...@dspsrv.com> writes:
> I didn't want to delve into detail and confuse people but Hmmm, yes.

You can just say your list of examples isn't complete.

> Seeing the exact error svn reports might make people searching for
> it hit the FAQ entry.

Yup.

> This is taking me a while as I've started testing this more.

Now you see why I palmed it off on you :-).

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by james coleman <ja...@dspsrv.com>.
Karl Fogel wrote:
> james coleman <ja...@dspsrv.com> writes:
>> Here is the text of the FAQ entry I think would work:
> 
> Thanks, I think this is worth having in the FAQ.  Can you send it to
> dev@ as a patch, using the instructions at
> 
>    http://subversion.tigris.org/mailing-list-guidelines.html#patches

Thanks Karl, I've been composing my submission for a while now :-P :)
Wondering what mime type Thunderbird will think a .patch is?
Content-Type: text/x-patch;   good. :)

> 
> See comments below...
> 
>> Why doesn't svn switch work in some cases?
>>
>> In some cases where there are unversioned (and maybe ignored) items
>> in the working copy then you can get errors and end up with an
>> unusable working copy. The more complex the changes on branch and trunk
>> the more likely this is. See issue 2505.
> 
> If you could provide some examples of local changes that are *not*
> likely to interfere with switch, that would help; adding other
> examples of changes that are likely to interfere would be great too.

I didn't want to delve into detail and confuse people but Hmmm, yes.
Seeing the exact error svn reports might make people searching for it hit the FAQ entry.


One scenario:

If any directory has been moved or renamed between the branches then
anything unversioned in there will cause a problem. A switch requires that the
directory doesn't exist after the switch so what to do with unversioned content?
svn plays it safe and doesn't want to delete it.

This is recoverable from actually, you have a half-switched working copy.
You can rm the directory left behind (now also unversioned without .svn) and
then run the svn switch again.

If multiple things have been renamed the switch will trip up and break on each
one so cleaning unversioned files would help.

wc/$ svn switch $SVNROOT/foobar/branches/br1
wc/$ mkdir foo
wc/$ svn add foo
wc/$ svn ci -m"add dir foo" foo
wc/$ touch foo/unversioned_file
wc/$ svn switch $SVNROOT/foobar/branches/br2
svn: Won't delete locally modified directory '.'
svn: Left locally modified or unversioned files

# to recover:

wc/$ svn status
!      .
     S  foo.c
~      foo

wc/$ rm -rf foo
wc/$ svn switch

wc/$ svn up
svn: Directory 'foo/.svn' containing working copy admin area is missing

wc/$ svn switch $SVNROOT/foobar/branches/br2
D    foo
  U   .
Updated to revision 19.



It is the first case listed by bug #2466 though I think.
The error message is confusing and the user did not know what the error was telling them.
The user did an svn revert which then put the working copy in broken state.
It could do with a FAQ entry too:
What does svn switch error "svn: Won't delete locally modified directory '.'" mean?



Actually!


  ............


   Hmmmmmmmmmmmmmmmmmmmmmmm.


I'm wondering is this example all there is to #2505?
A confusing error followed by wrong corrective action then useless working copy.
http://subversion.tigris.org/issues/show_bug.cgi?id=2505

It could be.  Both recipies in #2505 and #2466 could have been
recovered from by removing the offending unversioned files and
continuing the svn switch.
And I did not know you could recover like this until starting to investigate this.

Now there could be a nastier issue lurking here.
But after thinking about this so much I'm beginning to think this _could_ be all there
is to the issue.


If so it could be fixed by getting svn to fix error and direct user to rm
all unversioned files and continue the script.
It would be nice if there was a --force or --allow-delete-unversioned or something
which would make svn brutally delete things in the way of a switch.


Actually I'm wrecked and it's 1:30am here so I'm going to collapse to bed. :-7
I could be completely delusional right now so will leave it here for now.

This is taking me a while as I've started testing this more.
I think I'll comment on 2505 about this. Tomorrow.
I'll test and stop cleaning before I svn switch and see if I can recover every time.
  (Two dirty switches I started between branches that had problems before I have
   now recovered from.)


> 
> Remember, the reader will be asking themselves "Am I in trouble or
> not?"  Anything we can do to help them know the answer to that
> question is good.
> 
>> A switch from a pristine clean checkout always works. There are two
>> ways of working if you are using svn switch as part of your development
>> process:
>>
>>    1. Fully clean your working copy of unversioned (including ignored)
>>       files before switch.
>>       WARNING! This deletes all unversioned dirs/files.
>>       Be VERY sure that you do not need anything that will be removed.
>>
>>           alias svn-unversioned='svn status --no-ignore | grep "^[I?]" | sed 's/^[I?]//''
>>           alias svn-clean-wc='svn-unversioned |xargs rm -rf'
> 
> Just show the commands as commands; aliasing mechanisms may differ
> from shell to shell, and some people don't know what aliases are.

Okay.
I also see in contrib/client-side/svn-clean
But it's a good few lines of perl and I'm thinking the simpler the better.
Maybe these one-liners fit in contrib?

> 
> -Karl
> 

Sheesh. :-7  And thanks Karl.

James.

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Karl Fogel <kf...@red-bean.com>.
james coleman <ja...@dspsrv.com> writes:
> Here is the text of the FAQ entry I think would work:

Thanks, I think this is worth having in the FAQ.  Can you send it to
dev@ as a patch, using the instructions at

   http://subversion.tigris.org/mailing-list-guidelines.html#patches

See comments below...

> Why doesn't svn switch work in some cases?
>
> In some cases where there are unversioned (and maybe ignored) items
> in the working copy then you can get errors and end up with an
> unusable working copy. The more complex the changes on branch and trunk
> the more likely this is. See issue 2505.

If you could provide some examples of local changes that are *not*
likely to interfere with switch, that would help; adding other
examples of changes that are likely to interfere would be great too.

Remember, the reader will be asking themselves "Am I in trouble or
not?"  Anything we can do to help them know the answer to that
question is good.

> A switch from a pristine clean checkout always works. There are two
> ways of working if you are using svn switch as part of your development
> process:
>
>    1. Fully clean your working copy of unversioned (including ignored)
>       files before switch.
>       WARNING! This deletes all unversioned dirs/files.
>       Be VERY sure that you do not need anything that will be removed.
>
>           alias svn-unversioned='svn status --no-ignore | grep "^[I?]" | sed 's/^[I?]//''
>           alias svn-clean-wc='svn-unversioned |xargs rm -rf'

Just show the commands as commands; aliasing mechanisms may differ
from shell to shell, and some people don't know what aliases are.

-Karl

-- 
Subversion support & consulting  <>  http://producingoss.com/consulting.html

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by james coleman <ja...@dspsrv.com>.
Karl Fogel wrote:
> james coleman <ja...@dspsrv.com> writes:
>> We had a bit of a problem with using svn switch.  If doing a switch
>> and there are unversioned (maybe ignored) items in the checkout then
>> you can get errors and end up with an unusable repository.  We now
                                          ^^^^^^^^^^^^^^^^^^^
doh! I meant unusable working copy.

*chomp*

> 
> Both the FAQ and the manual's sources are online, and you could help
> by writing the patches you suggest for them.  See
> 
>    http://subversion.tigris.org/mailing-list-guidelines.html#patches
> 
> Thank you,
> -Karl
> 

Thanks Karl,

I'd like to do that.

FAQ entry could go in Howto or Troubleshooting section.
I think Troubleshooting would be good because people that hit a problem with using
svn switch would probably look there.
I've this just about ready to submit to the dev list.


I think a note or warning in manual would be good too.


Here is the text of the FAQ entry I think would work:

Why doesn't svn switch work in some cases?

In some cases where there are unversioned (and maybe ignored) items
in the working copy then you can get errors and end up with an
unusable working copy. The more complex the changes on branch and trunk
the more likely this is. See issue 2505.

A switch from a pristine clean checkout always works. There are two
ways of working if you are using svn switch as part of your development
process:

    1. Fully clean your working copy of unversioned (including ignored)
       files before switch.
       WARNING! This deletes all unversioned dirs/files.
       Be VERY sure that you do not need anything that will be removed.

           alias svn-unversioned='svn status --no-ignore | grep "^[I?]" | sed 's/^[I?]//''
           alias svn-clean-wc='svn-unversioned |xargs rm -rf'

    2. Keep a pristine clean checkout. Update that then copy it and switch
       in the copy when a switch to another branch is desired.

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Karl Fogel <kf...@red-bean.com>.
james coleman <ja...@dspsrv.com> writes:
> We had a bit of a problem with using svn switch.  If doing a switch
> and there are unversioned (maybe ignored) items in the checkout then
> you can get errors and end up with an unusable repository.  We now
> keep a ''pristine'' clean checkout of any trunk or branch that is
> worked off of and update it then copy and switch when we need to
> checkout.
>
> I think this is this issue:
> http://subversion.tigris.org/issues/show_bug.cgi?id=2505
> http://subversion.tigris.org/issues/show_bug.cgi?id=2466
>
> The bugs there last had activity July 2006 so I don't think they're in
> line to be fixed?
>
> Do many large projects with lots of parallel development and branches
> use svn?  I wonder are people seeing this issue and giving up on using
> svn switch?  I was surprised this isn't better known? Or is it?
>
> I think any project that made use of branches could benefit from
> having this documented. A "bugfix" and better error would be nice also
> in time :) It would be very nice if there was a note in FAQ or manual
> on svn switch.  If people agree this is an issue we could submit some
> content for that.  For now I'd like to hear what you think.

Both the FAQ and the manual's sources are online, and you could help
by writing the patches you suggest for them.  See

   http://subversion.tigris.org/mailing-list-guidelines.html#patches

Thank you,
-Karl

-- 
Subversion support & consulting  <>  http://producingoss.com/consulting.html

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by james coleman <ja...@dspsrv.com>.
Arnauld Van Muysewinkel wrote:
> 2007/7/11, james coleman <ja...@dspsrv.com>:
>> We had a bit of a problem with using svn switch.
>> If doing a switch and there are unversioned (maybe ignored) items in 
>> the checkout
>> then you can get errors and end up with an unusable repository.
>> We now keep a ''pristine'' clean checkout of any trunk or branch that 
>> is worked off of
>> and update it then copy and switch when we need to checkout.
> [SNIP]
>> I think the switch problem is a puzzling one as to me it seems natural 
>> that if
>> an svn status reported that there were no changes to versioned files 
>> then a
>> svn switch would do the right thing and warn and move unversioned 
>> files out
>> of the way. The need to do switch only from pristine checkout is also not
>> mentioned in svn manual.
> 
> I experimented this several times too (both with subclipse and TSVN).
> Usually I "fix" it by doing some manual clean-up and executing update
> and revert alternatively until my WC is OK. Never understood what's
> was happening. Thought I did something wrong (not the case
> apparently).
> 
> This is very annoying, since switch is very useful when working with
> lots of branches and the WC is big. (I used to maintain separate co of
> each branch when I worked with CVS and hoped to get rid of them now
> with svn.)
> 
> 

I'll ask about assigning this issue a milestone on the dev list too:
http://subversion.tigris.org/issues/show_bug.cgi?id=2505

See the proposed FAQ entry in this thread.
Has handy aliases to make a clean-up easy.
Also keeping a pristine checkout of trunk works well and that can be scripted too.

Thanks Arnauld,

James.

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

Re: svn switch problem - cannot switch from ''unclean'' checkout

Posted by Arnauld Van Muysewinkel <ar...@gmail.com>.
2007/7/11, james coleman <ja...@dspsrv.com>:
> We had a bit of a problem with using svn switch.
> If doing a switch and there are unversioned (maybe ignored) items in the checkout
> then you can get errors and end up with an unusable repository.
> We now keep a ''pristine'' clean checkout of any trunk or branch that is worked off of
> and update it then copy and switch when we need to checkout.
[SNIP]
> I think the switch problem is a puzzling one as to me it seems natural that if
> an svn status reported that there were no changes to versioned files then a
> svn switch would do the right thing and warn and move unversioned files out
> of the way. The need to do switch only from pristine checkout is also not
> mentioned in svn manual.

I experimented this several times too (both with subclipse and TSVN).
Usually I "fix" it by doing some manual clean-up and executing update
and revert alternatively until my WC is OK. Never understood what's
was happening. Thought I did something wrong (not the case
apparently).

This is very annoying, since switch is very useful when working with
lots of branches and the WC is big. (I used to maintain separate co of
each branch when I worked with CVS and hoped to get rid of them now
with svn.)


-- 
Ir. Arnauld Van Muysewinkel

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