You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Carsten Koch <Ca...@icem.com> on 2005/06/27 17:57:24 UTC

How can I check out parts of a directory tree?

Hi,

I have to develop software tools that allow users
to check out specific parts of a directory tree.

For example, there is
     http://server/repository/product/trunk/dira/dirb

Users want one script that sets up their environment,
so it would create an empty directory wc, containing an
empty directory dira, containing an empty directory dirb.
They want this structure to be set up so they can later
decide what specific source files to work on.

They want a second script that populates the structure.
Ideally with single files. If, for example, there is a
file b.cpp in http://server/repository/product/trunk/dira/dirb,
they want to say "checkout b.cpp" in any subdirectory
(wc, dira,  or dirb) and the script must find out that
it needs to put b.cpp into wc/dira/dirb.

I know the easiest way to implement that would be to
simply let the first script check out everything and
then remove everything except for the hidden .svn
directories. The second script must then use "svn list -R"
on the base directory to find out where the needed file
goes and, in the above example, issue an "svn update b.cpp"
in wc/dira/dirb.

The problem with checking out everything an then deleting
most of it is obvious: I am wasting a lot of bandwith and
people (like me) who only have a 64kbit ISDN line have to
wait forever.

Obviously, I could let my script create fake ".svn"
directories, but that does not seem right, as the
structure inside them is subject to change.

Is there a correct way of doing this?

Thanks!

Carsten.

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

Re: How can I check out parts of a directory tree?

Posted by David Weintraub <qa...@gmail.com>.
Subversion doesn't do "checkouts" like most other VCS do. You don't
need to lock a file in order to edit it, so there is no need to do
individual checkouts to tell Subversion what files you want to edit.
Because of this, Subversion was designed to create whole working
directories and not just a file here and there. You really cannot just
checkout a single file.

If you do checkout a whole directory and then delete all the files you
don't want, Subversion would be insisting that your directory needs an
update. I don't think you can even do a commit until you do an "svn
update" and copy back all of the missing files. In the end, you
wouldn't save any bandwidth or diskspace.

It is always easier to work with the tool than to attempt to adopt a
tool to work in a way it wasn't designed. If you really need to
checkout a single file at a time, you maybe better off going with CVS.

This is not a brush off. Not every development shop works the same way
and some tools are better working in certain paradigms than others.
Linux for example doesn't use Subversion because Subversion assumes a
single central repository, and Linux development doesn't work that
way. If you must work in a particular way, you're better off finding a
tool that supports the way you work than attempting to adopt a tool to
work in a way it wasn't intended.

On 6/27/05, Carsten Koch <Ca...@icem.com> wrote:
> Hi,
> 
> I have to develop software tools that allow users
> to check out specific parts of a directory tree.
> 
> For example, there is
>      http://server/repository/product/trunk/dira/dirb
> 
> Users want one script that sets up their environment,
> so it would create an empty directory wc, containing an
> empty directory dira, containing an empty directory dirb.
> They want this structure to be set up so they can later
> decide what specific source files to work on.
> 
> They want a second script that populates the structure.
> Ideally with single files. If, for example, there is a
> file b.cpp in http://server/repository/product/trunk/dira/dirb,
> they want to say "checkout b.cpp" in any subdirectory
> (wc, dira,  or dirb) and the script must find out that
> it needs to put b.cpp into wc/dira/dirb.
> 
> I know the easiest way to implement that would be to
> simply let the first script check out everything and
> then remove everything except for the hidden .svn
> directories. The second script must then use "svn list -R"
> on the base directory to find out where the needed file
> goes and, in the above example, issue an "svn update b.cpp"
> in wc/dira/dirb.
> 
> The problem with checking out everything an then deleting
> most of it is obvious: I am wasting a lot of bandwith and
> people (like me) who only have a 64kbit ISDN line have to
> wait forever.
> 
> Obviously, I could let my script create fake ".svn"
> directories, but that does not seem right, as the
> structure inside them is subject to change.
> 
> Is there a correct way of doing this?
> 
> Thanks!
> 
> Carsten.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 


-- 
--
David Weintraub
qazwart@gmail.com

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


Re: How can I check out parts of a directory tree?

Posted by Carsten Koch <Ca...@icem.com>.
Lieven,

Lieven Govaerts wrote:
...
> 2. find a file:
> 
>>svn list -R|grep nl.po
> 
> subversion/translations/nl.po
> 
> 3. fetch the file:
...
>>svn update -N ./subversion
> 
> A    subversion
> 
> 
>>svn update -N ./subversion/translations
> 
> A    subversion\translations
> A    subversion\translations\nl.po
> 
> So you'll get all files in the same folder as the one file you're 
> interested in. 
> 
> Hope this helps.

Yes, thank you, that was very helpful. :-)

I have done some tests along these lines already.

I see two problems with this, which I believe can be fixed
within the constraints of subversions philosophy.

1) svn list -R is extremely slow, which makes it hard to
    use it generously to provide a simplified file-name-only-based
    interface for checkout.
    I believe there are several issue entries about this already.
    See http://subversion.tigris.org/issues/show_bug.cgi?id=1742
    and http://subversion.tigris.org/issues/show_bug.cgi?id=1809

2) It would be great to have another option, similar to -N,
    but one level "stronger", that only updates the directory
    (i.e. creates it, updates its properties, etc.), but does
    not download any of its files.

What do people think?
Is it possible and useful to fix these two?

Cheers,

Carsten.

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

RE: How can I check out parts of a directory tree?

Posted by Lieven Govaerts <lg...@mobsol.be>.
Carsten, 

to the best of my knowledge, you can only do this for whole folders, 
meaning one folder with all its files ( but not subfolders ).
That's what the '-N' option does for you.

What you can do is:

1. get the 'public' folder as child of current folder, 
only the folder, not the files in it!
>svn checkout http://www.mobsol.be/svn/public -N
Checked out revision 7.

2. find a file:
>svn list -R|grep nl.po
subversion/translations/nl.po

3. fetch the file:
>svn update -N ./subversion/translations/nl.po
Skipped 'subversion\translations\nl.po'

Doh! this doesn't work!

So, the real number 3 is:
3. your script has to parse both 'subversion' and 'translations'
folders in this case, and one by one update them, but not 
recursively!
>svn update -N ./subversion
A    subversion

>svn update -N ./subversion/translations
A    subversion\translations
A    subversion\translations\nl.po

So you'll get all files in the same folder as the one file you're 
interested in. 

Hope this helps.

Lieven.



-----Original Message-----
From: Carsten Koch [mailto:Carsten.Koch@icem.com] 
Sent: maandag 27 juni 2005 19:57
To: users@subversion.tigris.org
Subject: How can I check out parts of a directory tree?

Hi,

I have to develop software tools that allow users to check out specific
parts of a directory tree.

For example, there is
     http://server/repository/product/trunk/dira/dirb

Users want one script that sets up their environment, so it would create an
empty directory wc, containing an empty directory dira, containing an empty
directory dirb.
They want this structure to be set up so they can later decide what specific
source files to work on.

They want a second script that populates the structure.
Ideally with single files. If, for example, there is a file b.cpp in
http://server/repository/product/trunk/dira/dirb,
they want to say "checkout b.cpp" in any subdirectory (wc, dira,  or dirb)
and the script must find out that it needs to put b.cpp into wc/dira/dirb.

I know the easiest way to implement that would be to simply let the first
script check out everything and then remove everything except for the hidden
.svn directories. The second script must then use "svn list -R"
on the base directory to find out where the needed file goes and, in the
above example, issue an "svn update b.cpp"
in wc/dira/dirb.

The problem with checking out everything an then deleting most of it is
obvious: I am wasting a lot of bandwith and people (like me) who only have a
64kbit ISDN line have to wait forever.

Obviously, I could let my script create fake ".svn"
directories, but that does not seem right, as the structure inside them is
subject to change.

Is there a correct way of doing this?

Thanks!

Carsten.

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

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.1/28 - Release Date: 24/06/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.1/28 - Release Date: 24/06/2005
 


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