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.
http://wiki.apache.org/hadoop/GitAndHadoop?action=diff&rev1=5&rev2=6

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

   1. Go to http://github.com/apache and search for the Hadoop and other apache 
projects you want (avro is handy alongside the others)
   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. 
  
  == Building the source ==
  
@@ -100, +102 @@

   1. Avoid using {{{latest.version}}} as the version marker in Ivy, as that 
gives you the last built.
   1. Don't build/test different branches simultaneously, such as by running 
Hudson on your local machine while developing on the console. The trick here is 
bring up Hudson in a virtual machine, running against the Git repository on 
your desktop. Git lets you do this, which lets you run Hudson against your 
private branch.
  
+ === Creating the branch ===
+ 
+ Creating a branch is quick and easy
+ {{{
+ #start off in your trunk
+ git checkout trunk
+ #create a new branch from trunk 
+ git branch HDFS-775
+ #switch to it
+ git checkout HDFS-775
+ #show what's branch you are in
+ git branch
+ }}}
+ 
+ Remember, this branch is local to your machine. Nobody else can see it until 
you push up your changes or generate a patch.
+ 
+ 
+ 
+ == Creating Patches ==
+ 
+ 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:
+ {{{
+ mkdir ../outgoing
+ }}}
+ Then generate a patch file listing the differences between your trunk and 
your branch
+ {{{
+ git diff 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
+ {{{
+ 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
+ @@ -355,12 +355,14 @@ public class FSDataset implements FSConstants, 
FSDatasetInterface {
+        return dfsUsage.getUsed();
+      }
+      
+ +    /**
+ +     * Calculate the capacity of the filesystem, after removing any
+ +     * reserved capacity.
+ +     * @return the unreserved number of bytes left in this filesystem. May 
be zero.
+ +     */
+      long getCapacity() throws IOException {
+ -      if (reserved > usage.getCapacity()) {
+ -        return 0;
+ -      }
+ -
+ -      return usage.getCapacity()-reserved;
+ +      long remaining = usage.getCapacity() - reserved;
+ +      return remaining > 0 ? remaining : 0;
+      }
+        
+      long getAvailable() throws IOException {
+ }}}
+ 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.
+ 
+ 

Reply via email to