You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Greg Lutz <gr...@nearspace.com> on 2008/02/02 23:38:14 UTC

Removing a directory locally

As a relative newcomer to Subversion, I find a capability surprisingly 
missing: the ability to remove a directory from a working copy, but not 
from the repository. At least, it seems to be missing.

In a toy example, I have a repository with two directories under the 
root, Project1 and Project2.

I create a working copy /Temp/wc non-recursively, then use svn update to 
add Project1 to the working copy.

 From within the working copy, svn status -v now reports

                1        1 Greg         .
                1        1 Greg         Project1

I now use svn update again, to add Project2 to the working copy. The svn 
status -v report is now

                1        1 Greg         .
                1        1 Greg         Project1
                1        1 Greg         Project2

Suppose I now decide that fetching Project2 was a mistake -- it's big 
and ugly, I don't need it, I just want it back out of there. Not out of 
the repository, just out of my working copy, so I don't want to use svn 
delete. If I use plain file system commands to remove Project2, then svn 
status -v gives me a *bad* report:

                1        1 Greg         .
                1        1 Greg         Project1
!              ?        ?   ?           Project2

If I then try to add a file to the root of the repository with svn add, 
I'm not allowed to commit it:

C:/Temp/wc>svn add File1.txt
A         File1.txt
C:/Temp/wc>svn commit
svn: Commit failed (details follow):
svn: Directory 'C:\Temp\wc\Project2' is missing

There *is* a non-kosher workaround: I can edit .svn/entries and remove 
the lines for Project 2:

Project2
dir
<ff>

After doing this, the commit works fine.

Is there a kosher way to do this operation?

Thanks,
Greg Lutz


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

Re: Removing a directory locally

Posted by marc gonzalez-carnicer <ca...@gmail.com>.
when i need to have different projects in the same repo, or parts
of it that are relatively unconnected and independent, what i do is
not to checkout the whole repo (or the whole trunk), but only the
parts that i need.

for example :

$ mkdir -p /home/greg/repoX/subprojects
$ cd /home/greg/repoX/subprojects
$ svn checkout $REPO_X_URL/Project1
$ svn checkout $REPO_X_URL/Project2

now it should be noted that folder /home/greg/repoX/subprojects is not
under version control, as would be the case with the non issued command
$ svn checkout $REPO_X_URL

now if you find the Project2 useless, you can safely delete it
locally.


2008/2/3, Ryan Schmidt <su...@ryandesign.com>:
> On Feb 2, 2008, at 17:38, Greg Lutz wrote:

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

Re: Removing a directory locally

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 2, 2008, at 17:38, Greg Lutz wrote:

> As a relative newcomer to Subversion, I find a capability  
> surprisingly missing: the ability to remove a directory from a  
> working copy, but not from the repository. At least, it seems to be  
> missing.
>
> In a toy example, I have a repository with two directories under  
> the root, Project1 and Project2.
>
> I create a working copy /Temp/wc non-recursively, then use svn  
> update to add Project1 to the working copy.
>
> From within the working copy, svn status -v now reports
>
>                1        1 Greg         .
>                1        1 Greg         Project1
>
> I now use svn update again, to add Project2 to the working copy.  
> The svn status -v report is now
>
>                1        1 Greg         .
>                1        1 Greg         Project1
>                1        1 Greg         Project2
>
> Suppose I now decide that fetching Project2 was a mistake -- it's  
> big and ugly, I don't need it, I just want it back out of there.  
> Not out of the repository, just out of my working copy, so I don't  
> want to use svn delete. If I use plain file system commands to  
> remove Project2, then svn status -v gives me a *bad* report:
>
>                1        1 Greg         .
>                1        1 Greg         Project1
> !              ?        ?   ?           Project2
>
> If I then try to add a file to the root of the repository with svn  
> add, I'm not allowed to commit it:
>
> C:/Temp/wc>svn add File1.txt
> A         File1.txt
> C:/Temp/wc>svn commit
> svn: Commit failed (details follow):
> svn: Directory 'C:\Temp\wc\Project2' is missing
>
> There *is* a non-kosher workaround: I can edit .svn/entries and  
> remove the lines for Project 2:
>
> Project2
> dir
> <ff>
>
> After doing this, the commit works fine.
>
> Is there a kosher way to do this operation?

The non-recursive checkout operation is a bit sketchy, and broken in  
the ways you've discovered.

Subversion 1.5 will include a new sparse-directory feature which may  
meet your needs better. (I don't know; I haven't tried it.)


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