SVN server setup and use

 Subversion is an excellent version control tool, and its specific advantages and detailed introduction will not be discussed here.

First, download and build the SVN server.

Now Subversion has been migrated to the apache website, download address:

http://subversion.apache.org/packages.html

This is the download address of the binary file package, you can find the source code and the download address of the documentation in the left navigation bar.

There are a total of 5 binary file packages under the Windows operating system, as shown in the figure:

Personally, I think it is best to use the VisualSVN server server and TortoiseSVN client together.

Click on the VisualSVN connection above to download the VisualSVN server, as shown in the figure:

Then download the TortoiseSVN client, the official website download address: http://tortoisesvn.net/downloads.html

Pay attention to download the installation package that matches your computer. You can also find the language package at the bottom of the page, as shown in the figure:

After the download is complete, there should be these installation packages, as shown in the figure:

 TortoiseSVN installation package and simplified Chinese language package

VisualSVN server installation package

First install the VisualSVN server installation package, double-click the VisualSVN server installation package, as shown in the figure:

Click Next to enter the next step, as shown in the figure:

Click Agree, go to the next step, as shown in the figure:

Select one of the above options, click Next, enter the next step, as shown in the figure:

Location refers to the installation directory of VisualSVN Server, Repositorys refers to your repository directory. Server Port specifies a port, Use secure connection Goushan means to use a secure connection, Use Subversion authentication means to use Subversion's own user authentication. Click Next to enter the next Step by step, as shown in the figure:

Click Install to go to the next step, as shown in the figure:

Wait for the installation to complete, as shown in the figure:

After the installation is complete, start VisualSVN Server Manager, as shown in the figure:

接下来我们安装TortoiseSVN,双击安装包,进入下一步.如图:

点击Next,进入下一步,如图:

选择接受,然后点击Next,进入下一步,如图:

选择安装路径,然后点击Next,进入下一步,如图:

点击Install,开始安装,如图:

等待安装完成,安装完成后如图:

接下来我们安装简体中文语言包,这个非常简单,一路Next就行,就不截图了.语言包安装完成以后在桌面任意空白地方单击鼠标右键,会在右键菜单里找到SVN,如图:

选择设置,进入下一步,如图:

在右边的语言里面选择简体中文,然后点击应用,确定,汉化即完成,如图:

到这里,服务端和客户端都已经安装完毕,下一篇介绍用VisualSVN Server创建版本库,以及TortoiseSVN的使用.

 

 

上一篇介绍了VisualSVN Server和TortoiseSVN的下载,安装,汉化.这篇介绍一下如何使用VisualSVN Server建立版本库,以及TortoiseSVN的使用.

首先打开VisualSVN Server Manager,如图:

可以在窗口的右边看到版本库的一些信息,比如状态,日志,用户认证,版本库等.要建立版本库,需要右键单击左边窗口的Repositores,如图:

在弹出的右键菜单中选择Create New Repository或者新建->Repository,进入下一步:

输入版本库名称,勾上Create default structure复选框(推荐这么做).点击OK,版本库就创建好了,版本库中会默认建立trunk,branches,tags三个文件夹,如图:

这时候我们将项目导入到版本库中,找到你的项目文件夹,在项目文件夹上点击鼠标右键,找到SVN菜单,选择导入,如图:

在弹出的对话框中填上版本库URL,这个URL可以从VisualSVN Server Manager中获取,在你的版本库上单击右键,选择Copy URL to Clipboard,这样就把版本库URL复制到你的剪贴版了.如图:

将复制的版本库URL粘贴上,在URL后面加上trunk子路径.然后在导入信息里面填上导入信息"导入项目到版本库".如图:

点击确定,所选中的项目就会被导入到版本库中.如图:

项目导入到版本库以后,不能随便让谁都能够读写版本库,所以需要建立用户组和用户.

在VisualSVN Server Manager窗口的左侧右键单击用户组,选择Create User或者新建->User,如图:

在弹出的对话框中填写User name和Password,然后点击OK,如图:

用相同的方式分别创建用户Develpoer1,Develpoer2,Develpoer3,Test1,Test2,Manger六个用户,分别代表3个开发人员,两个测试人员和一个项目经理,如图:

然后我们建立用户组,在VisualSVN Server Manager窗口的左侧右键单击用户组,选择Create Group或者新建->Group,如图:

在弹出窗口中填写Group name为Developers,然后点Add按钮,在弹出的窗口中选择三个Developer,加入到这个组,然后点Ok,如图:

用相同的方式创建组Managers,Testers,如图:

接下来我们给用户组设置权限,在MyRepository上单击右键,选择属性,如图:

在弹出的对话框中,选择Security选项卡,点击Add按钮,选中Developers,Managers,Testers三个组,然后添加进来,给Developers,Managers权限设置为Read/Write,Tester权限设置为Read Only,如图:

到此,服务端就完成了.

接下来,我们用客户端去检出代码,在桌面空白处单击右键,选择SVN检出,在弹出的对话框中填写版本库URL(具体获取方式,上面讲上传项目到版本库的时候讲过),选择检出目录,点击确定.如图:

开始检出项目,如图:

检出完成之后,我们打开工作副本文件夹,会看到所有文件和文件夹都有一个绿色的√.如图:

至此,创建版本库和使用TortoiseSVN导入项目,检出项目已经介绍完毕.

下一篇介绍TortoiseSVN的使用,以及冲突解决办法.

 

接下来,试试用TortoiseSVN修改文件,添加文件,删除文件,以及如何解决冲突等.

添加文件

在检出的工作副本中添加一个Readme.txt文本文件,这时候这个文本文件会显示为没有版本控制的状态,如图:

这时候,你需要告知TortoiseSVN你的操作,如图:

加入以后,你的文件会变成这个状态,如图:

这时候使用TortoiseSVN进行提交.这样别人就能看到你所做的更改了,如图.

修改文件

使用TortoiseSVN更新,修改工作副本中的Readme.txt文件,加入"hello world!",然后保存,你会发现Readme.txt文件的图标改变了,如图:

这个红色的叹号代表这个文件被修改了,这时候,提交更改,其他人即可看到你的更改.

重命名文件

使用TortoiseSVN更新,重命名工作副本中的Readme.txt文件为"Readme1.txt',然后保存,你会发现Readme.txt文件的图标改变了,如图:

更添加文件一个道理,这时候你需要告诉TortoiseSVN你的操作,如图:

加入以后,提交,这时候版本库中的Readme.txt文件将会被重命名为"Readme1.txt".

删除文件

使用TortoiseSVN更新,使用TortoiseSVN删除工作副本中的Readme.txt文件,然后提交,版本库中的相应文件即被删除掉了,如图:

强制写注释

为了以后你能更清晰的看到你所做的每一次更改的原因,你在每次提交的时候应该写上注释,而且尽量详细.如图:

但是,可能有的人因为觉得太繁琐,而不填写注释,这不利于以后的版本控制,可以将强制在提交的时候写注释,首先单击右键,选择TortoiseSVN->属性,如图:

In the pop-up dialog box, click New -> Log Size, set the minimum number of characters for the submission log and the minimum number of characters for the locked log to 20, and set the character position of the border displayed in the submission text box to 100, and click OK, as shown in the figure:

Submit, when submitting again in the future, if the input comment is less than 20 characters, it will not be submitted.

conflict resolution

The conflict problem is the most common problem. It occurs in this way. User A checks out a working copy A, and then user B checks out a working copy B. Then user A makes changes to file C in copy A ( It can be content modification, file deletion, renaming, and location movement), and submit. At this time, user B also makes changes to the same part of file C. At this time, if user B submits, he will first be informed that the version is outdated and require Update, and then a conflict will be prompted when updating, at this time, you can use the conflict editor to manually select.

 

When you use TortoiseSVN to checkout from the server for the first time, you will be asked to enter the username and password. At this time, there is an option under the input box to save the authentication information. If this option is selected, then you do not need to enter the username and password every time in the future. .

However, if the user name and password are later modified on the server side, an error will occur when checking out again, and the client is very mentally handicapped. After an error, it will not automatically jump out of the user name and password input box to let people update it. I searched for a long time. Find the place to change this username and password.

In the end, two solutions were found:

Method 1: In the TortoiseSVN setting dialog box, select "Saved Data", click the "Clear" button in the "Authentication Data" row, and clear the saved authentication data. When checking out again, the user name and password will be entered again. frame.

 

If method one doesn't work, method two can be used:

Authentication information such as user name and password of Tortoise are cached in this directory of the client file system:

C:/Documents and Settings/Administrator/Application Data/Subversion/auth

Delete all folders under auth, reconnect to the remote server to check out, and the dialog will appear!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326712488&siteId=291194637