Would you like to know who and when changed the line
n in one of the source files of your program or site? Would you like to be able to undo the changes in the code made a week ago, after the new feature was ready? Would you like to make the work of two or more programmers on one project transparent, simple and easily controlled? Or maybe you want to be able to have access to the source code of the version of the program while not worrying about timely backups?
Good news: all this, perhaps more than that, is simple and free. In this article I will tell you how to do it.
Who needs it?
This article was written for those who are not yet using the version control system. Probably, I have not heard of them, and perhaps I was afraid to deliver them, thinking that it is very difficult or requires some special technical means (my own server, etc.).
For those IT professionals who have grown to the level where they themselves are too lazy to write the code, and the income allows you to hire someone to help you, the article will be doubly useful, as I will tell you about the option of setting up a working process with hired people, when tasks and their implementation are monitored MUNT and Subversion buggy BELT helpers.
So let's get started ...
Story about us
Not so long ago, I was “grown up” to a level where I can afford to hire people to write the code of my programs. My first employee is a 2nd year student who could program. I wrote assignments to him, he performed them, came to me and showed what he had done. We discussed the shortcomings and merits of the program, and he left to finish it. Found errors and wishes were recorded in the TXT file, and when the student came to me again with the new version of the program, in this file there were already “+” and “-” opposite each task.
It quickly became clear that it was impossible to work this way. It was very inconvenient to keep track of what was done wrong, suggestions for particular specific shortcomings. The part was lost, the part was deleted unintentionally, etc. Even the transition to Word did not help ... J
The solution was the installation of Mantis.
Mantis is an error
management system located on the server. Simply put, a user-friendly interface that allows you to track work on a specific error and comment on the implementation process. The database is located on the server, therefore, all you need to work with Mantis is an internet connection. This is not the only such system, there is a
whole bunch of analogues . Of these, the most popular is
BugZilla . But I personally like the Mantis convenience more, so the choice was on it.
After installing Mantis, the process began to work differently:
- I am writing a technical assignment, giving it to a programmer.
- In the process of execution, he makes intermediate versions that he sends me by mail.
- I check them and all the errors and wishes that I have, I bring in Mantis.
- Next time I get a program where another piece of TK is executed, plus all or part of the errors in Mantis are closed. I check the program again. Through Mantis, I close the errors if I see that they are fixed. If not, I open the error again and add my own comment, which I don’t like. As a result, the programmer again receives a list of corrections that he has to make.
- Everything is repeated in a circle until the TK is fully completed and all errors are closed.
This approach lasted more than a year. Indeed, this is the minimum that allows you to track the process of implementation and roughly plan the dates. But the disadvantages of this approach make us look for a new version of the organization of labor:
- I have to wait until the programmer sends me a new version of the code, in which a dozen or two changes are accumulated. Those. I can not proceed to the test.
- Considering that I get a lot of fixes at once, it’s almost impossible to check the programmer’s code: it’s difficult to trace the logic.
- It is necessary to accumulate archives for each new build that the programmer sends me. Very carefully it is necessary to number the version, then to understand what was going on. And to recreate what was done at the stage of version 0.0.6, when you are already working on 0.0.12, it is difficult.
- With this approach, the work of two programmers on one project is so difficult that we can assume that it is simply impossible. It is most important!
The last flaw is fixed with Subversion. We will talk about it below. But besides him, there are still a number of trifles that make the work of several programmers not only possible, but also
convenient ! To understand this, I worked for several employers. The result that I am talking about now is an experience that I had due to “work for my uncle”. I can say that not everyone has done as comfortably as mine, and I am very proud of it :).
Organization of the workflow with us
')
This is how the process of creating a program is organized with us now.
- I am writing a technical task. The task is divided into subtasks. All subtasks are recorded in separate bugs in Mantis. In addition, for each task, time is estimated and this estimate is entered in Excel (alas, for now only in it :(, it can be more convenient ...). Thanks to Excel, I can roughly imagine when I get the finished first version of the program, and the programmer has a list of tasks in Mantis and the technical assignment, which describes in detail what and in what order to do.
- For each new program I create a new Subversion repository (repository for code). I add accounts for myself and the programmer.
- The programmer creates a working copy of the repository, in which he works in the future.
- After completing a subtask, the programmer makes Commit into the repository and closes the bug. During Commit, automatically:
- When I receive the letter, I can immediately update the working version of the code, check the part of the code that has been changed (that is, is related to a specific task) and write a comment if necessary, or rediscover the error.
This method of organization allows to achieve the following:
- A lot of people can work on a project.
- Apart from the fact that the tester (we are speaking in his role), we don’t have to wait for the new version, we manage to reduce the time spent by the programmer on additional correction (when the bug is rediscovered): it is easier for the programmer to make additional changes “hot on the heels”.
- Get all the bonuses from working with Subversion (backup code, tracking its changes, the ability to bring to work several people who do not have access to each other's code, etc.), plus a correctly and logically generated change log .
In most firms, the programmer adds a comment to Commit-u the way he wants. In addition to the commentary itself, we have a clear link to the bug in Mantis. This makes it possible to quickly understand why changes were made in the code, even after several months. - For each error, a change history is automatically created that is associated with it. This makes it possible to track how the error was corrected step by step.
- In the comments that are automatically added to the bug, there is a revision number. This makes it possible to read a detailed description of the bug (and not a mean comment at the beginning) and make an informed code review.
And now, the most interesting ...
What is needed to organize the work of several programmers on a single project, and how much does it cost?
The answer is very happy. If you are reading this article, it means that you already have everything you need: a computer with an internet connection. Not even a dedicated IP address is needed :). Well, except for Mantis you need the usual virtual hosting for $ 1- $ 5 / month. But if you are an IT specialist, then you have it for sure.
Immediately make a reservation that about the installation of Mantis, I will not tell. This process is described in many articles, it’s enough to google a little bit. Let me just say that to install any special skills is not required. The installation itself takes 20 minutes - an hour. If you did not work with the system, then you will need a day to figure it out.
We assume that you have your own virtual hosting and it already has Mantis installed. You have decided to organize the work of several programmers on one project. You need Subversion for this.
What is Subversion?
Subversion is a free, open source version control system. Subversion allows you to manage files and directories in time. The file tree is placed in a central repository, which is similar to a regular file server with the difference that it remembers every change made to a file or directory. This allows you to recover early versions of data, examine the history of data changes. Due to this, many consider the version management system to be a kind of “time machine”.
Subversion is specifically designed to replace CVS, the most common open source version control system. It has all the basic functions of CVS (although it performs some of them in other ways) and is devoid of some of its drawbacks.
Subversion is often called “svn”, after the name of the client program included in its distribution.
Where can I install Subversion?
Ideally, on a server that works only on an intranet LAN. But I have another case: all employees are remote, so the server should provide access to the repository via the Internet.
In my situation, it is convenient to install Subversion on the server at the hoster. Then the repository will be available 24 hours a day at a decent speed. But, alas, there are some drawbacks. If you are working on a commercial project, the theft of the source code can cause very significant damage to your business. In order to protect against theft, you do not need virtual hosting, but a VIRTUAL SERVER. And this pleasure costs from $ 30 / month. and before hoo hoo. In addition, the placement of source codes even on a virtual server does not protect against a dishonest admin, who can merge the entire repository onto a USB flash drive, directly from the computer (perhaps paranoia, but it’s not enough ...). At the same time, no one hoster with his own money will legally guarantee the safety of the data: (.
I chose another way - to keep the data on my computer with Windows XP. This method has a definite plus - all the source code from you and no one steals it from you. But the speed of access to your computer will surely be less than that which the hoster can give, and your employees will have a repository only when your computer is turned on.
In the next article I will lay out step-by-step instructions on how to install Subversion on my computer ...UPD: The second page with step-by-step writing of the Subversion installation process on Windows XP and instructions for linking Camites to Mantis is
here . If anyone wants to keep the code of his program at his place and at the same time wants a convenient organization of work - an article for you.