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?
-
It sounds somehow possible to do this for the initial commit, but do these files also need to be linked afterwards (i.e. change in one place, modify all of them)? For that I think you need trickery like SVN externals or local symlinks. – Thilo Oct 23 '10 at 11:25
-
Its only for the initial commit i.e. place it in one of the required folders and then it should get committed to multiple folders. – user475685 Oct 23 '10 at 11:37
3 Answers
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.

- 1,867
- 1
- 20
- 36
-
I want to commit a single file in the same parent directory but different sub-directories. Is it possible? – user475685 Oct 23 '10 at 11:34
-
The OP wasn't going for multiple repositories if I understand it correctly. – Sander Rijken Oct 23 '10 at 14:00
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"

- 17,563
- 3
- 40
- 62
-
-
Hmm, now that I think about it, probably possible with a hook. I'll try to post a solution shortly. – Brandon Frohbieter Oct 23 '10 at 11:38
-
Changing what's being committed in pre commit hooks is **not** recommended at all. – Sander Rijken Oct 23 '10 at 14:01
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.

- 21,376
- 3
- 61
- 85