views:

35

answers:

3

Hello,

I would like to know as how to commit a file/folder to multiple folders in one go using subversion tool. I can place the file in multiple folders and then do commit, but i just want to place it is a single folder and it should create copies in the required folders. Is it possible?

+2  A: 

No, subversion supports only one main repository. But you can update from many locations. Commit one place, update from other places like web server directory. If you make change there you can also commit from there.

nerkn
I want to commit a single file in the same parent directory but different sub-directories. Is it possible?
The OP wasn't going for multiple repositories if I understand it correctly.
Sander Rijken
A: 

Something like Apache Ant or Maven will help you accomplish this task.

Edit: maybe something like this in a pre-commit hook (create a file 'pre-commit' in your repository/hooks dir)(draft version):

#!/bin/bash

REPOS="$1"
TXN="$2"
SVNDIR=""
SVNLOOK="/usr/bin/svnlook"
NEWPATH="/path"

CHANGED=`$SVNLOOK changed -t "$TXN" "$REPOS" | $GREP "^[U|A]" | $AWK '{print $2}'`

for FILE in $CHANGED
do 
cp "$FILE" "$NEWPATH/$FILE" 
done

svn add -force "$SVNDIR" 
Orbit
Just wanted to know if its possible using subversion.
Hmm, now that I think about it, probably possible with a hook. I'll try to post a solution shortly.
Orbit
Changing what's being committed in pre commit hooks is **not** recommended at all.
Sander Rijken
A: 

If you're trying to reuse a central file, you can use the svn:externals property. Commit the file to some central place in your repository tree, and then create an svn:externals property to the file (or maybe better its parent directory). That way you can commit it from everywhere (also the locations where its being pulled in by svn:externals), and reuse it.

Sander Rijken