hgbook

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/en/examples/branching	Fri Mar 30 23:05:28 2007 -0700
     1.3 @@ -0,0 +1,62 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +#$ name: init
     1.7 +
     1.8 +hg init main
     1.9 +cd main
    1.10 +echo 'This is a boring feature.' > myfile
    1.11 +hg commit -A -m 'We have reached an important milestone!'
    1.12 +
    1.13 +#$ name: tag
    1.14 +
    1.15 +hg tag v1.0
    1.16 +hg tip
    1.17 +hg tags
    1.18 +
    1.19 +#$ name: main
    1.20 +
    1.21 +cd ../main
    1.22 +echo 'This is exciting and new!' >> myfile
    1.23 +hg commit -m 'Add a new feature'
    1.24 +cat myfile
    1.25 +
    1.26 +#$ name: update
    1.27 +
    1.28 +cd ..
    1.29 +hg clone -U main main-old
    1.30 +cd main-old
    1.31 +hg update v1.0
    1.32 +cat myfile
    1.33 +
    1.34 +#$ name: clone
    1.35 +
    1.36 +cd ..
    1.37 +hg clone -rv1.0 main stable
    1.38 +
    1.39 +#$ name: stable
    1.40 +
    1.41 +hg clone stable stable-fix
    1.42 +cd stable-fix
    1.43 +echo 'This is a fix to a boring feature.' > myfile
    1.44 +hg commit -m 'Fix a bug'
    1.45 +hg push
    1.46 +
    1.47 +#$ name:
    1.48 +
    1.49 +export HGMERGE=$(mktemp)
    1.50 +echo '#!/bin/sh' > $HGMERGE
    1.51 +echo 'echo "This is a fix to a boring feature." > "$1"' >> $HGMERGE
    1.52 +echo 'echo "This is exciting and new!" >> "$1"' >> $HGMERGE
    1.53 +chmod 700 $HGMERGE
    1.54 +
    1.55 +#$ name: merge
    1.56 +
    1.57 +cd ../main
    1.58 +hg pull ../stable
    1.59 +hg merge
    1.60 +hg commit -m 'Bring in bugfix from stable branch'
    1.61 +cat myfile
    1.62 +
    1.63 +#$ name:
    1.64 +
    1.65 +rm $HGMERGE