开发者

Is it possible to commit a single file to multiple directories which share the same parent directory using subversion

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 s开发者_开发知识库hould create copies in the required folders. Is it possible?


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.


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" 


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜