llvm.org GIT mirror llvm / 35d958c
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31850 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 14 years ago
1 changed file(s) with 36 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 #!/bin/bash
1 #
2 # This script makes a patch for LLVM ensuring the correct diff options and
3 # putting the files in a standard review order.
4
5
6 function error {
7 retcode="$?"
8 echo "mkpatch: error: $1 ($retcode)"
9 exit 1
10 }
11
12 if [ ! -e llvm.spec.in ] ; then
13 error "Please change directory to the LLVM top source directory"
14 fi
15 if [ "$#" -ne 1 ] ; then
16 error "usage: utils/mkpatch [PATCH_NAME]"
17 fi
18 NAME="$1"
19 echo "mkpatch: Generating differences on top level files"
20 cvs diff -l -Ntdup -5 . > "$NAME".patch.raw 2>&1
21 echo "mkpatch: Generating differences on all directories"
22 cvs diff -Ntdup -5 >> "$NAME".patch.raw 2>&1 \
23 autoconf docs utils include lib/System lib/Support lib/VMCore lib/AsmParser \
24 lib/Bytecode lib/Analysis lib/Transforms lib/CodeGen lib/Target \
25 lib/ExecutionEngine lib/Debugger lib/Linker \
26 tools test runtime projects examples win32 Xcode
27
28 echo "mkpatch: Removing cruft from the patch file"
29 sed "$NAME".patch.raw -e '/^[?] .*/d' -e '/^cvs diff: Diffing/d' | awk '\
30 BEGIN { deleting = 0; } \
31 /^Index: .*[.]cvs$/ { deleting = 1; } \
32 /^Index:.*/ && !/^Index: .*[.]cvs$/ { deleting = 0; } \
33 { if (! deleting) { print; } } \
34 ' > "$NAME".patch || error "sed/awk cleanup failed"
35