tests/test-rebase-collapse
changeset 6906 808f03f61ebe
child 6910 93609576244e
equal deleted inserted replaced
6905:248e54a9456e 6906:808f03f61ebe
       
     1 #!/bin/sh
       
     2 
       
     3 echo "[extensions]" >> $HGRCPATH
       
     4 echo "graphlog=" >> $HGRCPATH
       
     5 echo "rebase=" >> $HGRCPATH
       
     6 
       
     7 BASE=`pwd`
       
     8 
       
     9 function addcommit {
       
    10     echo $1 > $1
       
    11     hg add $1
       
    12     hg commit -d "${2} 0" -u test -m $1
       
    13 }
       
    14 function commit {
       
    15     hg commit -d "${2} 0" -u test -m $1
       
    16 }
       
    17 
       
    18 function createrepo {
       
    19     cd $BASE
       
    20     rm -rf a
       
    21     hg init a
       
    22     cd a
       
    23     addcommit "A" 0
       
    24     addcommit "B" 1
       
    25     addcommit "C" 2
       
    26     addcommit "D" 3
       
    27 
       
    28     hg update -C 0
       
    29     addcommit "E" 4
       
    30 
       
    31     hg update -C 0
       
    32     addcommit "F" 5
       
    33 
       
    34     hg merge -r 4
       
    35     commit "G" 6
       
    36 
       
    37     hg update -C 5
       
    38     addcommit "H" 7
       
    39 }
       
    40 
       
    41 createrepo > /dev/null 2>&1
       
    42 hg glog  --template '{rev}: {desc}\n'
       
    43 echo '% Rebasing'
       
    44 hg up -C 3
       
    45 hg rebase --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
       
    46 hg glog  --template '{rev}: {desc}\n'
       
    47 
       
    48 createrepo > /dev/null 2>&1
       
    49 echo '% Rebasing'
       
    50 hg rebase --base 6 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
       
    51 hg glog  --template '{rev}: {desc}\n'
       
    52 
       
    53 function createrepocomplex {
       
    54     cd $BASE
       
    55     rm -rf a
       
    56     hg init a
       
    57     cd a
       
    58     addcommit "A" 0
       
    59     addcommit "B" 1
       
    60 
       
    61     hg up 0
       
    62     addcommit "C" 2
       
    63     hg merge
       
    64     commit "D" 3
       
    65 
       
    66     hg up 1
       
    67     addcommit "E" 4
       
    68 
       
    69     addcommit "F" 5
       
    70 
       
    71     hg merge
       
    72     commit "G" 6
       
    73 
       
    74     hg up 0
       
    75     addcommit "H" 7
       
    76 }
       
    77 
       
    78 createrepocomplex > /dev/null 2>&1
       
    79 hg glog  --template '{rev}: {desc}\n'
       
    80 
       
    81 echo
       
    82 echo '% Rebase and collapse - more than one external (fail)'
       
    83 hg rebase -s 2 --collapse
       
    84 
       
    85 echo
       
    86 echo '% Rebase and collapse'
       
    87 hg rebase -s 4 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
       
    88 hg glog  --template '{rev}: {desc}\n'
       
    89 
       
    90 exit 0