All Versions
Crucible 4.2 DocumentationCrucible 4.1 Documentation
Crucible 4.0 Documentation
More...
This page includes instructions on generating patch files from your repository, and how to load them into Crucible to be reviewed.
On this page:
Crucible allows you to review a change before it has been committed. To do this, you upload a patch file to the 'Patch' tab (or paste it in as text) when creating a review. You must first generate this patch file from your repository, using either commands built into your IDE, or via the repository command-line tools.
By default, patch files will only show a few lines of code surrounding each change, rather than the entire file and its changes. However, you can create a patch that includes all of the original files' code by using specific parameters (listed on this page) when creating a patch with the command-line tools for your repository.
Crucible can accept a patch file created from any version control system, but instructions on this page cover only Subversion, CVS and Perforce repositories.
Once you have generated the patch file, loading patch files into Crucible is easy.
Screenshot: The Crucible Patch tab
If you already have the patch file you want to review, open the Patches View by clicking 'Manage Files' on the review toolbar, then click 'Patches' on the left navigation bar of the Manage Files view. From there, simply click 'Browse' to select the file and click 'Upload' to add it to your review.
To create a Patch File under IntelliJ IDEA, do the following:
Select a parent folder, sub-folder or file that you have altered in the Project tool window. Select 'Version Control' > 'Create Patch'. The following window appears:
Screenshot: The IDEA Create Patch window
Click 'Create Patch'. Choose a location to save the patch file and click 'Ok'.
If you have not configured version control in IDEA, you may not have the 'Create Patch' option available. If so, use the following steps to create a patch file in IDEA:
1. Select a parent folder, sub-folder or file that you have altered in the Project tool window, right-click it and choose 'Local History' > 'Show History'.
Screenshot: The IDEA Show History dialog
2. In the Local History view, right-click the revision number, and choose 'Create Patch'.
Screenshot: The IDEA Create Patch dialog
3. In the Create Patch dialog, choose a location for the patch file and a file name, then click 'OK'.
To create a patch file under Eclipse, do the following:
Find the parent folder, sub-folder or file that you have altered, right-click it and choose 'Team' > 'Create Patch'.
Screenshot: Instigating a Patch in Eclipse
In the Create Patch window, choose a location on your computer and type an appropriate file name (the file format is plain text).
Screenshot: The Eclipse Create Patch dialog
To create a patch in CVS, use the cvs diff -Nu command from your workspace. For example:
cvs diff -Nu > patch.txt
Note that patch files created with this command will only include around three lines of code, before and after each change.
To create a patch in Subversion, use the svn diff command from your workspace. For example:
svn diff > patch.txt
svn diff does not print any information about files copied in the workspace.
Note that patch files created with this command will only include around three lines of code, before and after each change.
Set P4DIFF
To create a patch in Perforce, you must ensure you have set P4DIFF to point to a GNU-compatible diff program.
Then use p4 diff -du to generate a patch for changed files. For example:
p4 diff -du > patch.txt
Since Perforce diffs do not include added and deleted files so you should then do a p4 opened to find such files. For added files, append them individually to the patch using GNU diff:
diff -u path_to_added_file /dev/null >> patch.txt
In the example above, replace path_to_added_file with the actual path of your added file. You can follow a similar procedure with deleted files using p4 print to extract the previous version of the file.
Note that patch files created with this command will only include around three lines of code, before and after each change.
To create a patch file that shows all lines of code as well as the changes, use the following commands from your repository command-line tools.
To create a CVS patch that shows all code (not just the changes and surrounding code), use this command:
cvs diff -N -U 10000 > patch.txt
The '10000' number refers to the number of code lines included in the patch, before and after each change. 'Patch.txt' represents your desired name for the new patch file.
To create a patch in Subversion that shows all code (not just the changes and surrounding code), use this command:
svn diff --diff-cmd diff -x "-U 10000" > patch.txt
svn diff does not support specifying lines of context, so you must tell Subversion to use an external diff command./usr/bin/diff.To create a Perforce patch that shows all code (not just the changes and surrounding code), use this command:
p4 diff -dU10000 > patch.txt
The '10000' number refers to the number of code lines included in the patch, before and after each change. 'Patch.txt' represents your desired name for the new patch file.