svn鐗堟湰鎺у埗
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了svn鐗堟湰鎺у埗相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/windows%e6%9c%8d%e5%8a%a1' title='windows鏈嶅姟'>windows鏈嶅姟
foreign 涓婁紶 remove systemd detail 宸ョ▼ 鎵ц 绠$悊
Windows绯荤粺瀹夎svn
1銆乻vn涓嬭浇
https://sourceforge.net/projects/win32svn/
2銆侀獙璇佹槸鍚﹀畨瑁呮垚鍔?/h2>
C:Userslibingshen>svn --version
4銆佸惎鍔╯vn鏈嶅姟
5銆侀獙璇乻vn鏈嶅姟鏄惁鍚姩
svn鏈嶅姟鐩戝惉3690绔彛
6銆乻vn娉ㄥ唽涓篧indows鏈嶅姟
tip:绛夊彿宸﹁竟娌℃湁绌烘牸锛岀瓑鍙峰彸杈规湁涓€涓┖鏍笺€?/p>
C:WINDOWSsystem32>sc create MySVNService binpath= "C:Pmyprogramsvninsvnserve.exe --service -r D:mytestmysvn" start= auto depend= Tcpip
鍘熷洜锛氭瘡娆″惎鍔╯vn鏈嶅姟鏃跺繀椤诲惎鍔ㄤ竴涓猚md绐楀彛锛宑md绐楀彛涓€鍏抽棴锛宻vn鏈嶅姟灏卞叧闂€?/p>
闈炵鐞嗗憳杩愯鏃朵細澶辫触銆?/p>
绠$悊鍛樿繍琛?/p>
鍚姩銆佸仠姝€佸垹闄vn鏈嶅姟锛堢鐞嗗憳韬唤杩愯cmd锛?/p>
//鍚姩svn鏈嶅姟
C:WINDOWSsystem32>sc start MySVNService
//鍋滄鏈嶅姟
C:WINDOWSsystem32>sc stop MySVNService
//鍒犻櫎鏈嶅姟
C:WINDOWSsystem32>sc delete MySVNService
8銆佹彁浜ゆ枃浠?/h2>
--寮€鍚尶鍚嶆潈闄愯闂?/p>
--鍏堝皢鏂囦欢鍔犲叆鐗堟湰搴擄紝鐒跺悗鎻愪氦锛堥渶娣诲姞鎻愪氦鏃ュ織淇℃伅锛屼笉鐒舵姤閿欙級
svn commit 鍛戒护鏈€鍚庡彲浠ヤ笉鎸囧畾鍏蜂綋鏂囦欢锛屾鏃惰〃绀烘彁浜ゅ綋鍓嶅伐浣滃壇鏈腑
鐨勬墍鏈変慨鏀?/p>
9銆佹洿鏂?/h2>
鍙︿竴涓鎴风妫€鍑洪」鐩€佹洿鏂板苟鎻愪氦鏂囦欢
//杩滅▼鐗堟湰搴撳叿浣撲綅缃? svn://localhost/OA
//灏哋A妫€鍑哄埌鏈湴鐨勭洰褰?MyOA2
D:mytestmycheckout>svn checkout svn://localhost/OA MyOA2
--澶氱増鏈簱寮€鍚巿鏉冭闂?/p>
鍦ㄧ増鏈簱鏍圭洰褰?D:mytestmysvn 涓嬪垱寤?commConf 鐩綍
灏嗘湭淇敼鐨?authz 鍜?passwd 鏂囦欢鎷疯礉鍒?commConf 鐩綍涓? 淇敼闇€瑕佽缃潈闄愮殑鐗堟湰搴撶殑 svnserve.conf 鏂囦欢
鈶爌assword-db = ../../commConf/passwd
鈶uthz-db = ../../commConf/authz
passwd锛氳缃闂増鏈簱鐨勭敤鎴蜂俊鎭?/p>
authz锛氳缃敤鎴疯闂増鏈簱鐨勬潈闄?/p>
centos7绯荤粺瀹夎svn
鍒涘缓骞堕厤缃増鏈簱
鍦ㄧ増鏈簱鐩綍涓嬪垱寤哄叿浣撻」鐩洰褰?/h3>
[root@izm5eac6bnsz8uq175jkvez repository]# pwd
/opt/module/svn/repository
[root@izm5eac6bnsz8uq175jkvez repository]# ll
total 4
drwxr-xr-x 6 root root 4096 Oct 20 21:15 pro_oa
[root@izm5eac6bnsz8uq175jkvez repository]# mkdir pro_oa
閰嶇疆svn瀵瑰簲鐨勬湇鍔?/h2>
淇敼svn鏈嶅姟寮€鏈鸿嚜鍚粯璁ょ殑鐗堟湰搴撶洰褰?/h3>
鏌ョ湅svn鏈嶅姟鍚姩鐨勯厤缃枃浠惰矾寰?code>/etc/sysconfig/svnserve
[root@izm5eac6bnsz8uq175jkvez pro_oa]# cat /usr/lib/systemd/system/svnserve.service
[Unit]
Description=Subversion protocol daemon
After=syslog.target network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/svnserve
ExecStart=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid $OPTIONS
[Install]
WantedBy=multi-user.target
[root@izm5eac6bnsz8uq175jkvez pro_oa]#
淇敼svn鏈嶅姟鍚姩鐨勯厤缃枃浠讹紝鐗堟湰搴撶洰褰?code>OPTIONS="-r /opt/module/svn/repository"
[root@izm5eac6bnsz8uq175jkvez pro_oa]# cat /etc/sysconfig/svnserve
# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /opt/module/svn/repository"
[root@izm5eac6bnsz8uq175jkvez pro_oa]#
鍚姩svn鏈嶅姟
[root@izm5eac6bnsz8uq175jkvez pro_oa]# systemctl start svnserve.service
nginx: master
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 1223/nginx: master
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 843/svnserve
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1223/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 991/sshd
tcp6 0 0 :::8000 :::* LISTEN 1223/nginx: master
[root@izm5eac6bnsz8uq175jkvez pro_oa]# ps -ef|grep svn
root 843 1 0 Oct20 ? 00:00:00 /usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid -r /opt/module/svn/repository
root 2107 2029 0 09:31 pts/0 00:00:00 grep --color=auto svn
妫€鍑洪」鐩?/h2>
寮€鍙戜汉鍛?鍙凤紝妫€鍑洪」鐩?/p>
[root@izm5eac6bnsz8uq175jkvez harry]# mkdir -p /root/workspace/harry
[root@izm5eac6bnsz8uq175jkvez harry]# pwd
/root/workspace/harry
[root@izm5eac6bnsz8uq175jkvez harry]# svn checkout svn://192.168.1.101/pro_oa ./
寮€鍙戜汉鍛?鍙凤紝妫€鍑洪」鐩?/p>
[root@izm5eac6bnsz8uq175jkvez harry]# mkdir -p /root/workspace/sally
[root@izm5eac6bnsz8uq175jkvez sally]# pwd
/root/workspace/sally
[root@izm5eac6bnsz8uq175jkvez sally]# svn checkout svn://192.168.1.101/pro_oa ./
鎺堟潈璁块棶
杩涘叆鍒伴」鐩畇vn鐗堟湰搴擄紝鏌ョ湅鎺堟潈璁块棶鐨勫嚑涓浉鍏虫枃浠?/p>
[root@izm5eac6bnsz8uq175jkvez conf]# pwd
/opt/module/svn/repository/pro_oa/conf
[root@izm5eac6bnsz8uq175jkvez conf]# ll
total 16
-rw-r--r-- 1 root root 1080 Oct 20 21:15 authz
-rw-r--r-- 1 root root 309 Oct 20 21:15 passwd
-rw-r--r-- 1 root root 3089 Oct 20 22:31 svnserve.conf
-rw-r--r-- 1 root root 3090 Oct 20 22:28 svnserve.conf.20191020
[root@izm5eac6bnsz8uq175jkvez conf]#
鍖垮悕璁块棶
淇敼svnserve.conf
鏂囦欢
[root@izm5eac6bnsz8uq175jkvez conf]# ll
total 16
-rw-r--r-- 1 root root 1080 Oct 20 21:15 authz
-rw-r--r-- 1 root root 309 Oct 20 21:15 passwd
-rw-r--r-- 1 root root 3089 Oct 20 22:31 svnserve.conf
-rw-r--r-- 1 root root 3090 Oct 20 22:28 svnserve.conf.20191020
[root@izm5eac6bnsz8uq175jkvez conf]# vim svnserve.conf
anon-access = write
# auth-access = write
# password-db = passwd
# authz-db = authz
鎺堟潈璁块棶
淇敼svnserve.conf
鏂囦欢锛屽彇娑堜互涓嬫敞閲婏紝宸﹁竟涓嶇暀绌烘牸
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
淇敼passwd
鏂囦欢,閰嶇疆鐢ㄦ埛鍚嶃€佸瘑鐮?/p>
[users]
# harry = harryssecret
# sally = sallyssecret
ctp = ctp
zqc = zqc
ywc = ywc
slb=slb
淇敼authz
鏂囦欢锛屽紑鍚」鐩巿鏉?/p>
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = ctp,zqc,ywc,slb
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[pro_oa:/]
@admin = rw
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
鏂囦欢鍐茬獊琛ㄧ幇
涓嶅悓寮€鍙戜汉鍛樻搷浣滃悓涓€鏂囦欢
寮€鍙戜汉鍛?鍙?code>Harry
淇敼hello.txt
锛屼慨鏀瑰悗骞舵彁浜?/p>
[root@izm5eac6bnsz8uq175jkvez harry]# svn update
Updating '.':
At revision 3.
[root@izm5eac6bnsz8uq175jkvez harry]# vim hello.txt
[root@izm5eac6bnsz8uq175jkvez harry]# svn commit -m "conflict one commit"
Sending hello.txt
Transmitting file data .
Committed revision 4.
[root@izm5eac6bnsz8uq175jkvez harry]# cat hello.txt
sally
harray add
sally add two
harry add one conflict commit
[root@izm5eac6bnsz8uq175jkvez harry]#
寮€鍙戜汉鍛?鍙?code>Sally
涔熶慨鏀?code>hello.txt
锛屼慨鏀瑰悗骞舵彁浜わ紝鎻愮ず宸茶繃鏈燂紝鎵цsvn update
,鎻愮ず浜х敓鍐茬獊,杈撳叆p
琛ㄧず寤惰繜瑙e喅璇ラ棶棰?/p>
[root@izm5eac6bnsz8uq175jkvez sally]# ll
total 4
-rw-r--r-- 1 root root 32 Oct 20 22:53 hello.txt
[root@izm5eac6bnsz8uq175jkvez sally]# svn update
Updating '.':
At revision 3.
[root@izm5eac6bnsz8uq175jkvez sally]# vim hello.txt
[root@izm5eac6bnsz8uq175jkvez sally]# svn -m "conflict two commit"
Subcommand argument required
Type 'svn help' for usage.
[root@izm5eac6bnsz8uq175jkvez sally]# svn commit -m "conflict two commit"
Sending hello.txt
Transmitting file data .svn: E160028: Commit failed (details follow):
svn: E160028: File '/hello.txt' is out of date
[root@izm5eac6bnsz8uq175jkvez sally]# ll
total 4
-rw-r--r-- 1 root root 62 Oct 21 10:08 hello.txt
[root@izm5eac6bnsz8uq175jkvez sally]# svn update
Updating '.':
Conflict discovered in '/root/workspace/sally/hello.txt'.
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options: p
C hello.txt
Updated to revision 4.
Summary of conflicts:
Text conflicts: 1
[root@izm5eac6bnsz8uq175jkvez sally]#
姝ゆ椂鍙戠幇澶氫簡鍑犱釜鏂囦欢锛?code>hello.txt
鍚堝苟鍚庣殑鍐茬獊鏂囦欢锛?code>hello.txt.mine
寮€鍙戜汉鍛?鍙风殑淇敼鏂囦欢锛?code>hello.txt.r3
鏈嶅姟鍣ㄤ笂鐨勭増鏈枃浠讹紝hello.txt.r4
寮€鍙戜汉鍛?鍙风殑淇敼鏂囦欢
[root@izm5eac6bnsz8uq175jkvez sally]# ll
total 16
-rw-r--r-- 1 root root 126 Oct 21 10:09 hello.txt
-rw-r--r-- 1 root root 62 Oct 21 10:09 hello.txt.mine
-rw-r--r-- 1 root root 32 Oct 21 10:09 hello.txt.r3
-rw-r--r-- 1 root root 62 Oct 21 10:09 hello.txt.r4
[root@izm5eac6bnsz8uq175jkvez sally]# cat hello.txt
sally
harray add
sally add two
<<<<<<< .mine
sally add two conflict commit
=======
harry add one conflict commit
>>>>>>> .r4
[root@izm5eac6bnsz8uq175jkvez sally]# cat hello.txt.mine
sally
harray add
sally add two
sally add two conflict commit
[root@izm5eac6bnsz8uq175jkvez sally]# cat hello.txt.r3
sally
harray add
sally add two
[root@izm5eac6bnsz8uq175jkvez sally]# cat hello.txt.r4
sally
harray add
sally add two
harry add one conflict commit
[root@izm5eac6bnsz8uq175jkvez sally]#
瑙e喅
鍒犻櫎澶氫綑鐨勬枃浠?code>hello.txt.mine
,hello.txt.r3
,hello.txt.r4
,淇敼鍚堝苟鍚庣殑鍐茬獊鏂囦欢hello.txt
鐩村埌婊℃剰涓烘
[root@izm5eac6bnsz8uq175jkvez sally]# ll
total 16
-rw-r--r-- 1 root root 126 Oct 21 10:09 hello.txt
-rw-r--r-- 1 root root 62 Oct 21 10:09 hello.txt.mine
-rw-r--r-- 1 root root 32 Oct 21 10:09 hello.txt.r3
-rw-r--r-- 1 root root 62 Oct 21 10:09 hello.txt.r4
[root@izm5eac6bnsz8uq175jkvez sally]# rm hello.txt.*
rm: remove regular file 鈥榟ello.txt.mine鈥? y
rm: remove regular file 鈥榟ello.txt.r3鈥? y
rm: remove regular file 鈥榟ello.txt.r4鈥? y
[root@izm5eac6bnsz8uq175jkvez sally]# ll
total 4
-rw-r--r-- 1 root root 126 Oct 21 10:09 hello.txt
[root@izm5eac6bnsz8uq175jkvez sally]# cat hello.txt
sally
harray add
sally add two
<<<<<<< .mine
sally add two conflict commit
=======
harry add one conflict commit
>>>>>>> .r4
[root@izm5eac6bnsz8uq175jkvez sally]# vim hello.txt
[root@izm5eac6bnsz8uq175jkvez sally]# cat hello.txt
sally
harray add
sally add two
sally add two conflict commit
harry add one conflict commit
[root@izm5eac6bnsz8uq175jkvez sally]# svn commit -m 'sally have solve conflict' hello.txt
Sending hello.txt
Transmitting file data .
Committed revision 5.
[root@izm5eac6bnsz8uq175jkvez sally]#
eclipse浣跨敤svn
瀹夎svn鎻掍欢
瀹夎subversive
瀹夎SVN Connector
svn榛樿鐢ㄦ埛鍚嶅拰瀵嗙爜淇濆瓨浣嶇疆
C:UsersshenlibingAppDataRoamingSubversionauthsvn.simple
濡傛灉浣跨敤eclipse
鐨勮瘽锛岃繛鎺ヨ祫婧愬簱鐨勬椂鍊欓€夋嫨璁颁綇鐢ㄦ埛鍚嶅拰瀵嗙爜锛岃繕浼氬湪浠ヤ笅璺緞瀛樹竴浠界敤鎴峰悕鍜屽瘑鐮佺殑淇℃伅
C:Usersshenlibing.eclipseorg.eclipse.equinox.security
鍥犳闇€瑕佸垹闄ゅ涓婁袱澶勪綅缃殑鍐呭锛岀劧鍚庨噸鍚?code>eclipse
娣诲姞蹇界暐鏂囦欢
椤圭洰--->鍙抽敭--->Team
--->Set Properties
鍏ㄥ眬娣诲姞蹇界暐鏂囦欢
杩涘叆鍒颁互涓嬬洰褰曪紝淇敼config
鏂囦欢
C:UsersshenlibingAppDataRoamingSubversion
寮€鍚叏灞€蹇界暐鏂囦欢娉ㄩ噴
global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__ *.rej *~ #*# .#* .*.swp .DS_Store *.iml .idea */.idea/* .classpath .settings */.settings/* .project target */target/*
寮€鍚悗eclipse
闇€瑕侀噸鍚紝濡傛灉鏄?code>eclipse
鍜?code>idea
鐨勮瘽锛?code>target鐩綍浼氳嚜鍔ㄥ拷鐣?/p>
鍒嗕韩涓婁紶椤圭洰
File
--->New
--->Project
,鏂板缓maven
椤圭洰
浣跨敤楠ㄦ灦
鎻愮ず缂哄皯web.xml
鏂囦欢
瑙e喅
椤圭洰--->鍙抽敭--->Java EE Tools
--->Generate Deployment Descriptor Stub
椤圭洰--->鍙抽敭--->Team
--->Share Project
,涓婁紶椤圭洰
閫夋嫨鐗堟湰宸ュ叿svn
閫夋嫨涓€涓凡缁忓瓨鍦ㄧ殑璧勬簮搴撲綅缃?/p>
纭宸ョ▼鏍圭洰褰曚笅瀛愮洰褰曞拰鏂囦欢鏄惁鍏ㄩ儴涓婁紶,鍏堝埆涓婁紶
娣诲姞蹇界暐涓婁紶鐨勬枃浠讹紝瑙傚療鍥炬爣鍓嶅悗鍙樺寲
鍓?/p>
鍚?/p>
涓婁紶
妫€鍑洪」鐩?/h2>
File--->import
妫€鍑洪」鐩娇鐢ㄥ凡缁忓瓨鍦ㄧ殑浠撳簱鍦板潃
鎵惧埌鎴戜滑鐨勯」鐩?/p>
浣挎鍑虹殑鐩綍鏈韩浣滀负宸ョ▼
杞崲宸ョ▼绫诲瀷锛岄」鐩?-->鍙抽敭--->Configure
--->Convert to Maven Project
鍓?/p>
鍚?/p>
IDEA浣跨敤svn
蹇呴』瀹夎涔岄緹TortoiseSVN
,鍥犱负idea
鏄娇鐢ㄤ箤榫熺殑svn
鍛戒护杩涜鍒嗕韩鍜屾鍑虹殑
涓嬭浇瀹夎64浣嶇殑灏忎箤榫?/a>
idea
浣跨敤涔岄緹
妫€鍑洪」鐩?/p>
杈撳叆url
鍦板潃
娣诲姞鍏ㄥ眬蹇界暐鏂囦欢锛岄€氳繃灏忎箤榫熻繘琛屾搷浣滐紝浠绘剰鐩綍锛屽彸閿?-->鎵惧埌灏忎箤榫?-->Settings
锛屽紑鍚叏灞€娉ㄩ噴
global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__ *.rej *~ #*# .#* .*.swp .DS_Store *.iml .idea */.idea/* .classpath .settings */.settings/* .project target */target/*
娉ㄦ剰锛?code>idea涓嶇鏄娇鐢?code>svn杩樻槸Git
閮芥槸闇€瑕佸畨瑁呭鎴风宸ュ叿鐨勶紝姣斿灏忎箤榫燂紝閫氳繃瀹㈡埛绔伐鍏锋搷浣滆繙绋嬬殑svn
鐗堟湰搴撴垨鑰?code>Git鐨勭増鏈簱锛岃繖涓€鐐瑰拰eclipse
涓嶅お涓€鏍凤紝eclipse
鍙互鐩存帴浣跨敤鎻掍欢
鏈枃鐢卞崥瀹竴鏂囧鍙戝钩鍙?OpenWrite 鍙戝竷锛?/p>
以上是关于svn鐗堟湰鎺у埗的主要内容,如果未能解决你的问题,请参考以下文章