Parsing a command
Ghyslain Leclerc
ghleclerc at gmail.com
Fri Apr 26 17:09:46 UTC 2013
Hello.
I am working on a simple Python script to send a single Mercurial command to multiple repositories without having to use subrepos. Nothing fancy or really elegant, but simply something to suit my needs.
In short, from where I am in the file system, I simply look at every folder underneath my location, determine if there is a .hg directory and run the command if it is the case.
I have successfully finished the script, but I now realize that I am not robust to mistyped Mercurial commands.
I first thought of looking the command parsing code in Mercurial sources to see if I could reuse it, but it was too complicated a solution for me (not a full time developer, but a medical physicist who convinced everybody in his group to use Mercurial for our code versioning needs). Then, I thought of the command server, but I don't seem to find a way to simply test if a command is OK before executing it.
My solution for now is to apply the command once, get the output and if there is a mistake, abort for the other folders. Works fine, but forces me to run the command at least once. I'd like to be able to test the command before running it even once. I worry (maybe without cause !) about commands that can't be undone after the fact.
I was wondering if there is a way to test a hg command before launching it. A little like a "dry run" kind of a thing. Something like "hg --test log -l 7".
Maybe what I'm asking makes no sense at all. Please let me know.
First email on the list. I have searched the archive, Google, and tried to find a work around, but can't find an answer. I tried to follow the etiquette. Hope I did OK. English is not my first language, so my apologies if the mail is incomprehensible.
In advance, thanks,
Ghyslain
(ghleclerc at gmail.com)
More information about the Mercurial
mailing list