Using subversion for version control can more effectively control the software development process and save development time. This article describes how to install and configure subversion on Windows.
1. Download the Subversion server and client (using tortoisesvn)
Subversion official site: http://subversion.tigris.org
Server: http://subversion.tigris.org/servlets/ProjectDocumentList? Folderid = 8100
Client: http://tortoisesvn.tigris.org/
2. Modify the path
Assume that the Server installation directory is c: \ svn1.5.3. Right-click "my computer" and choose "advanced"> "environment variables". In "system variables", find the path, add "; C: \ svn1.5.3 \ bin" at the end, so you do not need to enter the c: \ svn1.5.3 \ bin directory to run subversion every time ~
3. Create a version Library
Assume that the root directory of the version library is c: \ versionlib, and you want to create a version library for the myproject project. First, go to the C: \ versionlib \ myproject directory and right-click tortoisesvn-> Create repository here to create a version library ~
4. Configure users and permissions
Go to the C: \ versionlib \ myproject \ conf directory, and you will see three files: svnserve. conf, passwd, and authz.
(1) Modify svnserve. conf
# anon-access = read
# auth-access = write
# password-DB = passwd
:
anon-access = read
auth-access = write
password-DB = passwd
the first two rows indicate read and write permissions., the last line indicates that the password file uses the default passwd file. If you use another file, change it to the file name you use.
(2) modify the passwd file
the content of this file is relatively simple. Add:
qianxin = QX
indicates that a user is added. The user name is qianxin and the password is QX. You can add multiple users.
(3) authz file, which is used for permission configuration. It is a relatively advanced application and is not involved at the moment.
5. Run the Subversion server
Start Menu-> Run-> Enter cmd, open the command line window, and enter:
Svnserve-d-r c: \ versionlib \ myproject
In this way, the Subversion server is started. Do not close the command line window. Otherwise, the Subversion server will be stopped.
6. initialize the Import
The current version library is still an empty version library with no content in it. Therefore, you must first import an original version. Enter the directory of the project to be imported, for example, D: \ svntest. Right-click and choose tortoisesvn> Import.... In "URL of repository", enter the version library address:
SVN: // localhost/myproject
In "Import message", enter the log information: init project, and click "OK". The logon dialog box is displayed. Enter the user name and password to import the version library. If you select the check box at the bottom of the logon dialog box, you can remember your user name and password, so you do not need to enter the user name and password every time you import the version library ~
7. retrieve a working copy of the version Library
In your working directory, right-click-> SVN checkout... and enter the version library address to export the version library content. The latest version is exported by default. to export a previous version, enter the version number of the version to be exported in "revision.
8. Import version changes
If the current version is the same as the latest version in the version library, a green check will be provided for all files and folders. If the content is modified, a red exclamation point will appear on the modified file. If you need to submit a new version to the version library, right-click and choose commit.
9. register the Subversion Service
Every time you run the Subversion server, you need to enter the command in the command line window, which is very cumbersome. If you can register the subversion as a Windows service and set it to auto start, in this way, the Subversion server will automatically run after each boot. This feature is included in Subversion 1.4 or later. The procedure is as follows:
(1) install the service
SC create subversion_service binpath = "C: \ svn1.5.3 \ bin \ svnserve.exe -- service-R c: \ versionlib \ myproject" displayname = "Subversion repository" depend = TCPIP
Pay attention to the space after the equal sign. Enter the preceding command in one line.
(2) start the service
Choose "start"> "Control Panel"> "Administrative Tools"> "services", find the Subversion repository service, and double-click "start ". You can set the start type to "automatic", so you do not need to manually start the service each time.
You can also start the service in the command line mode:
SC start subversion_service
(3) Delete a service
SC Delete subversion_service
The above is just the most basic usage of subversion. There are many advanced applications in subversion. You can refer to the relevant documentation to select and use it.