在Ubuntu18.04上使用SVN
一、SVN安装与卸载
svn安装:
~$sudo apt-get update
~$sudo apt-get install subversion
- 1
- 2
检查是否安装成功:
通过查看svn版本信息来验证
~$svnserve –version
- 1
或者通过以下方式查看是否安装成功
~$ ps aux | grep svnserve
- 1
svn卸载:
~$sudo apt-get remove –purge subversion
- 1
二、创建SVN版本库
- 在home下创建svn文件夹
~$sudo mkdir /home/svn
- 1
- 在svn下创建repository文件夹,作为我们创建版本库对应的目录
~$sudo mkdir /home/svn/repository
- 1
- 更改repository文件夹权限,否则会出现客户端访问服务器被拒的情况
~$sudo chmod -R 777 /home/svn/repository
- 1
- 创建版本库,可创建多个自定义的库,添加新库不需要重启svn服务,以下是创建名叫repository的版本库
~$sudo svnadmin create /home/svn/repository
- 1
完成后,会在repository文件夹下生成以下这些文件,每个版本库在创建时都会产生以下这些文件,我们可以通过这些文件控制我们的版本库,如为版本库配置用户、分配权限等等
~$ ls /home/svn/repository
conf db format hooks locks README.txt
- 1
- 2
(1)对生成的db文件进行权限设置,否则会出现使用不了版本库的情况,如导入项目会报没有权限,其实就没有权限写db这个文件
~$ sudo chmod -R 777 /home/svn/repository/db
- 1
(2)通过conf/svnserve.conf文件设置访问权限:
~$ sudo vim /home/svn/repository/conf/svnserve.conf
- 1
具体按如下修改:
#匿名用户可读
anon-access = read(改成none,不可读)
#权限用户可写
auth-access = write
#密码文件为passwd,用户名口令文件
password-db = passwd
#权限文件为authz
authz-db = authz
注意:配置时前掉前面的#号后,要顶格。
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
(3)通过conf/passwd文件为版本库添加用户
添加格式:前面是svn账号后面是密码
~$ sudo vim /home/svn/repository/conf/passwd
[users]
# harry = harryssecret
# sally = sallyssecret
wongkyunban = qazwsx1
svnadmin = 123456
- 1
- 2
- 3
- 4
- 5
- 6
- 7
上面添加两个用户wongkyunban、svnadmin
(4)通过conf/authz文件设置用户权限
组和用户的设置,一个组group可以包含一个和多个用户,其中用户名必须在用户配置文件(conf/passwd)中已经定义的。可以指定具体的组,如开发组(development)、运维组(maintenance);
版本库的目录格式配置及权限分配,格式:
[版本库 :/项目/目录]
用户名=权限
@组名=权限
- 1
- 2
- 3
权限:r、w、rw、空(空代表没有任何权限)
版本库目录有多种写法:
a. 如果只写根”/”,则代表对这个项目及下边所有目录都有权限;其中根”/”是svn启动时,”-r”参数指定的版本库。
b. 如果单独制定目录,可以加上具体目录名。
举例:
[repo:/]:表示对repo下所有版本库设置权限权限
[repo:/CompanyA]:表示对repo版本库下的CompanyA项目设置权限
[repo:/CompanyA/demo]:表示对repo版本库下的CompanyA项目的demo目录设置权限
本例子的conf/authz配置如下:
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = svnadmin
development = wongkyunban
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[repository:/]
@admin = rw
@development = rw
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
至此我们就创建好repository版本库了,要创建更多的版本库,就按上面的步骤来就行了。
三、启动svn服务器
~$svnserve -d -r /home/svn
- 1
四、停止服务器
~$killall svnserve
- 1
五、导入、导出工程
要检查所用账号是否已在将用到的版本库的conf/passwd文件配置了,并确保所有用账号已在对应版本库的conf/authz文件中分配了相应权限。
导入项目:
~$ mkdir MyProject
~$ mkdir MyProject/ProjectA
~$ mkdir MyProject/ProjectB
~$ svn import MyProject svn://localhost/repository/MyProject -m "first import project"
Adding MyProject/ProjectA
Adding MyProject/ProjectB
Committing transaction...
Committed revision 2.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
检查版本库的的项目列表
$ svn list svn://localhost/repository
MyProject/
- 1
- 2
导出项目:
~/Desktop$ svn checkout svn://localhost/repository/MyProject
A MyProject/ProjectA
A MyProject/ProjectB
Checked out revision 2.
SVN的命令
- add:add PATH …
add命令是用于把文件或目录置于版本控制下,以备后续提交到版本库中,即下一次提交(commit)时这些文件或目录就会被提交到版本库中。如:
~/Desktop/MyProject/ProjectA$ svn add readme.txt
A readme.txt
- 1
- 2
- auth:
管理本地凭证,通过登录过svn就会在本地缓存中留下凭证,下次不用再输入了。
用法 1: svn auth [PATTERN …]
用法2: svn auth --remove PATTERN [PATTERN …]
// 后在不跟参数,就会列出所有本地凭证
~$ svn auth
------------------------------------------------------------------------
Credential kind: svn.simple
Authentication realm: <svn://localhost:3690> ac090d87-7adc-46c2-8db4-6c69f69daf66
Password cache: gpg-agent
Username: csair
------------------------------------------------------------------------
Credential kind: svn.simple
Authentication realm: <svn://127.0.0.1:3690> 8c9352f7-a95d-4dec-b547-4529cc769ddb
Password cache: simple
Password: [not shown]
Username: wongkyunban
// 显示凭证的密码
~/Desktop/MyProject$ svn auth --show-passwords
------------------------------------------------------------------------
Credential kind: svn.simple
Authentication realm: <svn://127.0.0.1:3690> 8c9352f7-a95d-4dec-b547-4529cc769ddb
Password cache: simple
Password: qazwsx1
Username: wongkyunban
// 删除本地凭证
~/Desktop/MyProject$ svn auth --remove *simple*
Deleting svn.simple credential for realm '<svn://localhost:3690> 8c9352f7-a95d-4dec-b547-4529cc769ddb'
Deleting svn.simple credential for realm '<svn://localhost:3690> ac090d87-7adc-46c2-8db4-6c69f69daf66'
Deleting svn.simple credential for realm '<svn://127.0.0.1:3690> 8c9352f7-a95d-4dec-b547-4529cc769ddb'
Deleted 3 matching credentials from '/home/kyun/.subversion'
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- checkout :checkout URL… [PATH]
从版本库中签出项目
// 把项目签出到/home/Documents目录下,如果不指定,则答出到当前目录下
~/Desktop/MyProject/ProjectA$ sudo svn checkout svn://localhost/repository/MyProject /home/Documents
A /home/Documents/ProjectA
A /home/Documents/ProjectA/Test.java
A /home/Documents/ProjectA/readme.txt
A /home/Documents/ProjectB
A /home/Documents/trunk
Checked out revision 5.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- info:info [TARGET[@REV]…]
显示本地或服务上的信息
/home/Documents$ svn info
Path: .
Working Copy Root Path: /home/Documents
URL: svn://localhost/repository/MyProject
Relative URL: ^/MyProject
Repository Root: svn://localhost/repository
Repository UUID: 8c9352f7-a95d-4dec-b547-4529cc769ddb
Revision: 5
Node Kind: directory
Schedule: normal
Last Changed Author: wongkyunban
Last Changed Rev: 5
Last Changed Date: 2019-08-26 21:34:12 +0800 (一, 26 8月 2019)
/home/Documents$ svn info svn://localhost/repository/MyProject
Path: MyProject
URL: svn://localhost/repository/MyProject
Relative URL: ^/MyProject
Repository Root: svn://localhost/repository
Repository UUID: 8c9352f7-a95d-4dec-b547-4529cc769ddb
Revision: 5
Node Kind: directory
Last Changed Author: wongkyunban
Last Changed Rev: 5
Last Changed Date: 2019-08-26 21:34:12 +0800 (一, 26 8月 2019)
/home/Documents$ svn info ProjectA
Path: ProjectA
Working Copy Root Path: /home/Documents
URL: svn://localhost/repository/MyProject/ProjectA
Relative URL: ^/MyProject/ProjectA
Repository Root: svn://localhost/repository
Repository UUID: 8c9352f7-a95d-4dec-b547-4529cc769ddb
Revision: 5
Node Kind: directory
Schedule: normal
Last Changed Author: wongkyunban
Last Changed Rev: 5
Last Changed Date: 2019-08-26 21:34:12 +0800 (一, 26 8月 2019)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- cat:cat TARGET
显示指定文件或URL指定的文件的内容
/home/Documents$ svn cat svn://localhost/repository/MyProject/ProjectA/readme.txt
This is a demo for client
Hello world
- 1
- 2
- 3
- 4
- changelist
用法 1: changelist CLNAME PATH…
用法2: changelist --remove PATH…
把改变的列表分组,方便代码提交,不是一个文件一个文件而是按分组来提交代码
// 把readme.txt Test.java关联到mychangelist
~/Desktop/MyProject/ProjectA$ svn changelist mychangelist readme.txt Test.java
A [mychangelist] readme.txt
A [mychangelist] Test.java
kyun@kyun-HP-348-G3:~/Desktop/MyProject/ProjectA$ vim readme.txt
// 整组提交
kyun@kyun-HP-348-G3:~/Desktop/MyProject/ProjectA$ svn commit --changelist mychangelist -m "readme.txt add ok"
Sending readme.txt
Transmitting file data .done
Committing transaction...
Committed revision 6.
// 移除关联
~/Desktop/MyProject/ProjectA$ svn changelist --remove Test.java
D [mychangelist] Test.java
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- cleanup:cleanup [WCPATH…]
递归本地副本,移除写锁,继续执行未完成的操作。
/home/Documents$ svn cleanup
svn: E200031: sqlite[S8]: attempt to write a readonly database
svn: E200042: Additional errors:
svn: E200031: sqlite[S8]: attempt to write a readonly database
// 当出现不述错误时,其实是当前用户对/home/Documents目录没有权限,可以使用sudo临时提升一下权限
/home/Documents$ sudo svn cleanup
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- commit:commit [PATH…]
将本地副本的变化 发送到版本库。
// 提交副本的所有变化
~/Desktop/MyProject/ProjectA$ svn commit
Log message unchanged or not specified
(a)bort, (c)ontinue, (e)dit:
c
Adding readme.txt
Transmitting file data .done
Committing transaction...
Committed revision 3.
// 只提交Test.java的变化
~/Desktop/MyProject/ProjectA$ svn commit Test.java
Adding Test.java
Transmitting file data .done
Committing transaction...
Committed revision 4.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- update:update [PATH…]
把版本库上的变化更新到本地
// 更新所有变化
~/Desktop/MyProject/ProjectA$ svn update
Updating '.':
At revision 4.
// 只更新某个文件的变化
~/Desktop/MyProject/ProjectA$ svn update Test.java
Updating 'Test.java':
At revision 4.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- blame:blame [-rM:N] TARGET
显示每一行的修改版本号和修改人、修改内容
~/Desktop/MyProject/ProjectA$ svn blame Test.java 4 wongkyunba public class Test{ 5 wongkyunba private String name; 5 wongkyunba private String type; 5 wongkyunba private int age; 5 wongkyunba private addr; 5 wongkyunba private code; 5 wongkyunba private String phone; 5 wongkyunba private String email; 5 wongkyunba 4 wongkyunba }
//显示从版本3到4的修改人和修改内容
~/Desktop/MyProject/ProjectA$ svn blame -r 3:4 Test.java 4 wongkyunba public class Test{ 4 wongkyunba }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- list:list [TARGET[@REV]…]
列出版本库的目录入口
/home/Documents$ svn list svn://localhost/repository
MyProject/
- 1
- 2
- mkdir: Create a new directory under version control.
用法 1: mkdir PATH…
用法2: mkdir URL…
创建新目录,并将其置于版本控制下。
// 在版本库下创建新目录
/home/Documents$ svn mkdir svn://localhost/repository/branches -m "create branches directory"
Committing transaction...
Committed revision 7.
/home/Documents$ svn list svn://localhost/repository
MyProject/
branches/
// 在本地副本(从版本库中签出的)
/home/Documents$ sudo svn mkdir tags
[sudo] password for kyun:
A tags
/home/Documents$ ls
ProjectA ProjectB tags trunk
/home/Documents$ sudo svn commit -m "在本地创建了一个目录, 提交到svn版本库上"
Adding tags
Committing transaction...
Committed revision 8.
/home/Documents$ svn list svn://localhost/repository/MyProject
ProjectA/
ProjectB/
tags/
trunk/
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- lock:lock TARGET…
锁定工作副本或者锁定版本库,这样其他人就不可以提交变化到版本库上。只能对文件进行锁定。
// 如果当前文件如readme.txt在版本库有最新版,则锁定不了,要更新到最新版后,方能锁定。这是锁定本地副本的,实际会对版本库的文件也锁定了
/home/Documents$ sudo svn lock ProjectA/readme.txt
'readme.txt' locked by user 'wongkyunban'.
// 锁定版本库中的文件
/home/Documents$ sudo svn lock svn://localhost/repository/MyProject/ProjectA/readme.txt
- 1
- 2
- 3
- 4
- 5
- unlock:unlock TARGET
解锁
// 同时版本库上的文件也会被解锁
/home/Documents$ sudo svn unlock ProjectA/readme.txt
'readme.txt' unlocked.
- 1
- 2
- 3
- copy:copy SRC[@REV]… DST
复制
/home/Documents$ sudo svn copy svn://localhost/repository/MyProject/ProjectA svn://localhost/repository/trunk
Committing transaction...
Committed revision 9.
/home/Documents$ svn list svn://localhost/repository/trunk
Test.java
readme.txt
- 1
- 2
- 3
- 4
- 5
- 6
- delete:
用法1: delete PATH…
用法2:delete URL…
删除
/home/Documents$ sudo svn delete svn://localhost/repository/trunk
Committing transaction...
Committed revision 10.
- 1
- 2
- 3
- 4
- diff:显示两个版本或两个路径的改变或不同点
/home/Documents$ svn diff -r 4:8
Index: ProjectA/Test.java
===================================================================
--- ProjectA/Test.java (revision 4)
+++ ProjectA/Test.java (revision 8)
@@ -1,2 +1,10 @@
public class Test{
+ private String name;
+ private String type;
+ private int age;
+ private addr;
+ private code;
+ private String phone;
+ private String email;
+
}
Index: ProjectA/readme.txt
===================================================================
--- ProjectA/readme.txt (revision 4)
+++ ProjectA/readme.txt (revision 8)
@@ -1,2 +1,3 @@
This is a demo for client
+Ok
Hello world
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- export:
用法:
- export [-r REV] URL[@PEGREV] [PATH]
- export [-r REV] PATH1[@PEGREV] [PATH2]
导出一个不带版本控制的版本。
/home/Documents$ sudo svn export svn://localhost/repository/MyProject/ProjectA ~/Desktop/ProjectA
A /home/kyun/Desktop/ProjectA
A /home/kyun/Desktop/ProjectA/Test.java
A /home/kyun/Desktop/ProjectA/readme.txt
Exported revision 10.
- 1
- 2
- 3
- 4
- 5
- 6
- import:import [PATH] URL
导入项目
~$ svn import MyProject svn://localhost/repository/MyProject -m "first import project"
- 1
- log:
- log [PATH][@REV]
- log URL[@REV] [PATH…]
显示提交日志
/home/Documents$ svn log svn://localhost/repository
- 1
- merge
用法:
- merge SOURCE[@REV] [TARGET_WCPATH]
- merge [-c M[,N…] | -r N:M …] SOURCE[@REV] [TARGET_WCPATH]
- merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]
将其他分支的修改合并当前本地的副本中来。
// 创建两个分支
~/Desktop/TestMerge$ svn copy svn://localhost/repository/MyProject/ProjectA svn://localhost/repository/branches/A_Project
Committing transaction...
Committed revision 11.
~/Desktop/TestMerge$ svn copy svn://localhost/repository/MyProject/ProjectA svn://localhost/repository/branches/B_Project
Committing transaction...
Committed revision 12.
~/Desktop/TestMerge$ svn list svn://localhost/repository/branches
A_Project/
B_Project/
// 签出分支
~/Desktop/TestMerge$ svn checkout svn://localhost/repository/branches/A_Project ./A_Project
A A_Project/Test.java
A A_Project/readme.txt
Checked out revision 12.
~/Desktop/TestMerge$ svn checkout svn://localhost/repository/branches/B_Project ./B_Project
A B_Project/Test.java
A B_Project/readme.txt
Checked out revision 12.
~/Desktop/TestMerge$ ls
A_Project B_Project
// 在B_Project分支上增加一个文件,并提交。
kyun@kyun-HP-348-G3:~/Desktop/TestMerge$ cd B_Project
kyun@kyun-HP-348-G3:~/Desktop/TestMerge/B_Project$ ls
readme.txt Test.java
kyun@kyun-HP-348-G3:~/Desktop/TestMerge/B_Project$ touch Hello.java
kyun@kyun-HP-348-G3:~/Desktop/TestMerge/B_Project$ echo "public class Hello{}" > Hello.java
kyun@kyun-HP-348-G3:~/Desktop/TestMerge/B_Project$ svn add Hello.java
A Hello.java
~/Desktop/TestMerge/B_Project$ svn commit
Adding Hello.java
Transmitting file data .done
Committing transaction...
Committed revision 13.
// 分支合并
~/Desktop/TestMerge$ cd A_Project
~/Desktop/TestMerge/A_Project$ svn merge svn://localhost/repository/branches/B_Project
--- Recording mergeinfo for merge of r11 into '.':
U .
--- Merging r12 through r13 into '.':
A Hello.java
--- Recording mergeinfo for merge of r12 through r13 into '.':
G .
~/Desktop/TestMerge/A_Project$ ls
Hello.java readme.txt Test.java
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- mergeinfo:
- mergeinfo SOURCE[@REV] [TARGET[@REV]]
- mergeinfo --show-revs=WHICH SOURCE[@REV] [TARGET[@REV]]
显示合并的相关信息
~/Desktop/TestMerge/A_Project$ svn mergeinfo svn://localhost/repository/branches/B_Project youngest common ancestor | last full merge | | tip of branch | | | repository path 10 13 | | --| |------------ branches/B_Project
... / \ --| |------------ branches/A_Project | WC
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- move :move SRC… DST
移动工作目录或版本库
/home/Documents$ svn mkdir svn://localhost/repository/trunk
Committing transaction...
Committed revision 14.
/home/Documents$ svn move svn://localhost/repository/MyProject svn://localhost/repository/trunk
Committing transaction...
Committed revision 15.
// 改名
/home/Documents$ svn move svn://localhost/repository/trunk/MyProject svn://localhost/repository
Committing transaction...
Committed revision 16.
/home/Documents$ svn delete svn://localhost/repository/trunk
Committing transaction...
Committed revision 17.
/home/Documents$ svn move svn://localhost/repository/MyProject svn://localhost/repository/trunk
Committing transaction...
Committed revision 18.
/home/Documents$ svn list svn://localhost/repository
branches/
trunk/
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
-
status :status [PATH…]
显示工作目录的文件、目录状态信息,状态信息标识:‘A’ 添加
‘C’ 冲突
‘D’ 删除
‘I’ 忽略
‘M’ 修改
‘R’ 替换
‘X’ an unversioned directory created by an externals definition
‘?’ 未加入版本控制
‘!’ 缺失,被删除了(不是通过svn删除的)
‘~’ versioned item obstructed by some item of a different kind
‘L’ 写被锁住了
‘+’ 历史提交的,就是当前这一份是一份拷贝
‘S’ 有一个url关联到父级
‘X’ a versioned file created by an eXternals definition
‘K’ 被工作副本锁住了,但是锁可能被盗或已损坏
‘K’ 在版本库锁住了,但锁的持有人是工作副本
‘O’ 在版本库锁住了,但锁的持有人是其他工作副本
‘T’ 在版本库锁住了,工作副本持有的锁被盗了
‘B’ 在版本库没锁住了,但工作副本持有的锁坏了
~/Desktop/TestMerge/A_Project$ svn status -v
M 12 11 wongkyunban .
A + - 13 wongkyunban Hello.java 12 5 wongkyunban Test.java 12 6 wongkyunban readme.txt
- 1
- 2
- 3
- 4
- 5
- 6
- switch
- switch URL[@PEGREV] [PATH]
- switch --relocate FROM-PREFIX TO-PREFIX [PATH…]「不再使用了,使用relocate代替」
改变当前工作目录所指向的分支,这些分支必须都是在同一个版本库下的。svn的特点是以副本来作为分支的,所以不同分支这前之间都是大同小异,因此在同一个目录下进行分支切换只需要把差异部分反映过来即可。
~/Desktop/TestMerge/A_Project$ svn info
Path: .
Working Copy Root Path: /home/kyun/Desktop/TestMerge/A_Project
URL: svn://localhost/repository/branches/A_Project
Relative URL: ^/branches/A_Project
Repository Root: svn://localhost/repository
Repository UUID: 8c9352f7-a95d-4dec-b547-4529cc769ddb
Revision: 12
Node Kind: directory
Schedule: normal
Last Changed Author: wongkyunban
Last Changed Rev: 11
Last Changed Date: 2019-08-27 01:06:13 +0800 (二, 27 8月 2019)
// 切换
~/Desktop/TestMerge/A_Project$ svn switch svn://localhost/repository/branches/B_Project
// 结果
~/Desktop/TestMerge/A_Project$ svn info
Path: .
Working Copy Root Path: /home/kyun/Desktop/TestMerge/A_Project
URL: svn://localhost/repository/branches/B_Project
Relative URL: ^/branches/B_Project
Repository Root: svn://localhost/repository
Repository UUID: 8c9352f7-a95d-4dec-b547-4529cc769ddb
Revision: 18
Node Kind: directory
Schedule: normal
Last Changed Author: wongkyunban
Last Changed Rev: 13
Last Changed Date: 2019-08-27 01:10:53 +0800 (二, 27 8月 2019)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- relocate:
用法
- relocate FROM-PREFIX TO-PREFIX [PATH…]
- relocate TO-URL [PATH]
将工作副本指向另一个不同的版本库根URL。通常在svn版本库迁移后,需要重新指定本地的工作目录指向的svn地址。
// 修改svn地址前缀,将http://改为svn:// ,应用在project1和project2上
svn relocate http:// svn:// project1 project2
// 使用新地址http://www.example.com/repo/project代替svn://svn.example.com/repo/project
svn relocate http://www.example.com/repo/project svn://svn.example.com/repo/project
- 1
- 2
- 3
- 4
- resolved:resolved PATH…
移除工作目录的冲突状态
// 递归移除工作目录的冲突
~/Desktop/MyProject/ProjectA$ svn resolved -R ~/Desktop/MyProject/ProjectA
- 1
- 2
- revert:revert PATH…
恢复工作目录的原始状态,可以加-R进行递归恢复,但不建议,因为你最新修改的部分就丢失,恢复的位置就是PATH所指的具体位置。在恢复时,如果有冲突标识,它会将它们移除。相当于undo local changes。
~/Desktop/MyProject/ProjectA$ svn revert ~/Desktop/MyProject/ProjectA/Ha.txt
Reverted 'Ha.txt'
- 1
- 2
- 3
- resolve:resolve [PATH…]
以交互的方式,解决冲突
~/Desktop/MyProject/ProjectA$ svn resolve readme.txt
- 1
以下几个命令,感觉不常用到,就不做介绍了:
patch
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
如有错误,欢迎指正。
谢谢大家来阅读。
文章来源: blog.csdn.net,作者:WongKyunban,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/weixin_40763897/article/details/100084429
- 点赞
- 收藏
- 关注作者
评论(0)