This isn't going to work. It may say "hg: command not found" on your shell, but on mine it says "command not found: hg" and other shells may say other things entirely. We need a better solution that we can apply to each SCMClient. I suggest adding a function to check if the binary is in the path. We can call it in each SCMClient before running it.
Correct post-review error messages when run outside of a checkout directory, when Mercurial is not installed
Review Request #322 — Created March 28, 2008 and submitted
|Review Board SVN (deprecated)|
Currently, if you call post-review outside of a checkout directory (somewhere that no SCM info is available), and you do not have Mercurial installed, you will see this error (using a bash shell): Failed to execute command: hg root /bin/sh: hg: command not found That's not a very helpful or clear error message. This patch causes the following error message to appear instead: The current directory does not contain a checkout from a supported source code repository. That's much more clear and is a correct statement of the problem. It looks like the Mercurial code was only tested on machines where Mercurial is installed. I think the code as written would work fine in that case -- but, not all of us have it installed.
I don't have Mercurial installed (hence this patch), but I have tested that post-review still works outside of a source controlled directory (giving a valid error), and inside of a Subversion checkout directory.