summaryrefslogtreecommitdiffstats
path: root/llvm/utils/mkpatch
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-11-18 18:02:30 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-11-18 18:02:30 +0000
commit2ca613bcad2bb9cf99b25161d61bf2bef7195d07 (patch)
tree6ee07555bde9991a49ddc96a19fd4db9ec929ffe /llvm/utils/mkpatch
parent170ff027647a78ab82032733f3076804bf81a348 (diff)
downloadbcm5719-llvm-2ca613bcad2bb9cf99b25161d61bf2bef7195d07.tar.gz
bcm5719-llvm-2ca613bcad2bb9cf99b25161d61bf2bef7195d07.zip
This is a utility for preparing patches against LLVM. It runs cvs diff with
the correct options, places the patch content in order that makes sense for review, and filters cruft out of the patch (like diffs in *.cvs files). It produces both a NAME.patch.raw (unfiltered) and NAME.patch (filtered) file. llvm-svn: 31850
Diffstat (limited to 'llvm/utils/mkpatch')
-rwxr-xr-xllvm/utils/mkpatch36
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/utils/mkpatch b/llvm/utils/mkpatch
new file mode 100755
index 00000000000..3daa604db3b
--- /dev/null
+++ b/llvm/utils/mkpatch
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# This script makes a patch for LLVM ensuring the correct diff options and
+# putting the files in a standard review order.
+
+
+function error {
+ retcode="$?"
+ echo "mkpatch: error: $1 ($retcode)"
+ exit 1
+}
+
+if [ ! -e llvm.spec.in ] ; then
+ error "Please change directory to the LLVM top source directory"
+fi
+if [ "$#" -ne 1 ] ; then
+ error "usage: utils/mkpatch [PATCH_NAME]"
+fi
+NAME="$1"
+echo "mkpatch: Generating differences on top level files"
+cvs diff -l -Ntdup -5 . > "$NAME".patch.raw 2>&1
+echo "mkpatch: Generating differences on all directories"
+cvs diff -Ntdup -5 >> "$NAME".patch.raw 2>&1 \
+ autoconf docs utils include lib/System lib/Support lib/VMCore lib/AsmParser \
+ lib/Bytecode lib/Analysis lib/Transforms lib/CodeGen lib/Target \
+ lib/ExecutionEngine lib/Debugger lib/Linker \
+ tools test runtime projects examples win32 Xcode
+
+echo "mkpatch: Removing cruft from the patch file"
+sed "$NAME".patch.raw -e '/^[?] .*/d' -e '/^cvs diff: Diffing/d' | awk '\
+BEGIN { deleting = 0; } \
+/^Index: .*[.]cvs$/ { deleting = 1; } \
+/^Index:.*/ && !/^Index: .*[.]cvs$/ { deleting = 0; } \
+{ if (! deleting) { print; } } \
+' > "$NAME".patch || error "sed/awk cleanup failed"
+
OpenPOWER on IntegriCloud