When I used Subversion as the SCS, I had all my projects in one repository, and every commit went to the central server. I looked at root folder and I knew commit status of all projects.
Now I use Mercurial and I have multiple unrelated or loosely related projects and every project is a separate repository. My dev folder is structured like this:
So, after a frantic week where I made fixes to old code, changed some scripts, worked at current development project and tested some new techiques in test projects, I asked myself:
- Have I commited every change in every project?
- Have I pushed every change to remote server?
- Is there any change in remote repository I can pull?
TortoiseHg icons give me some clues but they often can be wrong. I have to remember what I changed or check every project one by one. I’m not good at remembering things and I hate repetitive work that computer could do for me so i just had to write another utility to keep track of my projects.
Here’s how it works:
- Configuration is done in config.ini
- HGChecker will traverse folder hierarchy beginning from [ProjectRootDir]
- It will check if any subfolder is project folder using patterns defined in [FindProjectRootFilePattern] or [FindProjectRootDirPattern]
- It will run hg.ex defined in [HgExecutable] with status, incoming and outgoing parameters.
- It will translate responses from hg and show the results in console, coded as following:
- ? (cyan) – project is not source controlled
- M (blue) – uncommitted changes
- ↑↓ (red) – no valid default remote repository
- ↑[#] (yelow) – there are # outgoing changes to push
- ↓[#] (yelow) – # incoming changes available from remote repository
So, I have a scheduled a task that runs HGChecker every day at the end of the workday. Usually I strive to commit when I’m done, push when it’s ready and add every project to source control. But I’m not perfect and I easily forget. HGChecker is there now to remind me.
When this screen shows up, I immediatelly know the following:
- I have some uncommited changes in App1 and there are two remote changes I must pull – there is merge on the way
- It seems I created ReportingApp2 project but I didn’t add it to source control
- I have commited one change to Importer1 but I didn’t push it to remote.
- Importer 2 is source controled but it doesn’t have default remote repository