1.svn 详解
svn 详解
1ãæ£åº
svncomint -mçå®çä¸ä¼ ä¸å»ï¼
ä¾åï¼
svn addtest.phpï¼ï¼æ·»å test.php
svn commit -mâæ·»å æçæµè¯ç¨test.phpâ test.php
svn add*.phpï¼ï¼æ·»å å½åç®å½ä¸ææçphpæ件
svn commit -mâæ·»å æçæµè¯ç¨å ¨é¨phpæ件â *.php
4ãæ交
svnãcommitã-mãâæ交å¤æ³¨ä¿¡æ¯ææ¬âã[-N]ã[--no-unlock]ãæ件å
svnãciã-mãâæ交å¤æ³¨ä¿¡æ¯ææ¬âã[-N]ã[--no-unlock]ãæ件å
å¿ é¡»å¸¦ä¸-måæ°ï¼åæ°å¯ä»¥ä¸ºç©ºï¼ä½æ¯å¿ é¡»åä¸-m
ä¾åï¼
svn commit -mâæ交å½åç®å½ä¸çå ¨é¨å¨çæ¬æ§å¶ä¸çæ件â *ï¼ï¼æ³¨æè¿ä¸ª*è¡¨ç¤ºå ¨é¨æ件
svn commit -mâæ交æçæµè¯ç¨test.phpâ test.php
svn commit -mâæ交æçæµè¯ç¨test.phpâ-N --no-unlocktest.phpï¼ï¼ä¿æéå°±ç¨âno-unlockå¼å ³
svn ci -mâæ交å½åç®å½ä¸çå ¨é¨å¨çæ¬æ§å¶ä¸çæ件â *ï¼ï¼æ³¨æè¿ä¸ª*è¡¨ç¤ºå ¨é¨æ件
svn ci -mâæ交æçæµè¯ç¨test.phpâ test.php
svn ci -mâæ交æçæµè¯ç¨test.phpâ-N --no-unlocktest.phpï¼ï¼ä¿æéå°±ç¨âno-unlockå¼å ³
5ãæ´æ°æ件
svnãupdate
svnãupdateã-rãä¿®æ£çæ¬ãæ件å
svnãupdateãæ件å
ä¾åï¼
svn updateï¼ï¼ åé¢æ²¡æç®å½ï¼é»è®¤å°å½åç®å½ä»¥ååç®å½ä¸çæææ件é½æ´æ°å°ææ°çæ¬
svn update -r test.cppï¼ï¼å°çæ¬åºä¸çæ件 test.cpp è¿åå°ä¿®æ£çæ¬ï¼revisionï¼
svn updatetest.phpï¼ï¼æ´æ°ä¸çæ¬åºåæ¥ã
æ交çæ¶åæ示è¿æå²çªï¼éè¦å update ä¿®æ¹æ件ï¼
ç¶åæ¸ é¤svn resolvedï¼æååæ交commitã
6ãå é¤æ件
svnãdeleteãsvn://è·¯å¾(ç®å½ææ件çå ¨è·¯å¾) -m âå é¤å¤æ³¨ä¿¡æ¯ææ¬â
æ¨èå¦ä¸æä½ï¼
svnãdeleteæ件å
svnãciã-mâå é¤å¤æ³¨ä¿¡æ¯ææ¬â
ä¾åï¼
svn delete svn://localhost/testapp/test.php-mâå é¤æµè¯æ件test.phpâ
æ¨èå¦ä¸æä½ï¼
svn deletetest.php
svn ci -mâå é¤æµè¯æ件test.phpâ
7ãå é/解é
svnãlockã-mãâå éå¤æ³¨ä¿¡æ¯ææ¬âã[--force]ãæ件å
svnãunlockãæ件å
ä¾åï¼
svn lock -mâéä¿¡æµè¯ç¨test.phpæ件â test.php
svn unlocktest.php
8ãæ¯è¾å·®å¼
svnãdiffãæ件å
svnãdiffã-rãä¿®æ£çæ¬å·m:ä¿®æ£çæ¬å·nãæ件å
ä¾åï¼
svn difftest.phpï¼ï¼å°ä¿®æ¹çæ件ä¸åºç¡çæ¬æ¯è¾
svn diff -r: test.phpï¼ï¼å¯¹ ä¿®æ£çæ¬å· å ä¿®æ£çæ¬å· æ¯è¾å·®å¼
9ãæ¥çæ件æè ç®å½ç¶æ
svn stç®å½è·¯å¾/å
svn status ç®å½è·¯å¾/åï¼ï¼ç®å½ä¸çæ件ååç®å½çç¶æï¼æ£å¸¸ç¶æä¸æ¾ç¤º
ã?收闲来源码ï¼ä¸å¨svnçæ§å¶ä¸ï¼Mï¼å 容被修æ¹ï¼Cï¼åçå²çªï¼
Aï¼é¢å®å å ¥å°çæ¬åºï¼Kï¼è¢«éå®ã
svn-v ç®å½è·¯å¾/å
svn status -v ç®å½è·¯å¾/åï¼ï¼æ¾ç¤ºæ件ååç®å½ç¶æ
ã第ä¸åä¿æç¸åï¼ç¬¬äºåæ¾ç¤ºå·¥ä½çæ¬å·ï¼
第ä¸å第ååæ¾ç¤ºæåä¸æ¬¡ä¿®æ¹ççæ¬å·åä¿®æ¹äººã
注ï¼svn statusãsvn diffå svn revertè¿ä¸æ¡å½ä»¤å¨æ²¡æç½ç»çæ åµä¸ä¹å¯ä»¥æ§è¡çï¼
åå æ¯svnå¨æ¬å°ç.svnä¸ä¿çäºæ¬å°çæ¬çåå§æ·è´ã
ãæ¥çæ¥å¿
svnãlogãæ件å
ä¾åï¼
svn logtest.phpï¼ï¼æ¾ç¤ºè¿ä¸ªæ件çææä¿®æ¹è®°å½ï¼åå ¶çæ¬å·çåå
ãæ¥çæ件详ç»ä¿¡æ¯
svnãinfoãæ件å
ä¾åï¼
svn infotest.php
ãSVN 帮å©
svnãhelpï¼ï¼å ¨é¨åè½é项
svnãhelpãciï¼ï¼ å ·ä½åè½ç说æ
ãæ¥ççæ¬åºä¸çæ件åç®å½å表
svnãlistãsvn://è·¯å¾(ç®å½ææ件çå ¨è·¯å¾)
svnãlsãsvn://è·¯å¾(ç®å½ææ件çå ¨è·¯å¾)
ä¾åï¼
svn list svn://localhost/test
svn ls svn://localhost/testï¼ï¼æ¾ç¤ºsvn://localhost/testç®å½ä¸çææå±äºçæ¬åºçæ件åç®å½
ãåå»ºçº³å ¥çæ¬æ§å¶ä¸çæ°ç®å½
svnãmkdirãç®å½å
svnãmkdirã-mã"æ°å¢ç®å½å¤æ³¨ææ¬"ãhttp://ç®å½å ¨è·¯å¾
ä¾åï¼
svn mkdirnewdir
svn mkdir -m"Making a new dir."svn://localhost/test/newdir
注ï¼æ·»å å®åç®å½åï¼ä¸å®è¦åå°æ ¹ç®å½æ´æ°ä¸ä¸ï¼ä¸ç¶å¨è¯¥ç®å½ä¸æ交æ件ä¼æ示âæ交失败â
svn update
注ï¼å¦ææå·¥å¨checkoutåºæ¥çç®å½éå建äºä¸ä¸ªæ°æ件夹newsubdirï¼
åç¨svn mkdirnewsubdirå½ä»¤åï¼SVNä¼æ示ï¼
svn: å°è¯ç¨ âsvn addâæ âsvn add --non-recursiveâ代æ¿ï¼
svn: æ æ³å建ç®å½âhelloâ: æ件已ç»åå¨
æ¤æ¶ï¼ç¨å¦ä¸å½ä»¤è§£å³ï¼
svn add --non-recursivenewsubdir
å¨è¿å ¥è¿ä¸ªnewsubdiræ件夹ï¼ç¨ls -aæ¥çå®ä¸é¢çå ¨é¨ç®å½ä¸æ件ï¼ä¼åç°å¤äºï¼.svnç®å½
åç¨ svn mkdir -m "æ·»helloåè½æ¨¡åæ件" svn://localhost/test/newdir/newsubdir å½ä»¤ï¼
SVNæ示ï¼
svn: File already exists: filesystem '/data/svnroot/test/db', transaction '-1',
path '/newdir/newsubdir '
ãæ¢å¤æ¬å°ä¿®æ¹
svnãrevertã[--recursive]ãæ件å
注æ: æ¬åå½ä»¤ä¸ä¼ååç½ç»ï¼å¹¶ä¸ä¼è§£é¤å²çªçç¶åµãä½æ¯å®ä¸ä¼æ¢å¤è¢«å é¤çç®å½ã
ä¾åï¼
svn revertfoo.cï¼ï¼ä¸¢å¼å¯¹ä¸ä¸ªæ件çä¿®æ¹
svn revert --recursive.ï¼ï¼æ¢å¤ä¸æ´ä¸ªç®å½çæ件ï¼. 为å½åç®å½
ãæå·¥ä½æ·è´æ´æ°å°å«çURL
svnãswitchãhttp://ç®å½å ¨è·¯å¾ãæ¬å°ç®å½å ¨è·¯å¾
ä¾åï¼
svn switch http://localhost/test/ .ï¼ï¼ (å为çåæ¯)å½åæå¨ç®å½åæ¯å°localhost/test/
ã解å³å²çª
svnãresolvedã[æ¬å°ç®å½å ¨è·¯å¾]
ä¾åï¼
$ svn update
C foo.c
Updated to revision .
å¦æä½ å¨æ´æ°æ¶å¾å°å²çªï¼ä½ çå·¥ä½æ·è´ä¼äº§çä¸ä¸ªæ°çæ件ï¼
$ ls
foo.c
foo.c.mine
foo.c.r
foo.c.r
å½ä½ 解å³äºfoo.cçå²çªï¼å¹¶ä¸åå¤æ交ï¼è¿è¡svn resolvedè®©ä½ çå·¥ä½æ·è´ç¥éä½ å·²ç»å®æäºææäºæ ã
ä½ å¯ä»¥ä» ä» å é¤å²çªçæ件并ä¸æ交ï¼ä½æ¯svn resolvedé¤äºå é¤å²çªæ件ï¼è¿ä¿®æ£äºä¸äºè®°å½å¨å·¥ä½æ·è´ç®¡çåºåçè®°å½æ°æ®ï¼æ以æ们æ¨èä½ ä½¿ç¨è¿ä¸ªå½ä»¤ã
ãä¸checkoutèæ¥çè¾åºç¹å®æ件æURLçå 容
svnãcatãhttp://æä»¶å ¨è·¯å¾
ä¾åï¼
svn cat http://localhost/test/readme.txt
ãæ°å»ºä¸ä¸ªåæ¯copy
svn copybranchA branchB-m "make B branch" // ä»branchAæ·è´åºä¸ä¸ªæ°åæ¯branchB
ãå并å 容å°åæ¯merge
svn mergebranchA branchB// æ对branchAçä¿®æ¹å并å°åæ¯branchB