Sunday, July 3, 2011

Souce Code Management with Tortoise Hg

Tortoise Hg is open source, source management software. With this software, user can modify the content of the file without having to rename the file. In addition, you can even see the versions of your files in graphical form. That is, how your file is being modified. I often used it to keep track my PCB layout as most of the time, once too much editing is done, the PCB layout tools will stop you from returning to the previous steps. Thus, this tool can be used not only with codes, but also with files. The method of setting up a repository and method of using it will be further discussed below:

Using TortoiseHg




Figure 1-1: Files to be added


Create a folder with the file or files to commit. Right click anywhere in the folder -> TortoiseHg -> Create Repository Here. By doing so, TortoiseHg init will be prompted as shown in Figure 1-2.



Figure 12: Setting up a repository in the folder itself


If you need to run the commit directly, select "Run Commit after init". If not, just click on create. In Figure 1-3, you can see that .hg and .hgignore has been created.



Figure 13: .hg folder and .hgignore is created




Figure 14: Adding comment and select files to commit


If you have selected "Run commit after init", then, this window will be prompt. If not, click on the file -> Right hand click -> Hg Commit. Then, this window will be prompt. Select the files to commit and press commit.



Figure 15: Files that are committed to the repository


Once the files or folder has been committed, a green tick is created on the files or folder icon.



Figure 16: Test1.doc has been modified


Any further modifications on the file will give the indication as shown in Figure 1-6.



Figure 17: update to the previous version of the file


If you have modified your initial files too much and you intend to return to the last commited template, you can do so, by right click on the file -> Hg Repository Explorer -> click on the previous file, which you want to return to. Then, the window in Figure 1-7, will be prompt. After that, click update.


Figure 1-8: Shows the time the file has been modified and new v1.00 is created from the initial document file


After updating, you can edit your current documents and commit them to the repository. Once it is done, open up the Hg Repository Explorer, again by right click on the file -> Hg Repository Explorer. You should be able to see similar layout as in Figure 1-8.

Conclusion


This software is very useful to manage your source codes, as well as your files without having too many versions on the screen. Additionally, it allows the user to return to the previous files, which is limited by the undo button itself in most of the software.

Note: Remember to commit the files each time you are edit your files. Without doing so, you will not be able to return to your previous documents.

No comments:

Post a Comment