📜 ⬆️ ⬇️

Mantis + Subversion on your computer with Windows XP. Step-by-step instruction for convenient organization of work with the code


Historically, the bugtracker on our team is Mantis . To work on the bugs is very good and easy to learn system. Literally sit down and work. But for the convenient organization of work, she clearly lacks a bundle with Subversion. In conjunction, Subversion + Mantis helps to organize work with the code of a small team of programmers. In more detail about the organization of work with us, I described in the last article .
And now let's talk about how to install Subversion on your computer and link it with Mantis on the server.

1. Download the necessary software


We need to load the server itself and the client to work with it. As a client, I recommend using tortoiseSVN , in which the novice and will understand as quickly as possible. In addition, Russian is available for this client.
So, download the latest stable-version of the server, the client and the Russification to it.
This is for Subversion itself. Additionally, we need the following software:

2. Register to No-IP and install No-IP Client


If you have a dedicated IP, then this is not necessary. You can get to your computer through it, and if the host’s IP address is dynamically generated by you, you cannot do without such a program. The essence of the service is that you put on your computer a program that constantly finds out your IP address and if it changes, sends data to the server. Appeal occurs through the address you choose on the server. Thus, to your computer occurs through a permanent "server address", which is associated with your real at the moment IP address.
Go to http://www.no-ip.com and create a free account there. In the account, click on Add Host. As HostName we drive in the name of your company. In the drop-down list, select the domain name you like. For example, no-ip.biz.
We put the No-IP Client and drive into it the data of the newly created account. Everything, now in order that someone could access your computer, it’s enough to drive in an address like
YourCompanyName.no-ip.biz

3. Install the Subversion server and client


The installation is easy and easy, just press “Next” everywhere. First you need to install the server, then the client, then, if necessary, Russification to the client. I do not use Russification. I do not like.
During installation, do not change the standard paths that the installer offers.

4. Create the first repository (storage)


Create a daddy C: \ svn-store \
Go to the console (Start-> Run, cmd) and write:
svnadmin create c:/svn-store/my_project
Pay attention to slashes! They should be specified that way, in the manner of unix. If the repository is successfully created, no errors will appear.
Open the file C: /svn-store/my_project/conf/svnserve.conf and uncomment the lines:
anon-access = none<br>
auth-access = write

Those. We only allow registered users to download / upload files from the repository. Anonymous users do not have access to the repository at all. Sharovarschikami most often used such a policy. Data about users lies in the file that is specified in the line (which also needs to be uncommented):
password-db = passwd
Those. so we show that in the folder C: \ svn-store \ my_project \ conf there is a passwd file with indication of logins and passwords of registered users.
Go to C: \ svn-store \ my_project \ conf \ passwd, open it with any text editor, and create user accounts in the users section. The format is:
UserName1 = UserPassword1
UserName2 = UserPassword2


5. Fill in the repository source data


We need to import, the initial content of our repository. To do this, create the folder C: \ Repository, and in it there are three empty subfolders: trunk, branches and tags. Go to the folder C: \ Repository, click the right mouse button on the empty space and select TortoiseSVN-> Import ...
Import data to SVN
As a URL, enter:
svn://YourCompanyName.no-ip.biz/my_project/
As you can see, this is the URL that we defined in the second step, plus the name of the folder where the repository is stored.
Click OK. You must ask for a username and password. Specify the data that is entered in C: \ svn-store \ my_project \ conf \ passwd. If instead of the login and password entry window you didn’t see, go back to the C: \ svn-store \ my_project \ conf \ svnserve.conf and C: \ svn-store \ my_project \ conf \ passwd editing points - you either did not uncomment the lines or did not specify usernames / passwords.
If successful, you will see something like this:
Setting basic folder properties
')

6. Configure Subversion to work with Mantis


1) Create a temporary folder C: \ Temp. Select the folder with the right mouse button and select SVN Checkout in the context menu ...
For the URL of repository, enter svn: // YourCompanyName.no-ip.biz/my_project/. Checkout directory must be equal to C: \ Temp. Do not change other settings and click OK. As a result, three folders created in the last step, and a service folder .svn will appear in the folder C: \ Temp. Do not touch her in the future.
2) Right-click again on C: \ Temp and select TortoiseSVN-> Properties. In the window that appears, set the properties as shown in the figure. In this case, it is MANDATORY when adding each new property, check the “Apply property recursively” box:
Kamit folder properties
Now right-click on C: \ Temp and select SVN Commit ...
Import
After entering the comment as in the figure, click OK. TortoiseSVN will swear that we have not entered an error number. Ignore it.
3) Fill in the server script svncheckin.php. It should be located in the core subfolder of the folder where Mantis is installed. As a result, the path to the script will look like:
URL-TO-MANTIS/core/svncheckin.php
4) Go to the folder C: \ svn-store \ my_project \ hooks and copy the files there

Open svn_checkin_shell.ini and paste the correct path to svncheckin.php there. Check other paths in the ini file. If you did everything as I wrote before, then you do not need to change anything. If you have changed some paths, they will also need to be corrected in the file post-commit.bat.
5) Go to Mantis, login to it under the admin and create a new user: “SVN Bot”. We assign Developer's rights to it and assign it to ALL active projects. All automatic comments will now be written on behalf of the SVN Bot.
We also create a new bug in our project. We call it, for example, "Testing SVN + Mantis bundles". We remember the number of the bug.

7. Import the project source code into the repository


The process is similar to step 5. 1) Go to the folder with the project, right-click on the free space and select TortoiseSVN-> Import ...
Adding base folders
As a URL, enter:
svn://YourCompanyName.no-ip.biz/my_project/trunk
Notice that the trunk folder is listed at the end. Click OK.
Now the data is filled into the repository. If you have a large project and a lot of files, then most likely it will take a lot of time.
After you see the inscription "Completed At revision ..." you can breathe a sigh of relief. The preparatory phase of work is over :).

Daily work with tortoiseSVN


We have completed all the necessary actions. Now I will briefly tell you about the routine: daily work.
All work with the code takes place in working copies of the project. Each developer has his own working copy. Therefore, the first thing that a developer must do in order to start working on a project is to create a local working version.
Then, each time before starting work on a new feature or bug, the programmer updates the working copy (SVN Update). After the code changes are completed, the developer makes SVN Commit. If you do this, then several people can work on the project. This is very brief. More details are written in the e-book on tortoiseSVN. The link to it is located at the end of the article.
Well, let's perform one iteration in order to check that everything is set up correctly.
1. Create a working copy of the repository on the local computer.
Create an empty folder and right-click on it “SVN Checkout ...”. The same URL:
svn:// YourCompanyName.no-ip.biz/my_project/trunk
So you upload a working copy of the project from the repository to this folder. In addition to the project files, the hidden folder “.svn” will appear in it - in no case do not touch it, it is used by SVN when committing changes to the repository.
Now all folders are marked with green checkmarks. This means that no file has been modified. When we make changes to any of the files, it will automatically be marked with a red exclamation mark. It is very convenient.
Changed file icon
2. We make changes to the project to make sure that SVN is working properly.
You can do anything (except for the .svn folder and its contents, which cannot be touched) - create / edit / delete project files. I limited myself to changing the contents of a single text file.
To record changes in the repository, right-click in the folder and select “SVN Commit ...”. Enter a description of the camit in the Message field and MANDATORY the number of the test buggy we created in Mantis.
The first source code in Subversion
Click OK.
After adding the data to the repository is complete, open Mantis and go to the test bug. The final comment will be an automatically generated report about Kamite from SVN Bot. There will be something like this:
What is Kamit in Mantis?

That's all. Good luck to you, dear habrvchane. :)

PS Maybe someone knows if it is possible to send the ACTUAL "slice" of changes in each camite somehow in Mantis. Something in the spirit of how WebSVN does, but only so that you can use it when the Subversion server is on your PC?

Source: https://habr.com/ru/post/86083/


All Articles