so true

          心懷未來,開創未來!
          隨筆 - 160, 文章 - 0, 評論 - 40, 引用 - 0
          數據加載中……

          創建svn

          對一個已有目錄建立svn的最最精簡的步驟:
          1. svnadmin create svn_root
          2. 修改svn_root/conf/svnserve.conf中的下面這一行(注意,每行配置,要把前面的空格也刪除掉):
          anon-access = write
          3. svnserve -d -r svn_root #svnserve的根目錄必須是通過svnadmin創建出來的目錄,該目錄下有conf/ db/ format hooks/ locks/等文件或文件夾
          4. svn mkdir --parents svn://localhost/search/spider/trunk/ -m 'create the trunk dir for spider team of search group'
          5. svn list svn://localhost/
          6. svn list svn://localhost/search/
          7. svn list svn://localhost/search/spider/
          8. svn list svn://localhost/search/spider/trunk/
          9. mkdir -p svn_spider_root/trunk/ #或許這個路徑已經存在,更或許在svn_spider_root/trunk/目錄下已經有很多內容了
          10. cd svn_spider_root/trunk #可見,本地路徑和svn server里的路徑不一定一致,其實是壓根沒什么關系
          11. svn co svn://localhost/search/spider/trunk . #此時,trunk目錄已經在svn的control下了
          12. svn info .
          13. cp -r XXX .
          14. svn add *
          15. svn ci -m 'first version' .

          其他的一些資料:
          svnadmin create /home/admin/svn_root/
          svn mkdir --parents file:///home/admin/svn_root/project1_repo/{trunk,tags,branches} -m "initial dir creation"
          #下面這些配置文件在配置時,千萬不能以空格開頭
          cat > /home/admin/svn_root/conf/svnserve.conf
          [general]  
          password-db = passwd  
          cat > /home/admin/svn_root/conf/passwd  
          admin = admin
          svnserve -d -r  /home/admin/svn_root/ --listen-port 3389
          #會把/home/admin/some_existed_stuffs/目錄下的東西ci到trunk下,不會在trunk下創建some_existed_stuffs目錄
          svn import -m "Initial import" /home/admin/some_existed_stuffs svn://localhost:3389/svn_root/project1_repo/trunk/
          svn co svn://localhost:3389/svn_root/project1_repo/ project1_repo

          備注:
          其實用file://和svn://的區別就在于是否通過svnserve啟動了daemon進程偵聽端口,所以svn mkdir和svn import都可以通過svn://來進行。
          因此,如果不考慮打個http服務給別人使用,而只是在本地自己控制版本的話,完全可以用file://協議,例如:
          $ svnadmin create svn_test
          $ svn mkdir file:///home/admin/svn_test/trunk/ -m 'create trunk dir'
          Committed revision 1.
          $ svn import mk_test/ file:///home/admin/svn_test/trunk/ -m 'import basic files'
          Adding  (bin)  mk_test/t3
          Adding         mk_test/t3.cpp
          Adding         mk_test/Makefile
          Committed revision 2.
          $ svn co file:///home/admin/svn_test/trunk/ test_trunk
          A    test_trunk/t3
          A    test_trunk/t3.cpp
          A    test_trunk/Makefile
          Checked out revision 2.
          $ cd test_trunk
          $ svn st
          $ svn info
          Path: .
          URL: file:///home/admin/svn_test/trunk
          Repository Root: file:///home/admin/svn_test
          Repository UUID: 873f7a52-8ee6-4740-958b-5e58c9997b03
          Revision: 2
          Node Kind: directory
          Schedule: normal
          Last Changed Author: admin
          Last Changed Rev: 2
          Last Changed Date: 2012-11-14 14:46:19 +0800 (Wed, 14 Nov 2012)
          $ vi t4.cpp
          $ svn st
          ?       t4.cpp
          M       t3.cpp
          $ svn add t4.cpp
          A         t4.cpp
          $ svn st
          M       t3.cpp
          A       t4.cpp
          $ svn ci -m 'add t4.cpp'
          Sending        t3.cpp
          Adding         t4.cpp
          Transmitting file data ..
          Committed revision 3.
          $ svn log
          ------------------------------------------------------------------------
          r2 | admin | 2012-11-14 14:46:19 +0800 (Wed, 14 Nov 2012) | 1 line
          import basic files
          ------------------------------------------------------------------------
          r1 | admin | 2012-11-14 14:45:54 +0800 (Wed, 14 Nov 2012) | 1 line
          create trunk dir
          ------------------------------------------------------------------------

          說到這里,有一個很有用的功能,例如你已經有一個目錄,下面有一些文件,現在你想把這個目錄受到版本控制,即把當前狀態作為最開始的一個版本,在本地可以這么干:
          cd /home/admin/project1
          svn co file:///home/admin/svn_root/tmp_projects/project1 . #this only creates the ".svn" folder for version control,其實就是將當前目錄分配到svn的某一個節點下,這個節點如果不存在,需要事先mkdir,注意最后一個參數一定得是'.'
          svn add ./*                        #tell svn you want to version control all files in this dir
          svn ci  -m 'add /home/admin/project1 under version control'                          #check the files in
          此外,如果需要http://協議,那需要搭建一個apache服務,參見相關鏈接[2]

          相關鏈接:
          [1] http://greatwqs.iteye.com/blog/1074448
          [2] https://support.eapps.com/index.php?/Knowledgebase/Article/View/254/62/cloud-hosting-applications---subversion-svn

          posted on 2012-11-14 14:28 so true 閱讀(603) 評論(0)  編輯  收藏 所屬分類: Linux

          主站蜘蛛池模板: 宽甸| 潼关县| 德安县| 通城县| 兴安盟| 林芝县| 庆城县| 军事| 宿州市| 湘西| 宁夏| 湘潭市| 资源县| 凌海市| 康平县| 盈江县| 江都市| 佛坪县| 蒙阴县| 康马县| 邹城市| 鹿泉市| 余江县| 水富县| 厦门市| 新津县| 沙河市| 铜梁县| 海林市| 大方县| 蓝田县| 盘山县| 浮山县| 丹东市| 关岭| 武川县| 佛学| 朔州市| 梅河口市| 红安县| 宜阳县|