Version Control with SVN - GUIs
Previously we talked about working with the log in SVN and we learned a few important terms like version number, revert, and diff. We saw how we can use diff to compare different versions of the same file that's been saved in SVN. So what's the trouble? Despite that I demonstrated how the results from running diff are not as scary as they might seem at first, it's still not so easy on the eyes.
Luckily, we have graphic tools exactly for this reason—to manage the diff. They allow us to more easily see differences and resolve conflicts. In this article, I'll cover two different important tools—how to look and how to work with them. Of course, there are tons of other tools and methods, but this article is not intended solely to list them, but to really get into working with a GUI in version control.
Meld is a program for Window and Linux and works great with SVN (with git as well actually). Meld is very easy to install. In Linux just run:
sudo apt-get install meld
In Windows, you'll need to go to Meld's site and download the program. Then, while it's downloading and installing, you can wonder why you're still working with that cursed horror call Microsoft with all of its useless services and that stupid clippy!
Apologies for the digression.
After it's installed, running it is very easy. Just run the command Meld followed by the name of the file in the command line or cmd. Meld automatically identifies if you're in a version control system and then displays the differences between the local version and the version saved in SVN. Here's an example:
example of the Meld GUI
We can see that it's very easy to manipulate the program. On the left is the version saved in SVN and on the right is the local version. In this case, there's just one difference, but if there were multiple differences, with Meld it's very easy to organize the changes however we want.
If we want to use Meld as the default tool in SVN for resolving conflicts, it's a bit trickier. There are a few scripts and solutions that will run Meld and the diff tool. This is really only possible in Linux.
Integration with an IDE
Obviously an IDE like IntelliJ in all its varieties (like Webstorm, PHPstorm etc.) has built-in tools that display quickly and easily the log and the differences. Just like Meld, most of the built-in tools in an IDE will be able to identify if the project is under version control.
In PHPstorm, which is a branch of IntelliJ, there is a subversion tab in the menu (under SVN), and there you can see the log of the changes and run diff on the local version vs. the server, or between any two versions. You can also make a change to a file and then do commit directly from the IDE without having to leave the command line. If there is a conflict, the IDE will identify it and open a tool very similar to Meld that lets you use a GUI to check the lines and resolve any conflicts.
Example of a GUI with integration between the IDE and SVN
That’s pretty much it. If you’ve gone through all the articles in this series on SVN, you should have gained sufficient knowledge to work with SVN. If you never had any experience with version control, you learned several important concepts: local version vs. the one in version control, commit which is done from the local environment and pushes to the version control. Also, log (a list of commits), conflicts, diff, and of course branches and merge.
This series is not particularly in-depth. There are a few other functions, but in general, it’s enough to work with SVN. Version control with SVN is thought to be a bit outdated now, but it’s still a good introduction to version control before diving into Git.
In the next article, we’ll learn about additional tools in SVN.
About the author: Ran Bar-Zik is an experienced web developer whose personal blog, Internet Israel, features articles and guides on Node.js, MongoDB, Git, SASS, jQuery, HTML 5, MySQL, and more. Translation of the original article by Aaron Raizen.