hgbook

annotate en/examples/branching @ 609:c44d5854620b

Fix up chapter 1.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue Mar 31 22:38:30 2009 -0700 (2009-03-31)
parents 5fc4a45c069f
children
rev   line source
bos@179 1 #!/bin/bash
bos@179 2
bos@179 3 #$ name: init
bos@179 4
bos@179 5 hg init main
bos@179 6 cd main
bos@179 7 echo 'This is a boring feature.' > myfile
bos@179 8 hg commit -A -m 'We have reached an important milestone!'
bos@179 9
bos@179 10 #$ name: tag
bos@179 11
bos@179 12 hg tag v1.0
bos@179 13 hg tip
bos@179 14 hg tags
bos@179 15
bos@179 16 #$ name: main
bos@179 17
bos@179 18 cd ../main
bos@179 19 echo 'This is exciting and new!' >> myfile
bos@179 20 hg commit -m 'Add a new feature'
bos@179 21 cat myfile
bos@179 22
bos@179 23 #$ name: update
bos@179 24
bos@179 25 cd ..
bos@179 26 hg clone -U main main-old
bos@179 27 cd main-old
bos@179 28 hg update v1.0
bos@179 29 cat myfile
bos@179 30
bos@179 31 #$ name: clone
bos@179 32
bos@179 33 cd ..
bos@179 34 hg clone -rv1.0 main stable
bos@179 35
bos@179 36 #$ name: stable
bos@179 37
bos@179 38 hg clone stable stable-fix
bos@179 39 cd stable-fix
bos@179 40 echo 'This is a fix to a boring feature.' > myfile
bos@179 41 hg commit -m 'Fix a bug'
bos@191 42 #$ ignore: /tmp/branching.*
bos@179 43 hg push
bos@179 44
bos@179 45 #$ name:
bos@179 46
bos@179 47 export HGMERGE=$(mktemp)
bos@179 48 echo '#!/bin/sh' > $HGMERGE
bos@179 49 echo 'echo "This is a fix to a boring feature." > "$1"' >> $HGMERGE
bos@179 50 echo 'echo "This is exciting and new!" >> "$1"' >> $HGMERGE
bos@179 51 chmod 700 $HGMERGE
bos@179 52
bos@179 53 #$ name: merge
bos@179 54
bos@179 55 cd ../main
bos@179 56 hg pull ../stable
bos@179 57 hg merge
bos@179 58 hg commit -m 'Bring in bugfix from stable branch'
bos@179 59 cat myfile
bos@179 60
bos@179 61 #$ name:
bos@179 62
bos@179 63 rm $HGMERGE