Correct post-review error messages when run outside of a checkout directory, when Mercurial is not installed
Submitted
Updated 7 months, 3 weeks ago
| Marc Hedlund | Reviewers | ||
| reviewboard | |||
| None | Review Board SVN | ||
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.
Posted 7 months, 3 weeks ago (March 29th, 2008, 4:14 a.m.)
-
http://reviewboard.googlecode.com/svn/trunk/reviewboard/contrib/tools/post-review (Diff revision 1) 876 if data.startswith('abort:'):876 if data.startswith('abort:') or data.find('hg: command not found') != -1: -
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.