空間站

          北極心空

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            15 Posts :: 393 Stories :: 160 Comments :: 0 Trackbacks

          SVN安裝和使用

          SVN的安裝

          訪問SVN網站下載你所需版本的安裝包。以Linux為例,安裝過程為依次執行以下步驟:
          rpm -ivh apr-0.9.5-0.2.i386.rpmrpm -ivh apr-util-0.9.5-0.1.i386.rpmrpm -ivh neon-0.24.7-1.i386.rpmrpm -ivh subversion-1.1.1-1.rh80.i386.rpm

          ?

          SVN安裝包的基本命令

          svnThe command-line client program.
          svnversionA program for reporting the state (in terms of revisions of the items present) of a working copy.
          svnlookA tool for inspecting a Subversion repository.
          svnadminA tool for creating, tweaking or repairing a Subversion repository.
          svndumpfilterA program for filtering Subversion repository dumpfile format streams.
          mod_dav_svnA plug-in module for the Apache HTTP Server, used to make your repository available to others over a network.
          svnserveA custom standalone server program, runnable as a daemon process or invokable by SSH; another way to make your repository available to others over a network.

          ?

          配置本地訪問的SVN

          執行svn --version,你將看到如下畫面
          [root@localhost local]# svn --version* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.* ra_local : Module for accessing a repository on local disk.* ra_svn : Module for accessing a repository using the svn network protocol.
          如果你有ra_local這個模塊,那么客戶端就可以用file:// URLs的地址來訪問。

          執行一下命令

          $ svnadmin create /root/svnrepo$ ls /root/svnrepoconf/ dav/ db/ format hooks/ locks/ README.txt

          接下來,我們建立一個本地工作目錄/root/svnlocal,進入執行

          //建立項目[root@localhost svnlocal]# mkdir project [root@localhost svnlocal]# mkdir project/trunk[root@localhost svnlocal]# mkdir project/branches[root@localhost svnlocal]# mkdir project/tags//建立一個模塊exo[root@localhost svnlocal]# mkdir project/exo[root@localhost svnlocal]# vi project/exo/exo.conf[root@localhost svnlocal]# svn import . file:///root/svnrepo -m 'initial'[root@localhost svnlocal]# rm -rf project[root@localhost svnlocal]# svn checkout file://localhost/root/svnrepo/project //check整個項目[root@localhost svnlocal]# svn checkout file://localhost/root/svnrepo/project exo //check 其中一個模塊
          如果成功可以看到文件已經被check出來。地址可以使用file://localhost/root/svnrepo 或者使用file:///root/svnrepo

          其他的命令有

          • Enter your working copy and edit a file's contents.
          • Run svn diff to see unified diff output of your changes.
          • Run svn commit to commit the new version of your file to the repository.
          • Run svn update to bring your working copy “up-to-date” with the repository.

          ?

          SVN的訪問地址

          Schema Access Method
          file:/// direct repository access (on local disk)
          http:// access via WebDAV protocol to Subversion-aware Apache server
          https:// same as http://, but with SSL encryption.
          svn:// access via custom protocol to an svnserve server
          svn+ssh:// same as svn://, but through an SSH tunnel.

          ?

          啟動SVN的svnserve,這樣你就可以通過svn://url的方式來訪問。

          查看啟動參數
          [root@localhost svnlocal]# svnserve --helpUsage: svnserve [options]Valid options:  -d [--daemon]            : daemon mode  --listen-port arg        : listen port (for daemon mode)  --listen-host arg        : listen hostname or IP address (for daemon mode)  --foreground             : run in foreground (useful for debugging)  -h [--help]              : display this help  --version                : display version  -i [--inetd]             : inetd mode  -r [--root] arg          : root of directory to serve  -R [--read-only]         : deprecated; use repository config file  -t [--tunnel]            : tunnel mode  --tunnel-user arg        : tunnel username (default is current uid's name)  -T [--threads]           : use threads instead of fork  -X [--listen-once]       : listen once (useful for debugging)

          我們執行svnserve -d -r /root/svnrepo

          然后在剛才的svnlocal目錄下,執行

          [root@localhost svnlocal]# svn checkout svn://localhost/project exo
          就可以通過網絡協議check出指定的repo或者其中的模塊

          注意:如果我們啟動時候,只是用svnserve -d而沒有制定repo路徑的話,那么你在checkout的時候就必須使用是svn checkout svn://localhost/root/svnrepo/project exo 來指明全路徑。

          接下來,我們隨便修改一個文件,然后執行

          [root@localhost exo-build]# svn commit -m "test"
          你會發現提示說:“提交失敗,svn: Connection is read-only” 這說明svn://訪問方式沒有用戶權限控制,只能最基本的匿名下載使用。

          ?

          權限配置

          先介紹svnserve使用的基于文件的權限控制

          進入/root/svnrepo/conf/ 打開svnserve.conf,修改一下兩行

          [general]anon-access = noneauth-access = write password-db = passwd
          注意:所有的行都必須頂格,否則報錯。

          在相同目錄下建立一個passwd文件,使用vi passwd命令。在里面輸入

          [users]danny = dannybobo = bobo
          重新啟動svnserve,svnserve -d -r /root/svnrepo/ 。

          好,接下來,我們執行

          [root@localhost svnlocal]# svn checkout svn://localhost/project exo
          根據提示依次輸入"root"的密碼(任意),用戶登陸名名(danny_xcz)和密碼(pass)。就可以正常chekout需要的目錄了。登陸一次以后再執行svn update等命令時無需再次輸入認證密碼。


          Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=202474

          posted on 2006-11-29 22:27 蘆葦 閱讀(561) 評論(0)  編輯  收藏 所屬分類: IDE
          主站蜘蛛池模板: 寻乌县| 永泰县| 和龙市| 剑河县| 礼泉县| 新龙县| 朝阳县| 武功县| 兴化市| 当涂县| 晴隆县| 普兰县| 井陉县| 平陆县| 普兰店市| 乾安县| 浙江省| 怀柔区| 渭南市| 华容县| 游戏| 宜君县| 新密市| 九台市| 留坝县| 胶南市| 华安县| 定边县| 灵宝市| 玉田县| 淅川县| 东乡| 大新县| 沈阳市| 通江县| 崇文区| 徐汇区| 宿松县| 泸州市| 稻城县| 图木舒克市|