hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Update of "GitAndHadoop" by SteveLoughran
Date Wed, 09 Dec 2009 14:21:42 GMT
Dear Wiki user,

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

The "GitAndHadoop" page has been changed by SteveLoughran.
The comment on this change is: generating valid patches.
http://wiki.apache.org/hadoop/GitAndHadoop?action=diff&rev1=6&rev2=7

--------------------------------------------------

   1. For each project, fork. This gives you your own repository URL which you can then clone
locally with {{{git clone}}}
   1. For each patch, branch.
  
- At the time of writing (December 2009), github was updating its copy of the Apache repositories
every hour. 
+ At the time of writing (December 2009), github was updating its copy of the Apache repositories
every hour.
  
  == Building the source ==
  
@@ -108, +108 @@

  {{{
  #start off in your trunk
  git checkout trunk
- #create a new branch from trunk 
+ #create a new branch from trunk
  git branch HDFS-775
  #switch to it
  git checkout HDFS-775
@@ -120, +120 @@

  
  
  
- == Creating Patches ==
+ == Creating Patches for attachment to JIRA ==
  
  Assuming your trunk repository is in sync with the apache projects, you can use {{{git diff}}}
to create a patch file.
  First, have a directory for your patches:
@@ -129, +129 @@

  }}}
  Then generate a patch file listing the differences between your trunk and your branch
  {{{
- git diff trunk > ../outgoing/HDFS-775-1.patch
+ git diff --no-prefix trunk > ../outgoing/HDFS-775-1.patch
  }}}
  The patch file is an extended version of the unified patch format used by other tools; type
{{{git help diff}}} to get more details on it. Here is what the patch file in this example
looks like
  {{{
+ cat ../outgoing/HDFS-775-1.patch
- diff --git a/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java b/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
+ diff --git src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
  index 42ba15e..6383239 100644
- --- a/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
+ --- src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
- +++ b/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
+ +++ src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
  @@ -355,12 +355,14 @@ public class FSDataset implements FSConstants, FSDatasetInterface
{
         return dfsUsage.getUsed();
       }
-      
+ 
  +    /**
  +     * Calculate the capacity of the filesystem, after removing any
  +     * reserved capacity.
@@ -155, +156 @@

  +      long remaining = usage.getCapacity() - reserved;
  +      return remaining > 0 ? remaining : 0;
       }
-        
+ 
       long getAvailable() throws IOException {
+ 
  }}}
+ It is essential that patches for JIRA issues are generated with the {{{--no-prefix}}} option.
Without that an extra directory path is listed, and the patches can only be applied with a
{{{patch -p1}}} call, ''which Hudson does not know to do''. If you want your patches to take,
this is what you have to do. You can of course test this yourself by using a command like
{{{patch -p0 << ../outgoing/HDFS-775.1}}} in a copy of the SVN source tree to test that
your patch takes.
- This patch has a git file path in it, with an a/ and a b/ at the front, which will not work
directly against the svn repository. Try it:
- {{{
- trunk/hadoop-hdfs$ patch -p0 < ../../github/outgoing/HDFS-775-1.patch 
- can't find file to patch at input line 5
- Perhaps you used the wrong -p or --strip option?
- The text leading up to this was:
- --------------------------
- |diff --git a/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java b/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
- |index 42ba15e..6383239 100644
- |--- a/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
- |+++ b/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
- --------------------------
- }}}
- See that? Not working. You can get it to take by saying "strip one path entry": {{{
- patch -p1 < ../../github/outgoing/HDFS-775-1.patch 
- }}}
- Sadly, that doesn't work for JIRA issues, as Hudson doesn't know to do this. You need to
edit the patch file and strip the a/ and b/ from the +++ and --- lines.
  
- 

Mime
View raw message