You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by An Me <an...@gmail.com> on 2010/02/22 10:28:43 UTC

Regarding shallow checkouts

Hi All,

I am learning svn and am a new-bie.The following is my doubt.

What is the significance of shallow checkouts.?.
Why would somebody want to checkout a project partially.?
If possible please explain with a scenario/real life example.

Regards,
An

Re: Regarding shallow checkouts

Posted by An Me <an...@gmail.com>.
Hi All,

Thank you all for the response.

Regards,
An
On Tue, Feb 23, 2010 at 11:23 AM, Ryan Schmidt <
subversion-2010a@ryandesign.com> wrote:

>
> On Feb 22, 2010, at 22:48, An Me wrote:
>
> > On Mon, Feb 22, 2010 at 9:54 PM, Andrey Repin wrote:
> >
> >> You need to change only one file. You co empty top-level directory, then
> >> update only that file. And edit and commit it.
> >
> > But usually if we are working on java project,to edit some files mean we
> need to co the whole project and not that single file alone for editing as
> we need to check whether the whole project is working fine by finally
> compiling and running the same.So where exactly is the shallow co useful?
>
> Maybe it is not useful for you. It might not be applicable to all
> workflows. It can be very useful for example if you have a web site in
> Subversion and need to only fix a typo on a single page. Or if you are an
> artist working on a game and only need to check out the graphics you are
> currently editing, and don't need all the other graphics or sounds or game
> code.
>
>
> Personally, I use shallow checkouts for some types of changes in MacPorts.
> MacPorts is a package management system for Mac OS X written in Tcl. Each
> port is represented by a Tcl file that defines certain variables like the
> port name, version, category, and so on. Each port file lives in a directory
> with the name of the port, which lives in a directory with the name of the
> category. For example our php5 port lives in
> trunk/dports/lang/php5/Portfile. You can browse the tree here:
>
> http://trac.macports.org/browser/trunk/dports
>
> Now suppose I want to change a port's category, as I did for php5 in r49690
> when I moved it to the lang category from the www category because it is in
> fact a language and not limited to web programming:
>
> http://trac.macports.org/changeset/49690
>
> How could I do this? I could do it with URLs:
>
> svn mv \
> http://svn.macosforge.org/repository/macports/trunk/dports/www/php5 \
> http://svn.macosforge.org/repository/macports/trunk/dports/lang \
> -m "move php5 from www to lang category"
>
> But the category is also listed in the port file itself. If I just move the
> port's directory to the new category's directory without also editing the
> port file, the port file will still say the port is in the www category
> while the port directory is in the lang category directory. That won't do. I
> need to edit the port file at the same time as I move its directory. I could
> check out the entire dports directory, but if I don't plan to use that
> directory for other purposes later, it would be wasteful to check out all
> 6000+ ports just for this small rearrangement. It's more efficient to check
> out sparsely. I might use:
>
> svn co -N http://svn.macosforge.org/repository/macports/trunk/dports
> cd dports
> svn up -N www lang
> svn up www/php5
> svn mv www/php5 lang
> # now edit the categories definition in lang/php5/Portfile
> svn ci -m "move php5 from www to lang category"
>
> Yes, the syntax I show above is the old pre-Subversion 1.5 non-recursive
> checkout syntax instead of the new Subversion 1.5+ sparse checkout syntax,
> but only because I have not yet bothered to learn the latter.
>
>
>

Re: Regarding shallow checkouts

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 22, 2010, at 22:48, An Me wrote:

> On Mon, Feb 22, 2010 at 9:54 PM, Andrey Repin wrote:
> 
>> You need to change only one file. You co empty top-level directory, then
>> update only that file. And edit and commit it.
> 
> But usually if we are working on java project,to edit some files mean we need to co the whole project and not that single file alone for editing as we need to check whether the whole project is working fine by finally compiling and running the same.So where exactly is the shallow co useful?

Maybe it is not useful for you. It might not be applicable to all workflows. It can be very useful for example if you have a web site in Subversion and need to only fix a typo on a single page. Or if you are an artist working on a game and only need to check out the graphics you are currently editing, and don't need all the other graphics or sounds or game code.


Personally, I use shallow checkouts for some types of changes in MacPorts. MacPorts is a package management system for Mac OS X written in Tcl. Each port is represented by a Tcl file that defines certain variables like the port name, version, category, and so on. Each port file lives in a directory with the name of the port, which lives in a directory with the name of the category. For example our php5 port lives in trunk/dports/lang/php5/Portfile. You can browse the tree here:

http://trac.macports.org/browser/trunk/dports

Now suppose I want to change a port's category, as I did for php5 in r49690 when I moved it to the lang category from the www category because it is in fact a language and not limited to web programming:

http://trac.macports.org/changeset/49690

How could I do this? I could do it with URLs:

svn mv \
http://svn.macosforge.org/repository/macports/trunk/dports/www/php5 \
http://svn.macosforge.org/repository/macports/trunk/dports/lang \
-m "move php5 from www to lang category"

But the category is also listed in the port file itself. If I just move the port's directory to the new category's directory without also editing the port file, the port file will still say the port is in the www category while the port directory is in the lang category directory. That won't do. I need to edit the port file at the same time as I move its directory. I could check out the entire dports directory, but if I don't plan to use that directory for other purposes later, it would be wasteful to check out all 6000+ ports just for this small rearrangement. It's more efficient to check out sparsely. I might use:

svn co -N http://svn.macosforge.org/repository/macports/trunk/dports
cd dports
svn up -N www lang
svn up www/php5
svn mv www/php5 lang
# now edit the categories definition in lang/php5/Portfile
svn ci -m "move php5 from www to lang category"

Yes, the syntax I show above is the old pre-Subversion 1.5 non-recursive checkout syntax instead of the new Subversion 1.5+ sparse checkout syntax, but only because I have not yet bothered to learn the latter.


Re: Regarding shallow checkouts

Posted by An Me <an...@gmail.com>.
Hi

Thanks for the reply.

But usually if we are working on java project,to edit some files mean we
need to co the whole project and not that single file alone for editing as
we need to check whether the whole project is working fine by finally
compiling and running the same.So where exactly is the shallow co useful?

Regards,
An

On Mon, Feb 22, 2010 at 9:54 PM, Andrey Repin <an...@freemail.ru> wrote:

> Greetings, An Me!
>
> > I am learning svn and am a new-bie.The following is my doubt.
>
> > What is the significance of shallow checkouts.?.
> > Why would somebody want to checkout a project partially.?
> > If possible please explain with a scenario/real life example.
>
> If by shallow checkout you mean fetching of only certain depth of subdirs,
> then "real-world" example is quite simple.
> You need to change only one file. You co empty top-level directory, then
> update only that file. And edit and commit it.
>
>
> --
> WBR,
>  Andrey Repin (anrdaemon@freemail.ru) 22.02.2010, <19:22>
>
> Sorry for my terrible english...
>
>

Re: Regarding shallow checkouts

Posted by Andrey Repin <an...@freemail.ru>.
Greetings, An Me!

> I am learning svn and am a new-bie.The following is my doubt.

> What is the significance of shallow checkouts.?.
> Why would somebody want to checkout a project partially.?
> If possible please explain with a scenario/real life example.

If by shallow checkout you mean fetching of only certain depth of subdirs,
then "real-world" example is quite simple.
You need to change only one file. You co empty top-level directory, then
update only that file. And edit and commit it.


--
WBR,
 Andrey Repin (anrdaemon@freemail.ru) 22.02.2010, <19:22>

Sorry for my terrible english...

Re: Regarding shallow checkouts

Posted by Felix Gilcher <fe...@bitextender.com>.
Well, my scenario is simple: I have a repository that contains a folder branches and in that folder is a branch for every version that is deployed. Deployment is done every second week, since 2007. So that's a lot of branches. I use shallow checkout to check out the branches folder and all of its immediate children which gives me a list of existing branches. If I need to work on one of those, I can pull it easily with svn up --set-depth=infinity. 

That's about all.

felix

On Feb 22, 2010, at 11:28 AM, An Me wrote:

> Hi All,
> 
> I am learning svn and am a new-bie.The following is my doubt.
> 
> What is the significance of shallow checkouts.?.
> Why would somebody want to checkout a project partially.?
> If possible please explain with a scenario/real life example.
> 
> Regards,
> An

--
Felix Gilcher

Bitextender GmbH
Paul-Heyse-Str. 6
D-80336 München

Amtsgericht München, HRB 174280
Geschäftsführer: David Zülke, Florian Clever