SVN Usage in Linux

来源:互联网 发布:java string转为map 编辑:程序博客网 时间:2024/04/30 09:59

http://www.php-oa.com/2008/03/12/svnminglingzailinuxxiadeshiyong.html

 

http://hi.baidu.com/panzhiqi/blog/item/178d0fcaa47d2582c8176828.html

 

1. 查看某个revision做的修改

 

svn diff -c revision_num file_name

或者用

svn diff -rXX:YY file_name

这样输出 XX 和 YY两个版本间的diff

 

2. 查看哪些文件被修改了

 

svn status

 

3. 输出diff

 

svn diff file

 

4. commit

 

svn commit -F log_file file1 file2

 

5. revert

 

svn revert file

 

6. update 更新

svn update file

 

7. 查看修改历史

svn log file

 

8. get a specific revision of file

svn update -r revision file

 

9. check out a single file

  svn checkout <url_of_big_dir> <target> --depth empty

  cd <target>
  svn up
<file_you_want>

 

10. 回滚某个版本的修改 或者

http://whynotwiki.com/Subversion_/_How_to_use_svn_merge

svn merge -r 11:10 ./ ./ 
将整个当前目录回滚到revision 10其实这个不是完全回到版本10, 而是将版本11做的改动取消掉了。
11. merge其他branch的修改到本地svn merge -c 7702 svn://trunk/THNBU/1.0.3/WAG310G_PT/rel
这样就把svn://branch上的7720的改动merge过来
12 SVN server Setupa. Create a Repository
svnadmin create svnrepos-path
例如
svnadmin create /opt/public/test
就在/opt/public/test目录下面建立了一个test的repository。
b. Create a SVN User
下面就是更改配置,来使用这个repository.
设置访问权限vi /opt/public/test/conf/svnserve.conf

In that file add these three lines:

anon-access = none

auth-access = write

password-db = passwd

分别表示
不验证的用户的权限验证用户的权限使用的用户名密码的文件,这样写表示用户名密码写在了passwd文件中。

Create a password file:

vi /opt/public/test/conf/passwd
In that file add a line for your user:# add users in the format : user = passwordtony = mypassword

c. Import Your Project  
(assuming you’ve put your project files in /projects/myrailsproject)
svn import -m "Initial import"  /projects/myrailsproject file:///svnrepos/myrailsproject
or
svn import -m "Initial import" /projects/myrailsproject svn://10.74.52.91/opt/subversion/public/test
d. Start the SVN Server as Daemon
svnserve -d

Done! You should now have a svn server running with one project named myrailsproject.

Try checking it out of the repository:

svn co svn://192.168.0.2/svnrepos/myyrailsproject
13 svn branch and taghttp://www.javaeye.com/topic/28013
需求一:有一个客户想对产品做定制,但是我们并不想修改原有的svn中trunk的代码。方法:用svn建立一个新的branches,从这个branche做为一个新的起点来开发 1.svn copy svn://server/trunk svn://server/branches/ep -m "init ep"Tip:如果你的svn中以前没有branches这个的目录,只有trunk这个,你可以用svn mkdir branches 新建个目录需求二:产品开发已经基本完成,并且通过很严格的测试,这时候我们就想发布给客户使用,发布我们的1.0版本

svn copy svn://server/trunk svn://server/tags/release-1.0 -m “1.0 released” 咦,这个和branches有什么区别,好像啥区别也没有?是的,branches和tags是一样的,都是目录,只是我们不会对这个release-1.0的tag做修改了,不再提交了,如果提交那么就是branches