hgbook

diff fr/examples/bisect @ 992:8b0f1e2984d0

French translation : sync with original ch04-concepts
author Frédéric Bouquet <youshe.jaalon@gmail.com>
date Fri Sep 11 14:30:20 2009 +0200 (2009-09-11)
parents 7226e5e750a6 547d3aa25ef0
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/fr/examples/bisect	Fri Sep 11 14:30:20 2009 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +if  hg -v | head -1 | grep -e "version 0.*"
     1.7 +then
     1.8 +#On mercurial 1.0 and later bisect is a builtin
     1.9 +echo '[extensions]' >> $HGRC
    1.10 +echo 'hbisect =' >> $HGRC
    1.11 +fi
    1.12 +
    1.13 +# XXX There's some kind of horrible nondeterminism in the execution of
    1.14 +# bisect at the moment.  Ugh.
    1.15 +
    1.16 +#$ ignore: .*
    1.17 +
    1.18 +#$ name: init
    1.19 +
    1.20 +hg init mybug
    1.21 +cd mybug
    1.22 +
    1.23 +#$ name: commits
    1.24 +
    1.25 +buggy_change=22
    1.26 +
    1.27 +for (( i = 0; i < 35; i++ )); do
    1.28 +  if [[ $i = $buggy_change ]]; then
    1.29 +    echo 'i have a gub' > myfile$i
    1.30 +    hg commit -q -A -m 'buggy changeset'
    1.31 +  else
    1.32 +    echo 'nothing to see here, move along' > myfile$i
    1.33 +    hg commit -q -A -m 'normal changeset'
    1.34 +  fi
    1.35 +done
    1.36 +
    1.37 +#$ name: help
    1.38 +
    1.39 +hg help bisect
    1.40 +
    1.41 +#$ name: search.init
    1.42 +
    1.43 +hg bisect --reset
    1.44 +
    1.45 +#$ name: search.bad-init
    1.46 +
    1.47 +hg bisect --bad
    1.48 +
    1.49 +#$ name: search.good-init
    1.50 +
    1.51 +hg bisect --good 10
    1.52 +
    1.53 +#$ name: search.step1
    1.54 +
    1.55 +if grep -q 'i have a gub' *
    1.56 +then
    1.57 +  result=bad
    1.58 +else
    1.59 +  result=good
    1.60 +fi
    1.61 +
    1.62 +echo this revision is $result
    1.63 +hg bisect --$result
    1.64 +
    1.65 +#$ name: search.mytest
    1.66 +
    1.67 +mytest() {
    1.68 +  if grep -q 'i have a gub' *
    1.69 +  then
    1.70 +    result=bad
    1.71 +  else
    1.72 +    result=good
    1.73 +  fi
    1.74 +
    1.75 +  echo this revision is $result
    1.76 +  hg bisect --$result
    1.77 +}
    1.78 +  
    1.79 +#$ name: search.step2
    1.80 +
    1.81 +mytest
    1.82 +
    1.83 +#$ name: search.rest
    1.84 +
    1.85 +mytest
    1.86 +mytest
    1.87 +mytest
    1.88 +
    1.89 +#$ name: search.reset
    1.90 +
    1.91 +hg bisect --reset
    1.92 +
    1.93 +#$ name:
    1.94 +
    1.95 +exit 0