hgbook

annotate en/examples/branching @ 179:5fc4a45c069f

Continue documentation of collaboration models.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri Mar 30 23:05:28 2007 -0700 (2007-03-30)
parents
children f078515438d2
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@179 42 hg push
bos@179 43
bos@179 44 #$ name:
bos@179 45
bos@179 46 export HGMERGE=$(mktemp)
bos@179 47 echo '#!/bin/sh' > $HGMERGE
bos@179 48 echo 'echo "This is a fix to a boring feature." > "$1"' >> $HGMERGE
bos@179 49 echo 'echo "This is exciting and new!" >> "$1"' >> $HGMERGE
bos@179 50 chmod 700 $HGMERGE
bos@179 51
bos@179 52 #$ name: merge
bos@179 53
bos@179 54 cd ../main
bos@179 55 hg pull ../stable
bos@179 56 hg merge
bos@179 57 hg commit -m 'Bring in bugfix from stable branch'
bos@179 58 cat myfile
bos@179 59
bos@179 60 #$ name:
bos@179 61
bos@179 62 rm $HGMERGE