JavaHg is a high-level Java library for interacting with Mercurial. The project homepage is http://javahg.org/.


JavaHg gives you:

  • Fast: Normally, you would start a Mercurial process and then parse the output. JavaHg uses the Mercurial command server instead. This means that JavaHg starts a single Mercurial server process and interacts with that for the following operations.

  • Convenient: We have done the hard work of parsing the output and turning it into a useful Java API. Parsing a command like hg log is easy enough, but JavaHg also has code to talk with the interactive commands such as hg merge.

  • Safe: If you construct the command line by hand, then you might make a misspell the name of a flag and it wont be discovered until runtime. With JavaHg, you get a type safe API where command line flags are real Java methods. This gives you completion support in IDEs like Eclipse and prevents runtime errors.

  • Documented: JavaHg comes with extensive JavaDoc documentation that describes how each command works.

  • Tested: We have unit tests for all commands. We use Jenkins to run the tests against different Mercurial versions to ensure that we maintain compatibility with new and old versions.


JavaHg is available as snapshot builds for Maven. Please see our Maven instructions for information about what to include in your pom.xml file to depend on JavaHg.


If you want to contact us, then please use one of these channels:

  • Mailinglist: This is the place for discussion about the development of JavaHg. You're also very welcome to send us a mail if you're using JavaHg in a project. Send a mail to javahg-subscribe@librelist.com to subscribe.

  • Stack Overflow: You're welcome to ask JavaHg questions on Stack Overflow. This is a good place to ask your "How do I do ... in JavaHg?" questions. Please make sure to tag your question with javahg so it will show up in the right category.

  • Bitbucket Issue Tracker: This is where you should report bugs in JavaHg. That would be problems of the form "When I do ..., JavaHg throws an exception".

Please remember to tell us which JavaHg version you're using.


JavaHg is distributed under the MIT license.


JavaHg was started by Jan Sørensen and Martin Geisler. See the commit log for the full list of authors.