Interesting tidbit on Mercurial…

After Andrew’s presentation on Mercurial and Git, I thought I’d give one of them a shot. Since Mercurial is written in Python, it obviously won. Well – obviously for me, but then I really like Python.

Anyway, an interesting quirk about using Mercurial. If you are working on the command line in a subdirectory, it doesn’t know about the repository you’re in. For example, I took the obvious tact of managing apache configs with it. I picked /etc/apache2 as a nice good top location, initialized the repository, and added in all the files.

Then tonight I was back in there, making a few edits, and I was editing a file in /etc/apache2/sites-enabled/. At this point in subversion, I’m used to getting a response from “svn st”, so I tried “hg st” – nothing. “hg commit” to commit the changes also didn’t work. It wasn’t until I switched back to the central directory that I could see the changes and do the commit.

After thinking about it a bit, this all made sense – it’s working from the .hg directory I left in place at /etc/apache2, but it still took me a bit by surprise.

Published by heckj

Joe has broad software engineering development and management experience, from startups to large companies. Joe works on projects ranging from mobile to multi-cloud distributed systems, has set up and led engineering teams and processes, as well as managing and running services. Joe also contributes and collaborates with a wide variety of open source projects, and writes online at

One thought on “Interesting tidbit on Mercurial…

  1. I think something is messed up for you. I can easily do “hg status” or any other commands in subdirectories on my enlistments. Could it be your python path? What you describe is no quirk – that would be a fatal flaw in my opinion.


Comments are closed.

%d bloggers like this: