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鏈嶅姟

鎶€鏈浘鐗? src=

5銆侀獙璇乻vn鏈嶅姟鏄惁鍚姩

svn鏈嶅姟鐩戝惉3690绔彛

鎶€鏈浘鐗? src=

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>

鎶€鏈浘鐗? src=

绠$悊鍛樿繍琛?/p>

鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=

鍚姩銆佸仠姝€佸垹闄vn鏈嶅姟锛堢鐞嗗憳韬唤杩愯cmd锛?/p>

    //鍚姩svn鏈嶅姟
    C:WINDOWSsystem32>sc start MySVNService

    //鍋滄鏈嶅姟
    C:WINDOWSsystem32>sc stop MySVNService

    //鍒犻櫎鏈嶅姟
    C:WINDOWSsystem32>sc delete MySVNService

8銆佹彁浜ゆ枃浠?/h2>

--寮€鍚尶鍚嶆潈闄愯闂?/p>

鎶€鏈浘鐗? src=

--鍏堝皢鏂囦欢鍔犲叆鐗堟湰搴擄紝鐒跺悗鎻愪氦锛堥渶娣诲姞鎻愪氦鏃ュ織淇℃伅锛屼笉鐒舵姤閿欙級

svn commit 鍛戒护鏈€鍚庡彲浠ヤ笉鎸囧畾鍏蜂綋鏂囦欢锛屾鏃惰〃绀烘彁浜ゅ綋鍓嶅伐浣滃壇鏈腑
鐨勬墍鏈変慨鏀?/p>

鎶€鏈浘鐗? src=

9銆佹洿鏂?/h2>

鍙︿竴涓鎴风妫€鍑洪」鐩€佹洿鏂板苟鎻愪氦鏂囦欢

    //杩滅▼鐗堟湰搴撳叿浣撲綅缃? svn://localhost/OA
    //灏哋A妫€鍑哄埌鏈湴鐨勭洰褰?MyOA2
    D:mytestmycheckout>svn checkout svn://localhost/OA MyOA2

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

--澶氱増鏈簱寮€鍚巿鏉冭闂?/p>

    鍦ㄧ増鏈簱鏍圭洰褰?D:mytestmysvn 涓嬪垱寤?commConf 鐩綍
    灏嗘湭淇敼鐨?authz 鍜?passwd 鏂囦欢鎷疯礉鍒?commConf 鐩綍涓?    淇敼闇€瑕佽缃潈闄愮殑鐗堟湰搴撶殑 svnserve.conf 鏂囦欢
    鈶爌assword-db = ../../commConf/passwd
    鈶uthz-db = ../../commConf/authz

鎶€鏈浘鐗? src=

passwd锛氳缃闂増鏈簱鐨勭敤鎴蜂俊鎭?/p>

鎶€鏈浘鐗? src=

authz锛氳缃敤鎴疯闂増鏈簱鐨勬潈闄?/p>

鎶€鏈浘鐗? src=


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

鎶€鏈浘鐗? src=

瀹夎SVN Connector

鎶€鏈浘鐗? src=

svn榛樿鐢ㄦ埛鍚嶅拰瀵嗙爜淇濆瓨浣嶇疆

C:UsersshenlibingAppDataRoamingSubversionauthsvn.simple

濡傛灉浣跨敤eclipse鐨勮瘽锛岃繛鎺ヨ祫婧愬簱鐨勬椂鍊欓€夋嫨璁颁綇鐢ㄦ埛鍚嶅拰瀵嗙爜锛岃繕浼氬湪浠ヤ笅璺緞瀛樹竴浠界敤鎴峰悕鍜屽瘑鐮佺殑淇℃伅

C:Usersshenlibing.eclipseorg.eclipse.equinox.security

鎶€鏈浘鐗? src=

鍥犳闇€瑕佸垹闄ゅ涓婁袱澶勪綅缃殑鍐呭锛岀劧鍚庨噸鍚?code>eclipse

娣诲姞蹇界暐鏂囦欢

椤圭洰--->鍙抽敭--->Team--->Set Properties

鎶€鏈浘鐗? src=

鍏ㄥ眬娣诲姞蹇界暐鏂囦欢

杩涘叆鍒颁互涓嬬洰褰曪紝淇敼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椤圭洰

鎶€鏈浘鐗? src=

浣跨敤楠ㄦ灦

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

鎻愮ず缂哄皯web.xml鏂囦欢

鎶€鏈浘鐗? src=

瑙e喅

椤圭洰--->鍙抽敭--->Java EE Tools--->Generate Deployment Descriptor Stub

椤圭洰--->鍙抽敭--->Team--->Share Project,涓婁紶椤圭洰

閫夋嫨鐗堟湰宸ュ叿svn

鎶€鏈浘鐗? src=

閫夋嫨涓€涓凡缁忓瓨鍦ㄧ殑璧勬簮搴撲綅缃?/p>

鎶€鏈浘鐗? src=

纭宸ョ▼鏍圭洰褰曚笅瀛愮洰褰曞拰鏂囦欢鏄惁鍏ㄩ儴涓婁紶,鍏堝埆涓婁紶

鎶€鏈浘鐗? src=

娣诲姞蹇界暐涓婁紶鐨勬枃浠讹紝瑙傚療鍥炬爣鍓嶅悗鍙樺寲

鍓?/p>

鎶€鏈浘鐗? src=

鍚?/p>

鎶€鏈浘鐗? src=

涓婁紶

鎶€鏈浘鐗? src=

妫€鍑洪」鐩?/h2>

File--->import

鎶€鏈浘鐗? src=

妫€鍑洪」鐩娇鐢ㄥ凡缁忓瓨鍦ㄧ殑浠撳簱鍦板潃

鎶€鏈浘鐗? src=

鎵惧埌鎴戜滑鐨勯」鐩?/p>

鎶€鏈浘鐗? src=

浣挎鍑虹殑鐩綍鏈韩浣滀负宸ョ▼

鎶€鏈浘鐗? src=

杞崲宸ョ▼绫诲瀷锛岄」鐩?-->鍙抽敭--->Configure--->Convert to Maven Project

鍓?/p>

鎶€鏈浘鐗? src=

鍚?/p>

鎶€鏈浘鐗? src=

IDEA浣跨敤svn

蹇呴』瀹夎涔岄緹TortoiseSVN,鍥犱负idea鏄娇鐢ㄤ箤榫熺殑svn鍛戒护杩涜鍒嗕韩鍜屾鍑虹殑

涓嬭浇瀹夎64浣嶇殑灏忎箤榫?/a>

idea浣跨敤涔岄緹

鎶€鏈浘鐗? src=

妫€鍑洪」鐩?/p>

鎶€鏈浘鐗? src=

杈撳叆url鍦板潃

鎶€鏈浘鐗? src=

娣诲姞鍏ㄥ眬蹇界暐鏂囦欢锛岄€氳繃灏忎箤榫熻繘琛屾搷浣滐紝浠绘剰鐩綍锛屽彸閿?-->鎵惧埌灏忎箤榫?-->Settings锛屽紑鍚叏灞€娉ㄩ噴

鎶€鏈浘鐗? src=

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鐗堟湰鎺у埗的主要内容,如果未能解决你的问题,请参考以下文章

Webpack5.0 鏂扮壒鎬у皾椴滃疄鎴?馃馃 [姣忔棩鍓嶇澶滆瘽0x37]

KaliLinux鍒囨崲python鐗堟湰

浣跨敤Pycharm鑷甫Git瀹炵幇鐗堟湰绠$悊

ruby鐗堟湰鍗囩骇(杞笘)

idea涓璯it杩滅▼鐗堟湰鍥為€€