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 */
$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:
$ 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.
$svn merge -r 343:344 http://svn.example.com/repos/calc/trunk/* merge version 343 and 344 branche */
U integer.c
$ svn status
M integer.c
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.
$ svn log --verbose --stop-on-copy/
http://svn.example.com/repos/calc/branches/my-calc-branch
…
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:
$ cd calc/trunk
$ svn update
At revision 405.
$ svn merge -r 341:405 http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile
$ svn status
M integer.c
M button.c
M Makefile
# ...examine the diffs, compile, test, etc...
$ svn commit-m "Merged my-calc-branch changes r341:405 into the trunk."
Sending integer.c
Sending button.c
Sending Makefile
Transmitting file data ...
Committed revision 406.
2.4.2 Change modification:
$svn merge -r303:302http://svn.example.com/repos/calc/trunk
U integer.c
$svn status
M integer.c
$ svn diff
…
# verify that the change is removed
…
$ svn commit -m "Undoing change committed in r303."
Sending integer.c
2.5 Tag:
2.5.1 Build a base tag
“svn copy” again enter. You hope upbuild a “/calc/trunk” snapshot,in fact, it is copying in the /calc/tag directory.
$ 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
$ svnlook info /path/to/repos
svnadmin– “admin’s friend”
$ svnadmin help
general usage: svnadmin SUBCOMMAND REPOS_PATH [ARGS & OPTIONS ...]
Type "svnadmin help " for help on a specific subcommand.
Available subcommands:
create -- “st up a new subversion repository”
deltify --订版本范围内,对其中修改过的路径做增量化操作。如果没有指定修订版本,这条命令会修改HEAD修订版本。
dump --库修订一定版本范围内的内容,使用可移植转储格式。
hotcopy --做热拷贝,用这个方法你能任何时候安全的备份版本库而无需考虑是否正在使用。
3.2 svndumpfilter
$ svndumpfilter help
general usage: svndumpfilter SUBCOMMAND [ARGS & OPTIONS ...]
Type "svndumpfilter help " for help on a specific subcommand.
Available subcommands:
exclude
include
help (?,h)
exclude
将指定路径的数据从转储数据流中排除。
include
将指定路径的数据添加到转储数据流中。
假设有一个包含三个项目的版本库:calc,calendar,和spreadsheet。它们在版本库中的布局如下:
/
calc/
trunk/
branches/
tags/
calendar/
trunk/
branches/
tags/
spreadsheet/
trunk/
branches/
tags/