| 1 | #!/bin/sh -e |
| 2 | |
| 3 | first=$1 |
| 4 | second=$2 |
| 5 | |
| 6 | if [ -z "$first" ]; then |
| 7 | echo "Usage: compare <branch name A> [<branch name B>]" |
| 8 | echo "" |
| 9 | echo "The second argument defaults to the current branch if not specified" |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
| 13 | # Remember the branch we're on |
| 14 | currentbranch=`git symbolic-ref --short HEAD` |
| 15 | |
| 16 | if [ -z "$second" ]; then |
| 17 | second=$currentbranch |
| 18 | fi |
| 19 | |
| 20 | firstdir=comparison/first |
| 21 | seconddir=comparison/second |
| 22 | |
| 23 | # Make sure the output directory exists |
| 24 | mkdir -p comparison |
| 25 | |
| 26 | # Remove any previous builds |
| 27 | rm -fr $firstdir |
| 28 | rm -fr $seconddir |
| 29 | |
| 30 | export BREATHE_COMPARE=True |
| 31 | |
| 32 | # Checkout the first target |
| 33 | echo git checkout $first |
| 34 | git checkout $first |
| 35 | # Run doxygen for this state |
| 36 | (cd ../examples/specific; make) |
| 37 | (cd ../examples/tinyxml; make) |
| 38 | (cd ../examples/doxygen; make) |
| 39 | # Clean current sphinx build directory |
| 40 | make clean |
| 41 | # Make sure the BUILDDIR variable can be overridden in the Makefile. Required for older commits |
| 42 | sed -i 's/BUILDDIR = build/BUILDDIR ?= build/g' Makefile |
| 43 | # Build into our first comparison directory |
| 44 | make html BUILDDIR=$firstdir |
| 45 | # Reset the Makefile to its state for this commit |
| 46 | git checkout Makefile |
| 47 | |
| 48 | |
| 49 | # Checkout the second target and repeat |
| 50 | echo git checkout $second |
| 51 | git checkout $second |
| 52 | (cd ../examples/specific; make) |
| 53 | (cd ../examples/tinyxml; make) |
| 54 | (cd ../examples/doxygen; make) |
| 55 | make clean |
| 56 | sed -i 's/BUILDDIR = build/BUILDDIR ?= build/g' Makefile |
| 57 | make html BUILDDIR=$seconddir |
| 58 | git checkout Makefile |
| 59 | |
| 60 | # Return to our current branch |
| 61 | echo git checkout $currentbranch |
| 62 | git checkout $currentbranch |
| 63 | |
| 64 | # Launch meld to compare the two html directories |
| 65 | echo meld $firstdir/html $seconddir/html |
| 66 | meld $firstdir/html $seconddir/html |
| 67 |