linux+svn+拉取版本_在linux客户端下管理svn版本库
把linux作為客戶端管理svn版本庫,不一定是svn服務器。
1.svn管理命令用法:[root@xiaoyu ~]# svn --help
usage: svn [opations] [args]
Subversion command-line client, version 1.7.14.
Type 'svn help ' for help on a specific subcommand.
Type 'svn --version' to see the program version and RA modules
or 'svn --version --quiet' to see just the version number.
Most subcommands take file and/or directory arguments, recursing
on the directories. ?If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.
Available subcommands:
add
blame (praise, annotate, ann)
cat
changelist (cl)
checkout (co) ? ==>從源碼庫去除一個工作版本的拷貝
cleanup
commit (ci) ? ?==>提交當前工作拷貝的改變,這個地方有可能出現代碼沖突
copy (cp)
delete (del, remove, rm)
diff (di)
export
help (?, h)
import
info
list (ls)
lock
log
merge
mergeinfo
mkdir
move (mv, rename, ren)
patch
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
relocate
resolve
resolved
revert
status (stat, st)
switch (sw)
unlock
update (up) ? ==>將從svn server端文件同步到本地
upgrade
Subversion is a tool for version control.
For additional information, see http://subversion.apache.org/
[root@xiaoyu ~]#
2.從SVN庫提取數據:(1)將文件checkout到本地目錄:
svn ?checkout(co) ?remotepath ?localpath
例如:
[root@xiaoyu ~]# svn co svn://192.168.1.10/project /svn/ --username=xiaoyu --password=123456 ? ==>等價于svn co svn://192.168.1.10/project /svn/ --username=xiaoyu --password=123456
-----------------------------------------------------------------------
ATTENTION! ?Your password for authentication realm:
513c765e-d03b-4eaf-bede-c8deb7c56a29
can only be stored to disk unencrypted! ?You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. ?See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
A ? ?/svn/SVN Windows客戶端保存密碼的位置.txt
A ? ?/svn/xioyu.txt
Checked out revision 4.
[root@xiaoyu ~]# ll /svn/
total 4
-rw-r--r--. 1 root root 25 Sep 21 10:44 SVN Windows客戶端保存密碼的位置.txt
-rw-r--r--. 1 root root ?0 Sep 21 10:44 xioyu.txt
提示:如果報錯:svn ?Can't convert ?string from 'UTF-8' to native encoding:
原因:字符集問題
解決方法:注意調整CRT字符集
epport LC_CTYPE="en_US.UTF-8"
export ?LC_ALL=
或通過LANG解決
3.查看svn中的數據[root@xiaoyu ~]# svn list svn://192.168.1.10/project ? ==>等價于svn ls svn://192.168.1.10/project
SVN Windows客戶端保存密碼的位置.txt
syt.txt
xioyu.txt
[root@xiaoyu ~]# svn list svn://192.168.1.10/project --username=xiaoyu --password=123456 ?==>等價于svn ls svn://192.168.1.10/project --username=xiaoyu --password=123456
SVN Windows客戶端保存密碼的位置.txt
syt.txt
xioyu.txt
[root@xiaoyu ~]# svn list svn://192.168.1.10/project --username=xiaoyu --password=123456 --verbose
5 xiaoyu ? ? ? ? ? ? ? ?Sep 21 10:47 ./
2 xiaoyu ? ? ? ? ? ? 25 Sep 20 15:38 SVN Windows客戶端保存密碼的位置.txt
5 xiaoyu ? ? ? ? ? ? ?0 Sep 21 10:47 syt.txt
3 xiaoyu ? ? ? ? ? ? ?0 Sep 20 15:46 xioyu.txt
[root@xiaoyu ~]# svn cat svn://192.168.1.10/project/xiaoyu.txt ?==>查看文件中的內容
svn
4.從linux客戶端本地提交數據到svn[root@xiaoyu svn]# svn add a b c d e f
A ? ? ? ? a
A ? ? ? ? b
A ? ? ? ? c
A ? ? ? ? d
A ? ? ? ? e
A ? ? ? ? f
[root@xiaoyu svn]# svn ci -m "svn data commit"
Adding ? ? ? ? a
Adding ? ? ? ? b
Adding ? ? ? ? c
Adding ? ? ? ? d
Adding ? ? ? ? e
Adding ? ? ? ? f
Transmitting file data ......
Committed revision 8.
提示:
==>-m "svn data commit" ?必須接-m參數,-m參數后面的內容自定義,否則不能提交
通過windows客戶端查看svn服務器上是否有上述提交的數據:
5.svn import:[root@xiaoyu?~]#?mkdir?-p?/svn/trunk?/svn/branch?/svn/tag??==>trunk:主干??branch:分支??tag:標記
[root@xiaoyu?~]#?ll?/svn/
total?0
drwxr-xr-x.?2?root?root?6?Sep?21?11:18?branch
drwxr-xr-x.?2?root?root?6?Sep?21?11:18?tag
drwxr-xr-x.?2?root?root?6?Sep?21?11:18?trunk
將trunk:主干??branch:分支??tag:標記導入到svn服務器:
[root@xiaoyu?~]#?svn?import?/svn?svn://192.168.1.10/project?-m?"import"
Adding?????????/svn/branch
Adding?????????/svn/trunk
Skipped?'/svn/.svn'
Adding?????????/svn/tag
提示:
==>如果本地是svn服務器,等價于:svn import /svn file:///application/svndata/project -m "import"
6.svn copy:從trunk主干復制到分支branch:[root@xiaoyu svn]# svn copy svn://192.168.1.10/project ?svn://192.168.1.10/project/branch/branch_01 -m "create a branch from trunk" --username=xiaoyu --password=123456
Committed revision 12.
總結
以上是生活随笔為你收集整理的linux+svn+拉取版本_在linux客户端下管理svn版本库的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jenkins修改pom文件_jenki
- 下一篇: java 拼接html_程序员用1.5小