svn服务端配置及在MyEclipse中的使用

        首先,在http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=11129&expandFolder=11129&folderID=91(现在是http://subversion.apache.org/packages.html)上下载Setup-Subversion-1.6.6.msi, 在http://tortoisesvn.net/downloads上下载TortoiseSVN-1.6.9.19725-win32-svn-1.6.12.msi。
        接着我们安装运行Setup-Subversion-1.6.6.msi 安装界面比较简单,我们主要关注安装位置,假定我们安装在默认位置C:\Program Files\Subversion。
        现在我们创建repository,使用的命令是svnadmin。本例中,我们要在c:\svnroot下建立repository。那么我们使用的命令行如下:

C:\Program Files\Subversion\bin>svnadmin create c:\svnroot
C:\Program Files\Subversion\bin>

        建立好repository之后,我们要对Server 进行一些简单的配置。打开c:\svnroot下的conf目录,编辑svnserve.conf,修改里面的内容。

auth-access = write
password-db = passwd
anon-access = read

        前面的#去掉,打开这个注释。
        同时修改anon-access = none

        现在svnserve.conf的片断看起来类似:

[general]
### These options control access to the repository for unauthenticated

### and authenticated users. Valid values are "write", "read",

### and "none". The sample settings below are the defaults.

anon-access = none

auth-access = write

### The password-db option controls the location of the password

### database file. Unless you specify a path starting with a /,

### the file’s location is relative to the directory containing

### this configuration file.

### If SASL is enabled (see below), this file will NOT be used.

### Uncomment the line below to use the default password file.

password-db = passwd

### The authz-db option controls the location of the authorization

### rules for path-based access control. Unless you specify a path

### starting with a /, the file’s location is relative to the the

### directory containing this file. If you don’t specify an

### authz-db, no path-based access control is done.

### Uncomment the line below to use the default authorization file.

# authz-db = authz

### This option specifies the authentication realm of the repository.

### If two repositories have the same authentication realm, they should

### have the same password database, and vice versa. The default realm

### is repository’s uuid.

# realm = My First Repository


    修改好svnserve.conf后,我们再修改 passwd文件。加入我们需要的用户名joe和口令123passwd内容如下:

### This file is an example password file for svnserve.

     ### Its format is similar to that of svnserve.conf. As shown in the

     ### example below it contains one section labelled [users].

     ### The name and password for each user follow, one account per line.

     [users]

     # harry = harryssecret

     # sally = sallyssecret

     joe = 123


    现在就可以启动server了。启动的方法有很多种,在这里针对本文的环境我们介绍两种,一种是以deamon方式调用,一种是以Windows Service的方式调用。
    如果是以deamon的方式调用,那么命令行如下:

C:\Program Files\Subversion\bin>svnserve -d -r c:\svnroot

    服务端开始运行后,我们就可以关注一下客户端的问题了。TortoiseSVN的安装我没有什么可说的,就是一路的NEXT。这里我们描述一下我们的用于test的项目。以本文为例假定我们的项目目录是D:\mytemp\svn_test1,假定目录下有一个test1.txt文件。在svn_test1上按右键选TortoiseSVN–>Import 在URL of repository里输入svn://192.168.159.129/svnroot 点击OK后,按提示输入用户名和口令,就可以把项目导入Subversion 。好了,现在我们可以试一下,看看刚才我们导入的内容,并开始正常的update,commit工作吧。我们删除svn_test1里面的所有文件。然后在svn_test1目录上按右键选SVN Checkout URL of repository里输入的仍是svn://192.168.159.129/svnroot Checkout directory里输入的是D:\mytemp\svn_test1 Checkout Depth 选择Fully recursive,点击OK后,按提示输入用户名和口令,这时我们再看svn_test1目录,就可以看到我们导出的test1.txt文件了。
    我们打开test1.txt文件尝试修改并更新一下。我们在test1.txt里加上一行“哈尔滨市,高宏伟 QQ:21807822”,然后我们在svn_test1目录上按右键选svn commit,在message中我们可以输入一些日志来标志本次修改,然后点击OK,按提示输入用户名口令就可以提交了。update的操作也是类似,只不过是相反的操作。
    界面的操作不太容易用文字来表达,但界面很直观,相信大家摆弄摆弄就可以搞定。刚才为了保证文章的连续性,我们没有说明如何以Windows Service 的方式来调用server。生成svn服务的命令如下:

C:\>sc create svn binpath= "C:\Program Files\Subversion\bin\svnserve.exe –service -r c:\svnroot" displayname= "Subversion Server" depend= tcpip start= auto
     C:\>net start svn

    这里要特别注意一下sc命令的使用。主要是注意一下=号后面的空格和svn路径的空格。
    1. 如果你没有创建服务成功,那你就不要安装到Program Files目录下,因为它带了一个空格,你可以安装到一个比较简单的目录下再试试,如c:\svn_server。
    2. 如果安装到这样简单的目录还不能创建成。那你要注意binpath的等号后面有一个空格。你一定要完全按照上面的格式来写。
    3. 实在不行你就把所有的环境先都配成和本文一样,然后再直接粘贴过去,这样可以保证你运行成功。等所有的问题都没有了。你再按照你的想像重新安装一次,看看你的问题出在哪儿,这样也好有个对比。
    版本库管理:

    创建版本库:
    在服务器端,需要创建版本库的文件夹内点右键,在右键菜单中 TortoiseSVN-->Create repository here。
    导入源代码:
    找到源代码目录,点右键,在右键菜单中  TortoiseSVN-->Import...  弹出对话框URL of  Repository中填写为 file:///D:\Dev_Tools\Subversion\svnrepos\FGIS,也就是创建库的文件目录,最后点击 【OK】按钮,导入数据。

    注意:   导入数据目录下源代码无关文件(源代码编译时的中间文件)都删除,然后导入。例如:*.ncb、*.lib等
 
    在MyEclpse中使用:
    打开SVN 资源库窗口,右键点击,新建资源库,在URL对话框中输入:file:///D:\Dev_Tools\Subversion\svnrepos\FGIS

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值