Mercurial tool to export changed files
Tuesday, April 27th, 2010
Recently, my friend Chris Brown convinced me to move my source control from SVN to Mercurial (or more specifically, Kiln).
I found Mercurial to be infinitely better than SVN in almost all resepects, but there was one thing missing that I could do with Tortoise SVN but not Tortoise HG, and that was to export any changed files from one revision to the next - something which as a web developer, I have to do very often.
Well, Chris came to the rescue and created a simple program to do exactly that. So here’s Chris to explain the program and how it works:
Download links are at the bottom of the page.
Hi,
My name is Chris Brown and I am a big fan of FogBugz so when FogCreek announced Kiln (a mercurial client) I immediately jumped on the bandwagon moved to Kiln and have never looked back. The Kiln Mercurial solution solved all the issues I had with merging and speed in Subversion and I was a very happy man indeed.
Then one day whilst chatting to my good friend Gary @ Simian Enterprises (who has kindly let me blog via his site on this occasion) I mentioned Kiln to him and proceeded to wax lyrical about how great it was until his ears were bleeding and to my surprise I had convinced him to give Kiln a try.
Now Gary was at first very happy and was as thrilled as me at the beautiful Kiln web experience and TortoiseHg integration, however there was one nagging feature he used a lot in Subversion which does not exist within the Mercurial system, and after doing a bit of googling it seems a few other people hit the same snag.
It is not possible with TortoiseHg to export a copy of all files changed since a specified revision. Now to most this would not cause much of an issue, I myself have never had this need, and do not think I will, but for those working on big complex websites like Gary does this is a big issue.
When uploading the new version of a site (usually by FTP) this can take some time, and I am sure most people will agree that uploading files with no changes is nothing but a waste of time. Being able to export just the files changed since the last update and only updating these makes a lot more sense and will result in far fewer files being transferred and as mentioned TortoiseSVN has this capability as standard.
With any luck one day the TortoiseHg system can also have this command, until then I have written a small application in Visual Studio 2010 which does what Gary needed and hopefully it will be of use to other Kiln/Mercurial users too.
Please note: this is one of those programs I knocked up very quickly, it does not have much error handling and the code is not that tidy, however it does work and I have provided both an installer for the app and the original Source Code, please feel free to amend as needed or build on this to meet your needs.
Below are details of each input and what it is used for and what the buttons do, this currently checks for changes between a revision and tip and assumes the current working folder is updated to Tip.
Root Directory of mercurial repository: should point to the path of the root of your repo (where .hg lives)
From Revision #: the revision number to check from
Export target folder: the folder to copy changed files to (must be blank)
List Changed Files: lists the files in the list box that will be copied based on current settings.
Export Changed Files: same as above but also copied to the target folder/
Close: does what it says on the tin.If you like this little utiity and would like to make any comments you can find me on Twitter (@CB46)
Thanks
Chris BrownDownload: Windows Installer | Source
Filed under: General, Source Control, Website Development.
