I am trying to automate hg commit and hg push commands , for that I need to call those commands from firefox extension (which I am working on). Is there a way to do it without using batch files ?
+2
A:
Yes, you can just call hg directly like any other process.
See here how to make a command line call from within a firefox extension.
Of course for the call "initWithPath" you must specify the hg command line binary, that is also executed when you type "hg" in a Terminal window. And this command line utility will have different locations on different platforms. So if you expect the extension to work crossplatform, you should offer a preferences panel, where the users can enter the path to their local hg binary and by default you could also put there the standard path where most users on that platform would have installed hg to.
Mecki
2010-06-28 17:41:36
Haa..I didn't think of calling the hg.exe file and passing arguments in to it....Thanks a zillion !!!! You rock !
Nitesh
2010-06-28 18:14:45
You could even call Python interpreter and feed it the path to the hg main .py file... not that this would buy you anything. Even worse, in that case you have to know where the Python binary is located and where the hg main Python file is. So calling hg.exe is definitely easier. Further the output of hg is easy to parse (via Regex Pattern Matching for example) and using command line arguments, the exact output is also customizable for many commands up to some degree.
Mecki
2010-06-28 18:51:28