You can use the Review CLI tool to create reviews in Crucible, for patches and commits, directly from your terminal. It takes the uncommitted changes in your workspace and creates a review for them in Crucible. The Review CLI tool may be especially useful if:
- you often create pre-commit reviews
- you want to submit a diff from an external tool for review
You can use the tool on Windows, Linux and Mac OS X, for repositories that are managed in:
- Subversion
- Perforce
- Git
- Mercurial
- CVS
The tool supports Crucible 4.8, and later versions. Python 2.7 or Python 3 must be installed on your local machine. Python 3 is supported since Crucible 4.8.11.
You can use the tool to create new reviews, and to update existing reviews with new patches.
Known limitations
- The CLI tool does not yet allow you to create a review for an existing commit.
- The CLI tool takes all the files that have been modified, added or removed in the working copy and submits those for review. It doesn't support choosing only files associated with a specific changeset.
- You can only use the CLI tool to create reviews in projects for which you already have review create permission.
On this page:
Related pages:
Installing the Review CLI tool
Download the Review CLI tool from either of the following locations in Crucible:
- When creating a review, click Pre-commit in the 'Add Content to Review' dialog, then click Download:
- Choose Profile settings from your user menu, and then Tools. Click Download:
The script comes pre-configured for the user for the given SCM server.
Copy the script to a location somewhere in your system path, for greatest ease of use.
Python
Python 2.7 or Python 3 are required.
Linux
Python should come with your distribution. If not, or if it isn’t installed, you will need to install the appropriate package. Please refer to your package manager for the appropriate version.
Windows
You can install Python by running the latest Python 2.7 Installer or Python 3 Installer for Windows.
MacOS X
Python should come with any modern version of MacOS X. You can also download Python from http://www.python.org/getit/.
Python libraries
You need to install the required libraries:
pip install future==0.18.2 pip install configparser==4.0.2
Using the Review CLI tool
To create a review using the Review CLI tool, run the script from a directory under SCM control that has local, uncommitted changes. The changes will be submitted to Crucible for review.
Call the script with the following command:
crucible.py <arguments list>
The Review CLI syntax is consistent with that for Crucible and Fisheye smart commits. Examples of syntax usage are provided in the following table:
Action | Syntax | Result |
---|---|---|
View usage help | crucible.py --help | Displays the help with descriptions of all the valid commandline arguments |
Create a pre-commit review interactively | crucible.py | Gets the patch from the current SCM, prompts for the project and review title, and creates a draft review |
Create a pre-commit review with a given project and title | crucible.py -m "the review title" CR-FE | Gets the patch from the current SCM, creates a draft review in the CR-FE project with the given title |
Create a pre-commit review with moderator and reviewers | crucible.py CR-FE @matt @joe --moderator ted | Gets the patch from the current SCM, creates a review in the CR-FE project, adds matt and joe as the reviewers and ted as a moderator, starts the review |
Create a pre-commit review anchored to a specific repository | crucible.py -r repo1 | Creates a pre-commit review interactively, trying to anchor the patch to the given repository |
Add a patch to a review | crucible.py CR-FE-1204 | Gets the patch from the current SCM and adds it to the review CR-FE-1204 |
Create a review from diff output | hg diff --git | crucible.py | Creates a pre-commit review interactively, taking the output of the first command as a patch |
Create a review from a diff file | crucible.py -f file.diff | Creates a pre-commit review interactively, taking the output of the patch from the given file |