Crucible 2.3 : Creating a Patch Review
This page last changed on Apr 09, 2010 by edawson.
This page includes instructions on uploading patch files from your repository, how to load them into Crucible to be reviewed and use Crucible's Patch Anchoring to retrieve more lines of context from the original file. 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.
Using Crucible Patch Anchoring to Automatically Add Full ContextCrucible's Patch Anchoring feature allows you to add a regular patch to a review (showing only a few lines of context. Then, Crucible will automatically search for the relevant file content in the connected repositories. When it finds the files, it will seamlessly add in more context from the file so that you can view all of the lines of code (greatly enhancing the review process). To use patch anchoring:
Creating a Patch File From Your IDECreating a Patch File in IntelliJ IDEA 7.0To 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 Do Not Have the Create Patch Command Available Under IDEAIf 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'. Creating a Patch File in Eclipse 3.3.1.1To 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 Creating a Basic Patch File From The Repository Command LineCVS Patch Creation On The Command LineTo 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. Subversion Patch Creation Via The Command LineTo create a patch in Subversion, use the svn diff command from your workspace. For example: svn diff > patch.txt
Note that patch files created with this command will only include around three lines of code, before and after each change. Perforce Patch Creation Via The Command LineTo 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. Creating Patches That Include All Lines of CodeTo 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. Creating a Patch in CVS With All Lines of codeTo 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
Creating a Patch in Subversion With All Lines of CodeTo 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
Creating a Patch in Perforce With All Lines of Code
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
Document generated by Confluence on Jul 29, 2010 20:00 |