update
[linguofeng.github.com.git] / pages / tools / svn.md
blobe23b3e16565d1736afad353fb68e605d6562bf75
1 ---
2 layout: default
3 category: Tools
4 title: "Subversion"
5 description: "版本管理工具"
6 ---
8 <section>
9     <div class="page-header">
10         <h3>一、安装</h3>
11     </div>
13 <pre>
14 $ sudo apt-get install subversion libapache2-svn
15 $ sudo vim /etc/apache2/mods-available/dav_svn.conf
16 </pre>
18 <pre>
19 <Location /svn>
20 DAV svn
21 SVNListParentPath on
22 SVNParentPath /home/linguofeng/repository/svn/
23 </Location>
24 </pre>
26 <pre>
27 $ cd ~/repository/svn
28 $ svnadmin create test
29 $ sudo chown -R www-data test       // 更改用户组可通过apache2访问
30 $ sudo chmod -R g+rws test          // 可读写
31 </pre>
32 </section>
34 <section>
35     <div class="page-header">
36         <h3>二、配置</h3>
37     </div>
38     <h4><small>2.1</small> 修改svn diff为vim diff</h4>
39 <pre>
40 $ sudo vim /usr/local/bin/svndiff
41 </pre>
42 <pre>
43 #!/bin/sh
44 # 配置你喜欢的diff程序路径
45 DIFF="gvimdiff"
46 # SVN diff命令会传入两个文件的参数
47 LEFT=${6}
48 RIGHT=${7}
49 # 拼接成diff命令所需要的命令格式
50 $DIFF $LEFT $RIGHT
51 </pre>
52 <pre>
53 $ sudo chmod 777 /usr/local/bin/svndiff
54 $ vim ~/.subversion/config
55 </pre>
56 <pre>
57 diff-cmd = /usr/local/bin/svndiff
58 </pre>
59 </section>
60 <p>参考:https://help.ubuntu.com/community/Subversion</p>
62 <section>
63     <div class="page-header">
64         <h3>三、常用命令</h3>
65     </div>
66     <h4><small>3.1</small> 查看服务器列表</h4>
67 <pre>
68 $ svn ls svn://127.0.0.1/svn
69 </pre>
71     <h3><small>3.2</small> 检出</h3>
72 <pre>
73 $ svn checkout svn://127.0.0.1/svn
74 </pre>
75 </section>