Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use mercurial (Hg) within a Python application?

Aloha!

Hg is a fine DVCS that is also a python module. This allows us to do ''import mercurial'' and load hg into our own application. My idea was to use mercurial within a Python application to create a revision controlled storage for my application.

However my google-fu semms to fail me. I can't find any documentation, tutorial or examples of how to use hg as a module in Python providing functionality. help(mercurial) lists the normal commands and dir() provides some hints of methods.

But do you for example create files for backing store, or do you get another type of data structure that works as a Hg repo?

There seems to be great potential for neatness having this functionality. But how?

like image 500
JoachimS Avatar asked May 04 '11 19:05

JoachimS


1 Answers

API is mostly undocumented, and using it might require you to release your code as GPL — see https://www.mercurial-scm.org/wiki/MercurialApi. The preferred (and more backwards compatible) way is to call hg CLI frontend.

like image 88
Cat Plus Plus Avatar answered Dec 03 '22 08:12

Cat Plus Plus