[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Commit to several Repositories

From: Thomas Harold <thomas-lists_at_nybeta.com>
Date: Thu, 12 Nov 2009 23:16:22 -0500

On 11/12/2009 6:31 PM, Jörg Schad wrote:
> Hi,
> thanks for your answer. Still one question left: How does svn external
> behave if I modify this code, in my scenario it should simply be the
> base for each of the individual repositories and as I understand the
> externals I cannot change the external code. Is that correct?

(cc'ing this back to the list)

Let's assume that you have multiple repositories. A central one where
you're keeping the code to be shared, and one for each student
(StudentA, StudentB, etc). You have an XYZ project in the central
repository that you want the students to pull into their repositories.

/Central
     /Projects/Source/XYZ

/StudentA
     /Homework1
     /Homework2
     /Shared
     svn:externals XYZ /Central/Projects/Source/XYZ

/StudentB
     /HomeworkA
     /HomeworkB
     /Notes
     /Shared
     svn:externals XYZ /Central/Projects/Source/XYZ

The svn:externals is a property of the student's /Shared/ folder. When
the student checks out their repository, SVN will also bring down the
latest copy of whatever is under /Central/Projects/Source/XYZ and will
put it in a folder under /Shared/ called XYZ. Depending on what
authentication method you use, you could even make it so that students
can't modify stuff under their /Shared/ folder. (Which would keep them
from accidentally wiping out the SVN properties attached to that folder
and breaking the svn:externals property.)

If the students don't have write access to commit back to the XYZ folder
in the Central repository, then they would have to copy the code out of
their personal Shared/XYZ folder in order to permanently modify it.
Without commit permissions, they can't write back to the Central
repository's XYZ project. You probably don't want them to modify the
central shared source.

I'm not sure offhand how things work if you try to branch/copy from an
svn:externals folder to another portion of your private repository.
Either way, I suspect they'll need to copy the code into a folder of
their choosing elsewhere in their personal repository.

When you want to push new content to the students, you merely change the
files in the XYZ project in the Central repository. The next time that
the students do an "svn update" on their Shared/XYZ folder, they'll get
the new changes.

(I think I got all of the details correct on what the svn:externals
property should look like. I'm using the "/" at the front to show you
how to do relative svn:externals that are based off the same server, but
in different repositories.)

http://svnbook.red-bean.com/en/1.5/svn.advanced.externals.html

The other alternative, if they have read access to the central
repository is to simply tell them to do an "svn export" of the central
URL into their personal working copies.

cd ~/Homework1
svn export svn+ssh://servername/Central/Projects/Shared/XYZ
svn add
svn ci

Assuming that ~/Homework1 is a working copy associated with their
personal repository, they could then add that new code to their
repository and work with it.

Either way, the end result is similar. The student's end up with a copy
of the code to work with. But they have to do the work of copying
themselves. To automate it, I suspect you would end up using that
script that you're working on.

(I suspect that in the real world, you'd be more likely to use an
svn:externals method with a manual copy to a private folder to start.
Such as when maintaining a code base that is based off a 3rd party code
base. Not something that I've had to do yet. The svn:externals method
has the advantage where it's easy to get updates down the road without
having to remember the svn export URL.)

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2417401

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-11-13 05:17:05 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.