Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add argument parsing, settings, and docs for p4-trigger-script.
This greatly enhances the code for p4-trigger-script, bringing in some functionality that will be available in the upcoming `rbt repo-hook` command for RBTools 5. The script now allows for command line options for customizing behavior and connection information, which means that users don't have to fork and modify the script. It also allows admins to specify certain arguments on the command line that will be expanded when calling the trigger. This is needed to talk to Perforce and edit changes as the submitting user. New in-script settings (and command line options) are added for enabling debugging, setting a `p4trust` file location, setting a Perforce client name and host, and setting a Review Board API token. Documentation is provided at the top of the script to help admins get set up. Docs on the website will be created separately, once this is fully tested in production. Some changes had to be made within RBTools to facilitate some of these changes: 1. `initialize_logging()` now accepts a `debug` parameter to enable debug logging for hooks. 2. The call to `p4 change` no longer ignores error result (which caused errors to be sent to the caller as a valid changeset). 3. Logging information for failed marshalled commands now includes demarshalled payload and stderr information. Testing Done: Thoroughly tested the script with command line options and in-script settings. Tested with using a hard-coded user and a Perforce-provided `%client%`, `%clienthost%`, and `%user%`. Tested with and without debugging information. Tested with inaccessible Perforce changesets (which unveiled the `p4 change` error handling problem). Reviewed at https://reviews.reviewboard.org/r/13060/
- Loading branch information