Minor patch updates don't require an IDE, nor |
When commiting code to an apache project you want to follow guidelines like:
- All code is under 80 columns
- No trailing white spaces
- ...
You can use git status to grab all the recent changed files.. And then use your terminal to run arbitrary analysis of your changed source files.
You can use git to find all the files you changed:
git status --porcelain | grep java | cut -d' ' -f 3
This will list all your java files that changed, but not commited yet.
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestPath.java
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestStat.java
Then you can pipe this into egrep:
xargs egrep ".* +$"
Which will then list all offending files.
The final recipe looks something like this:
for f in `git status --porcelain | grep java | cut -d' ' -f 3 `
do
echo "Processing $f.."
cat $f | awk ' { if ( length > 80 ) { x = length } }END{ print x } '
cat $f |xargs egrep ".* +$"
echo "..Done processing $f"
done
Now, here's an important trick for editing a patch after you find out its broken.
- Put your code back to a state where it was BEFORE you wrote the patch. For example, you might do :
git checkout -- . (if you hadnt commited the code in your patch)
git reset HEAD~1 (if you're whole patch is in the latest commit)
- apply the original patch
git checkout -- .
patch -p0 < ./HADOOP-3679.4.patch
- use git add -p , and hit "y" for all the diffs to keep, "e" or "n" to edit or nix them
git add -p
git diff ---cached --no-prefix > HADOOP-3679.patch
No comments:
Post a Comment