管理svn服务器的步骤
Svn Repository Control
--by:liy,2006/11/2
1. summary:
版本库布局:
|
|--trunk –开发主线
|--tags --里程碑
|--branches -- 维护用
● 主线(trunk)一直处于开发状态,从1.0 -> 1.5 -> 2.0 .... ;
● 每当要测试或发布时,将主线拷贝一份为tags/1.0b1,tags/1.0b2,tags/1.0r ;
● 发布时,将主线拷贝一份为branches/branch1.0等,作为维护用 ;
● 在维护的版本(比如branch1.0)发现bug时,出那个维护版本,修改bug,提交;
● 同时,将这个维护版本合并到主线,提交。
2. Branche and Merge:
2.1 set up branche:
/* First, you should mkdir /repos/calc/branches/my-calc-branch qua your branche */
<Input command:>
$ svn copy http://svn.example.com/repos/calc/trunk /
http://svn.example.com/repos/calc/branches/my-calc-branch /
-m "Creating a private branch of /calc/trunk."
2.2 work on the branche:
<Input command:>
$ svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch
2.3 Merge branche:
The svn merge command nearly same as svn diff. But it does’nt print difference to your terminal. It direct change your local copyright.
<Input command:>
$ svn merge -r 343:344 http://svn.example.com/repos/calc/trunk /* merge version 343 and 344 branche */
<Output >
U integer.c
<Input command:>
$ svn status
<Output :>
M integer.c
<Note:>
Or if you consider the merge is false decision, you only need run “svn revert”;
If you consider the merge is right, you can commit your modification by “svn commit” command.
2.4 Merge one branche to another
For showing your modification on your branche, you only need compare initialization and final state.
a) find initialization of your branche.
<Input command:>
$ svn log --verbose --stop-on-copy /
http://svn.example.com/repos/calc/branches/my-calc-branch
<Output>
…
r341 | user | 2002-11-03 15:27:56 -0600 (Thu, 07 Nov 2002) | 2 lines
Changed paths:
A /calc/branches/my-calc-branch (from /calc/trunk:340)
b)final state is HEAD copyright.
2.4.1 This is merge process:
<Input command:>
$ cd calc/trunk
$ svn update
<Output>
At revision 405.
<Input command:>
$ svn merge -r 341:405 http://svn.example.com/repos/calc/branches/my-calc-branch
<Output>
U integer.c
U button.c
U Makefile
<Input command:>
$ svn status
<Output>
M integer.c
M button.c
M Makefile
# ...examine the diffs, compile, test, etc...
<Input command:>
$ svn commit -m "Merged my-calc-branch changes r341:405 into the trunk."
<Output>
Sending integer.c
Sending button.c
Sending Makefile
Transmitting file data ...
Committed revision 406.
2.4.2 Change modification:
<Input command:>
$ svn merge -r 303:302 http://svn.example.com/repos/calc/trunk
<Output>
U integer.c
<Input command:>
$ svn status
<Output>
M integer.c
<Input command:>
$ svn diff
<Output>
…
# verify that the change is removed
…
<Input command:>
$ svn commit -m "Undoing change committed in r303."
<Output>
Sending integer.c
2.5 Tag:
2.5.1 Build a base tag
<Note:>
“svn copy” again enter. You hope upbuild a “/calc/trunk” snapshot,in fact, it is copying in the /calc/tag directory.
<Input command:>
$ svn copy http://svn.example.com/repos/calc/trunk /
http://svn.example.com/repos/calc/tags/release-1.0 /
-m "Tagging the 1.0 release of the 'calc' project."
3.repository’s directory frame
3.1 workbox of administrator
<Input command:>
$ svnlook info /path/to/repos
<Note:>
svnadmin – “admin’s friend”
<Input command:>
$ svnadmin help
<Output>
general usage: svnadmin SUBCOMMAND REPOS_PATH [ARGS & OPTIONS ...]
Type "svnadmin help <subcommand>" for help on a specific subcommand.
Available subcommands:
create -- “st up a new subversion repository”
deltify --订版本范围内,对其中修改过的路径做增量化操作。如果没有指定修订版本,这条命令会修改HEAD修订版本。
dump -- 库修订一定版本范围内的内容,使用可移植转储格式。
hotcopy -- 做热拷贝,用这个方法你能任何时候安全的备份版本库而无需考虑是否正在使用。
3.2 svndumpfilter
<Input command:>
$ svndumpfilter help
<Output>
general usage: svndumpfilter SUBCOMMAND [ARGS & OPTIONS ...]
Type "svndumpfilter help <subcommand>" for help on a specific subcommand.
Available subcommands:
exclude
include
help (?, h)
<Note:>
exclude
将指定路径的数据从转储数据流中排除。
include
将指定路径的数据添加到转储数据流中。
<Example:>
假设有一个包含三个项目的版本库: calc,calendar,和 spreadsheet。它们在版本库中的布局如下:
/
calc/
trunk/
branches/
tags/
calendar/
trunk/
branches/
tags/
spreadsheet/
trunk/
branches/
tags/
现在要把这三个项目转移到三个独立的版本库中。首先,转储整个版本库:
<Input command:>
$ svnadmin dump /path/to/repos > repos-dumpfile
<Output>
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
* Dumped revision 3.
…
然后,将转储文件三次送入过滤器,每次仅保留一个顶级目录,就可以得到三个转储文件:
<Input command:>
$ cat repos-dumpfile | svndumpfilter include calc > calc-dumpfile
$ cat repos-dumpfile | svndumpfilter include calendar > cal-dumpfile
$ cat repos-dumpfile | svndumpfilter include spreadsheet > ss-dumpfile
3.3 svnshell.py
<Input command:>
$tools/examples/svnshell.py /path/to/repos
<Output>
<rev: 2 />$ help
Available commands:
cat FILE : dump the contents of FILE
cd DIR : change the current working directory to DIR
exit : exit the shell
ls [PATH] : list the contents of the current directory
lstxns : list the transactions available for browsing
setrev REV : set the current revision to browse
settxn TXN : set the current transaction to browse
youngest : list the youngest browsable revision number
<rev: 2 />$
3.4版本库清理
<Note:> txn-info.sh(异常事务报告)
<Input command:>
$vi txn-info.sh
<Output>
#!/bin/sh
### Generate informational output for all outstanding transactions in
### a Subversion repository.
REPOS="${1}"
if [ "x$REPOS" = x ] ; then
echo "usage: $0 REPOS_PATH"
exit
fi
for TXN in `svnadmin lstxns ${REPOS}`; do
echo "---[ Transaction ${TXN} ]-------------------------------------------"
svnlook info "${REPOS}" --transaction "${TXN}"
done
可以用下面的命令使用上例中脚本: /path/to/txn-info.sh /path/to/repos。
<Input command:>
$ txn-info.sh myrepos
<Output>
---[ Transaction 19 ]-------------------------------------------
sally
2001-09-04 11:57:19 -0500 (Tue, 04 Sep 2001)
0
---[ Transaction 3a1 ]-------------------------------------------
harry
2001-09-10 16:50:30 -0500 (Mon,
本文地址:http://www.45fan.com/dnjc/70985.html