aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/mtn-bisect.sh
blob: e1c970d9747d496ee84de5b1d88cd1f3e07f5299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

# the revision that we noticed does not longer build
LATEST_BAD_REV=$1

# an older revision that is known to build
LAST_KNOWN_GOOD_REV=$2

# count the number of commits 
COUNT=`mtn log --brief --no-merges --no-graph --to p:$LAST_KNOWN_GOOD_REV --from $LATEST_BAD_REV | tee /tmp/candidates.txt | wc -l`

echo $COUNT commits

# if COUNT == 1 stop

# make binary sections
COUNT=$(($(($COUNT + 1)) / 2))

CANDIDATE_REV=`cat /tmp/candidates.txt | head -n $COUNT | tail -n 1 | sed -e 's@\([a-f0-9]*\) .*@\1@'`

echo $CANDIDATE_REV

echo mtn up -r $CANDIDATE_REV
mtn up -r $CANDIDATE_REV