You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by Apache Wiki <wi...@apache.org> on 2008/03/28 07:19:20 UTC

[Hadoop Wiki] Update of "HowToContribute" by NigelDaley

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by NigelDaley:
http://wiki.apache.org/hadoop/HowToContribute

The comment on the change is:
Added doc on running the test-patch ant target before submitting a patch

------------------------------------------------------------------------------
   * comment code whose function or rationale is not obvious;
   * update documentation (e.g., ''package.html'' files, this wiki, etc.)
  
+ ==== Testing your patch ====
+ 
+ Before submitting your patch, you are encouraged to run the same tools that the automated Hudson patch test system will run on your patch.  This enables you to fix problems with your patch before you submit it.  The {{{test-patch}}} Ant target will run your patch through the same checks that Hudson currently does ''except'' for executing the core and contrib unit tests.
+ 
+ To use this target, you must run it from a clean workspace (ie {{{svn stat}}} shows no modifications or additions).  From your clean workspace, run:
+ 
+ {{{
+ ant \
+   -Dpatch.file=/patch/to/my.patch \
+   -Dforrest.home=/path/to/forrest/ \
+   -Dfindbugs.home=/path/to/findbugs \
+   -Dscratch.dir=/path/to/a/temp/dir \ (optional)
+   -Dsvn.cmd=/path/to/subversion/bin/svn \ (optional)
+   -Dgrep.cmd=/path/to/grep \ (optional)
+   -Dpatch.cmd=/path/to/patch \ (optional)
+   test-patch
+ }}}
+ 
+ At the end, you should get a message on your console that is similar to the comment added to Jira by Hudson's automated patch test system.  The scratch directory (which defaults to the value of {{{${user.home}/tmp}}}) will contain some output files that will be useful in determining what issues were found in the patch.
+ 
+ Some things to note:
+  * the optional cmd parameters will default to the ones in your {{{PATH}}} environment variable
+  * the {{{grep}}} command must support the -o flag (GNU does)
+  * the {{{patch}}} command must support the -E flag
+ 
  ==== Applying a patch ====
  
  To apply a patch either you generated or found from JIRA, you can issue 
  {{{
- patch -p0 <cool_patch.patch
+ patch -p0 < cool_patch.patch
  }}}
  if you just want to check whether the patch applies you can run patch with --dry-run option
  {{{
- patch -p0 --dry-run <cool_patch.patch
+ patch -p0 --dry-run < cool_patch.patch
  }}}
  
  If you are an Eclipse user, you can apply a patch by : 1. Right click project name in Package Explorer , 2. Team -> Apply Patch