4 ms·
> I can only wonder how productive writing custom porcellain commands in mercurial is given that interface. You don't have to use Python to add more commands o
by jordigh 13y ago
> I can only wonder how productive writing custom porcellain commands in mercurial is given that interface.
You don't have to use Python to add more commands on top of Mercurial. Its CLI is also its API, just like git, and you don't typically have to use Python to write tools on top of hg, just like you don't typically need to write C to hack on top of git.
The stdout of hg is guaranteed to remain stable, so you can script it by just parsing stdout. The options are guaranteed to remain stable, so your old tools won't need to be updated in case hg's CLI some day changes, because its CLI never changes.
There are also a bunch of hg CLI commands that start with debug (e.g. hg debugparents or hg debugdag) that you can use to directly manipulate hg's internal revlog data structure and do fun things like create a corrupt repo, if that's what you want to do. :-)
- wirrbel 13y agoI probably should have phrased this more clearly: I think that a python interface (or any other high level script interface) is the more convenient way for a programmer to extend or write hooks/extend the dcvs (I am now thinking about pre commit or post commit hooks in git, etc.). Any first hand experiences with this?
- jordigh 13y agoSure. Here is a silly example that adds a lol() revset to Mercurial that fetches all prime revision numbers: http://inversethought.com/hg/revset/file/2ddbf1893f3b/lol.py http://inversethought.com/hg/revset/file/2ddbf1893f3b/lol.py