Pular para o conteúdo principal

ramificacao-hg-named-branches.sh (Código)

#!/bin/bash

# Caso 1: Ramos nomeados do Mercurial
#
#    (1)----(2)          > stable
#   /         \
# (0)---(3)---(4)---(7)  > default/master
#   \     \         /
#    \     (5)---(6)     > bug
#     \            \
#      (8)---------(9)   > feature
         

#
# Mercurial Usando Named Branches
#

cd /tmp
if [ -d hg-named-branches ]; then
    rm -rf hg-named-branches
fi

hg init hg-named-branches
cd hg-named-branches
echo 'zero' > default.txt
hg commit -Am zero

hg branch stable
echo 'um' > stable.txt
hg add
hg commit -m um

echo 'dois' >> stable.txt
hg commit -m dois

hg update default
echo 'três' >> default.txt
hg commit -m tres

hg merge stable
hg commit -m quatro

hg update 3
hg branch bug
echo 'cinco' > bug.txt
hg add
hg commit -m cinco

echo 'seis' >> bug.txt
hg commit -m seis

hg update default
hg merge bug
hg commit -m sete

hg up 0
hg branch feature
echo 'oito' > feature.txt
hg add
hg commit -m oito

hg merge bug
hg commit -m nove

echo -e '\n\n========\ndefault\n========'
hg log -Gqb default
echo -e '\n\n=======\nfeature\n======='
hg log -Gqb feature
echo -e '\n\n===\nbug\n==='
hg log -Gqb bug
echo -e '\n\n======\nstable\n======'
hg log -Gqb stable