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.


Reply via email to