-----Original Message-----
From: Res Pons [mailto:pons32@hotmail.com]
Sent: Friday, 18 August 2006 7:36 AM
To: subversion-2006c@ryandesign.com
Cc: markp@softlanding.com; users@subversion.tigris.org
Subject: Re: SVN Externals
Very clear. I just ran your command and replaced the paths and it worked.
Now, here's a question I have: Whatever I do in this newly created symlinked
folder...does svn treat it as if I was directly in the folder or inside the
source project? Thanks your example was very clear.
----Original Message Follows----
From: Ryan Schmidt <subversion-2006c@ryandesign.com>
To: Res Pons <pons32@hotmail.com>
CC: markp@softlanding.com, users@subversion.tigris.org
Subject: Re: SVN Externals
Date: Thu, 17 Aug 2006 22:20:42 +0200
On Aug 17, 2006, at 21:59, Res Pons wrote:
>Thanks for all the info. So if I'm running svn on a linux redhat
>enterprise 3.5 server and I have the following projects at the root of the
>repo
>
>ProjA
>ProjB
>ProjC
>ProjD (just a common library folder w/o branches & tags & trunk
>subfolders)
>
>And I want projD to be symlinked into A, B, & C when everyone checks out
>these 3 latter projects so they automatically get projD into their working
>folders... say I go to ProjA and create a file called what and what I do
>put in it and just check it in? Our SVN server is a Linux box and
>developers either use Eclipse plugin or svn commnad line; the Tortoise
>example totally lost me. Sorry.
If $REPO is the URL to your repository, then:
cd /working/copy/of/ProjA/trunk
svn propset svn:externals "libs $REPO/ProjD" .
svn ci -m "Adding external to bring $REPO/ProjD into this project into a
directory called libs"
It's explained in the book:
http://svnbook.red-bean.com/en/1.2/svn.advanced.externals.html
============================================================================
=
The problem described in this thread and the thread titled "Selective
Checkout"
isn't really addressed properly by the use of Externals. The main problem
is when you want the externals that you are using to be head revisions under
development,
because they are your own libraries. You create a structure in your Working
Copy that
you think looks good, you go and make changes throughout the structure, and
then you
perform a commit at the top of the tree and it doesn't recurse into the
directories that
are externals. On top of that, users have to get used to querying the
svn:externals
property on the right directories to know which version of the libraries you
are bringing
down.
Eg:
/repo/
/Prod_1/
/trunk/
/branches/
/tags
/Prod_2/
/trunk/
/branches/
/tags
/Prod_n/
/trunk/
/branches/
/tags
/Lib_01/
/trunk/
/branches/
/tags
/Lib_02/
/trunk/
/branches/
/tags
/Lib_mm/
/trunk/
/branches/
/tags
converted into
/wc/
/Prod_1/
/Lib_04/
/Lib_07/
/Lib_mm/
etc. It is more of a problem the larger mm becomes.
Jay Berkenbilt proposed a solution to this problem on this list a couple of
years ago.
My application of his idea is to extend the repo according to:
/repo/
/Prod_1/
/trunk/
/branches/
/tags
/skel/
/trunk/
/Lib_04 <---- NB! Empty Directory!
/Lib_07 <---- ditto
/Lib_mm <---- ditto
/branches
/tags
So now, checking out becomes a two-step process, in /wc
svn co /repo/Prod_1/skel/trunk Prod_1
and then
svn switch /repo/Lib_04/trunk Prod_1/Lib_04
svn switch /repo/Lib_07/trunk Prod_1/Lib_07
svn switch /repo/Lib_mm/trunk Prod_1/Lib_mm
The repeated application of the switch subcommand is a pain, so you write a
script
like attached at the bottom of this posting, (and I'm not a Python
developer, so I apologise
in advance for how it looks). You run this script over a file that exists
in
/repo/Prod_1/trunk, which appears in the top level of the /wc/Prod_1
directory.
The version of the library that you switch to doesn't have to be the trunk,
eg
svn switch /repo/Lib_04/branch/stable Prod_1/Lib_04
and you can pin it using a revision number if you want to.
The big advantage of this method is that you can see in an instant which
versions of your
libraries you are bringing in, and if you do a commit at the top level, you
automatically
commit the whole thing. Same for doing updates.
The disadvantage is that switch doesn't work between repositories, but then,
that's when
svn:external is the appropriate tool to use.
I have recently been in contact with Jay, and he has extended his original
idea extensively.
He now has two utilities - asvn and qsvn - that do much more. I will ask
him if he will post
these to this list, or perhaps the dev list.
Anyway, hope discussion this has been of some use to you all.
Cheers,
Pete.
============================================ sparse_wc.py
===================================
import os, sys
#
# The Sparse Working Copy idea.
#
# The basic idea is that the "shape" of the directory structure that
# constitutes each saved independently from the contents of those
directories.
#
# The user checks out the "shape" first, which contains a file that contains
# rows, each of which contains two or three items, separated by commas.
#
# The first component is a file or subdirectory of the directory holding the
data file, (TARGET)
# The second component is a full URL to a file or directory in the
repository, (URL)
# The optional third component is a revision number, (REV).
#
# This script then iterates over the rows, and for each row performs the
command
# "svn switch -r REV URL TARGET" if REV was present or
# "svn switch -r HEAD URL TARGET" if REV was not present
#
def Usage():
print """
Usage: sparse_wc switchFile
This script takes a single compulsory argument that is the name of a
file that exists.
The file consists of one or more lines, each of which has two or
three parts.
The first part is the name of a file or subdirectory of the
directory in which
the switchFile is located. This identifies the TARGET.
The second part of a line is a full URL to a file or directory in
the repository.
This URL must be to a file for a file TARGET, and to a directory
for a
directory TARGET.
The third, optional, part of a line is a REVISION. This must be a
number.
The parts are separated by commas.
The script will iteratively call
svn switch -r REVISION URL TARGET
for each line in the file. (Of course, if no REVISION is present,
HEAD is assumed.)
"""
def main():
# Step 1. Get the name of the data file specified on the command line
if len(sys.argv) != 2:
Usage()
sys.exit(1)
filePath = sys.argv[1]
if not os.path.isfile(filePath):
Usage()
sys.exit(2)
# Step 2. Open the file.
f = open(filePath, 'r')
for line in f:
# Step 3. Break the line into tokens
line = line.rstrip()
tokens = line.split(',')
if len(tokens) == 3:
os.system("svn switch -r " + tokens[2] + " " + tokens[1] + " " +
tokens[0])
elif len(tokens) == 2:
os.system("svn switch " + tokens[1] + " " + tokens[0])
else:
print "Your file is malformed"
if __name__ == "__main__":
main()
============================================== End
===========================================
Warning: Copyright ResMed. Where the contents of this email and/or attachment includes materials prepared by ResMed, the use of those
materials is subject exclusively to the conditions of engagement between ResMed and the intended recipient.
This communication is confidential and may contain legally privileged information.
By the use of email over the Internet or other communication systems, ResMed is not waiving either confidentiality of, or legal
privilege in,the content of the email and of any attachments.
If the recipient of this message is not the intended addressee, please call ResMed immediately on +61 2 9886 5000 Sydney, Australia.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Aug 18 01:18:54 2006