A Final Note
Remember a while back when I talked about setting up and using Mercurial for revision control? I hope you’re actually using it. I sure am glad that I am! While writing this article, I was going through the various operating systems I have and doing test compiles. I had just made a slight change to my CMakelists.txt file and wanted to test it from scratch, so I switched over to my terminal window and ran
rm -rf * in the
build-linux directory to clear everything out.
Only I wasn’t in that directory. I was in the top directory of my project, and suddenly everything went away: the build directories, the CMakeLists.txt file, the README and COPYING files, and all my source code. Deleted.
It made for quite a scary moment to think that all my work was gone in a flash.
But then I ran
hg revert -a and all my files were back and I went on about my business.
You see, I’d been keeping all my files in a Mercurial repository, and had even just made a commit right before I ran the
rm – that’s why I was in the top directory in the first place. Thanks to Mercurial, I lost nothing except the build directories, and I was trying to clear those out anyway.
The moral of this is to use a source code revision control system and use it diligently. That way you are protected from your own blunders as well as given an ability to track and back out changes you make while developing your programs.
Oh! Another reason to use Mercurial? To create the source archive that you downloaded, I just ran
hg archive -t tbz2 fracter.tar.bz2 from the command line in my main project directory. Mercurial’s archive command then packaged up all of the files in the most recently committed version of the program, ignoring my build files and uncommitted changes automatically, and spit out the tar.bz2 file for me. It can also provide zip files and tar.gz files, and you can pass it a specific revision, branch, or tag to tell it to package up older versions of your code (so you can create an archive of a stable release while continuing to work on your development version, for instance).
That’s all for now. The next step after this if going to be to convert this program to SDL 1.3, and that will require some major changes!