Alphabetize the list of function parameters.
[llvm.git] / utils / mkpatch
blob2741563f041cef0dd80fd7b67ad4daf716bbeb8a
1 #!/bin/bash
3 # This script makes a patch for LLVM ensuring the correct diff options and
4 # putting the files in a standard review order.
7 function error {
8 retcode="$?"
9 echo "mkpatch: error: $1 ($retcode)"
10 exit 1
13 if [ ! -e llvm.spec.in ] ; then
14 error "Please change directory to the LLVM top source directory"
16 if [ "$#" -ne 1 ] ; then
17 error "usage: utils/mkpatch [PATCH_NAME]"
19 NAME="$1"
20 echo "mkpatch: Generating differences on top level files"
21 svn diff -N -x -u > "$NAME".patch.raw 2>&1
22 echo "mkpatch: Generating differences on all directories"
23 svn diff -x -u >> "$NAME".patch.raw 2>&1 \
24 autoconf docs utils include lib/System lib/Support lib/VMCore lib/AsmParser \
25 lib/Bitcode lib/Analysis lib/Transforms lib/CodeGen lib/Target \
26 lib/ExecutionEngine lib/Linker lib/MC \
27 tools test unittests runtime projects examples Xcode
29 echo "mkpatch: Removing cruft from the patch file"
30 sed -e '/^[?] .*/d' -e '/^cvs diff: Diffing/d' "$NAME".patch.raw | awk '\
31 BEGIN { deleting = 0; } \
32 /^Index: .*[.]cvs$/ { deleting = 1; fname=substr($0,7); \
33 print "Skipping: ", fname > "/dev/stderr"; } \
34 /^Index:.*/ && !/^Index: .*[.]cvs$/ { deleting = 0; } \
35 { if (! deleting) { print; } } ' > "$NAME".patch || \
36 error "sed/awk cleanup failed"