test-subrepo
244 lines
| 5.0 KiB
| text/plain
|
TextLexer
/ tests / test-subrepo
Matt Mackall
|
r8816 | #!/bin/sh | ||
rm -rf sub | ||||
mkdir sub | ||||
cd sub | ||||
hg init t | ||||
cd t | ||||
echo % first revision, no sub | ||||
echo a > a | ||||
hg ci -Am0 | ||||
echo % add first sub | ||||
echo s = s > .hgsub | ||||
hg add .hgsub | ||||
hg init s | ||||
echo a > s/a | ||||
Matt Mackall
|
r11485 | |||
# issue2232 - committing a subrepo without .hgsub | ||||
hg ci -mbad s | ||||
Matt Mackall
|
r8816 | hg -R s ci -Ams0 | ||
Matt Mackall
|
r11088 | hg sum | ||
Matt Mackall
|
r8816 | hg ci -m1 | ||
Matt Mackall
|
r11470 | # issue 2022 - update -C | ||
echo b > s/a | ||||
hg sum | ||||
hg co -C 1 | ||||
hg sum | ||||
Matt Mackall
|
r8816 | echo % add sub sub | ||
echo ss = ss > s/.hgsub | ||||
hg init s/ss | ||||
echo a > s/ss/a | ||||
hg -R s add s/.hgsub | ||||
hg -R s/ss add s/ss/a | ||||
Matt Mackall
|
r11088 | hg sum | ||
Matt Mackall
|
r8816 | hg ci -m2 | ||
Matt Mackall
|
r11088 | hg sum | ||
Matt Mackall
|
r8816 | |||
echo % bump sub rev | ||||
echo b > s/a | ||||
hg -R s ci -ms1 | ||||
hg ci -m3 | ||||
echo % leave sub dirty | ||||
echo c > s/a | ||||
hg ci -m4 | ||||
hg tip -R s | ||||
echo % check caching | ||||
hg co 0 | ||||
hg debugsub | ||||
echo % restore | ||||
hg co | ||||
hg debugsub | ||||
echo % new branch for merge tests | ||||
hg co 1 | ||||
echo t = t >> .hgsub | ||||
hg init t | ||||
echo t > t/t | ||||
hg -R t add t | ||||
echo % 5 | ||||
hg ci -m5 # add sub | ||||
echo t2 > t/t | ||||
echo % 6 | ||||
hg st -R s | ||||
hg ci -m6 # change sub | ||||
hg debugsub | ||||
echo t3 > t/t | ||||
echo % 7 | ||||
hg ci -m7 # change sub again for conflict test | ||||
hg rm .hgsub | ||||
echo % 8 | ||||
hg ci -m8 # remove sub | ||||
echo % merge tests | ||||
hg co -C 3 | ||||
hg merge 5 # test adding | ||||
hg debugsub | ||||
hg ci -m9 | ||||
hg merge 6 --debug # test change | ||||
hg debugsub | ||||
echo conflict > t/t | ||||
hg ci -m10 | ||||
HGMERGE=internal:merge hg merge --debug 7 # test conflict | ||||
echo % should conflict | ||||
cat t/t | ||||
echo % clone | ||||
cd .. | ||||
Edouard Gomez
|
r10668 | hg clone t tc | sed 's|from .*/sub|from .../sub|g' | ||
Matt Mackall
|
r8816 | cd tc | ||
hg debugsub | ||||
echo % push | ||||
echo bah > t/t | ||||
hg ci -m11 | ||||
hg push | sed 's/ .*sub/ ...sub/g' | ||||
echo % push -f | ||||
echo bah > s/a | ||||
hg ci -m12 | ||||
hg push | sed 's/ .*sub/ ...sub/g' | ||||
hg push -f | sed 's/ .*sub/ ...sub/g' | ||||
echo % update | ||||
cd ../t | ||||
hg up -C # discard our earlier merge | ||||
echo blah > t/t | ||||
hg ci -m13 | ||||
echo % pull | ||||
cd ../tc | ||||
hg pull | sed 's/ .*sub/ ...sub/g' | ||||
Edouard Gomez
|
r10668 | # should pull t | ||
hg up | sed 's|from .*/sub|from .../sub|g' | ||||
Matt Mackall
|
r8816 | cat t/t | ||
Benoit Boissinot
|
r10251 | |||
Augie Fackler
|
r10177 | echo % bogus subrepo path aborts | ||
echo 'bogus=[boguspath' >> .hgsub | ||||
hg ci -m 'bogus subrepo path' | ||||
Benoit Boissinot
|
r10251 | echo % issue 1986 | ||
cd .. | ||||
rm -rf sub | ||||
hg init main | ||||
cd main | ||||
hg init s # subrepo layout | ||||
cd s # | ||||
echo a > a # o 5 br | ||||
hg ci -Am1 # /| | ||||
hg branch br # o | 4 default | ||||
echo a >> a # | | | ||||
hg ci -m1 # | o 3 br | ||||
hg up default # |/| | ||||
echo b > b # o | 2 default | ||||
hg ci -Am1 # | | | ||||
hg up br # | o 1 br | ||||
hg merge tip # |/ | ||||
hg ci -m1 # o 0 default | ||||
hg up 2 | ||||
echo c > c | ||||
hg ci -Am1 | ||||
hg up 3 | ||||
hg merge 4 | ||||
hg ci -m1 | ||||
cd .. # main repo layout: | ||||
echo 's = s' > .hgsub # | ||||
hg -R s up 2 # * <-- try to merge default into br again | ||||
hg ci -Am1 # .`| | ||||
hg branch br # . o 5 br --> substate = 5 | ||||
echo b > b # . | | ||||
hg -R s up 3 # o | 4 default --> substate = 4 | ||||
hg ci -Am1 # | | | ||||
hg up default # | o 3 br --> substate = 2 | ||||
echo c > c # |/| | ||||
hg ci -Am1 # o | 2 default --> substate = 2 | ||||
hg up 1 # | | | ||||
hg merge 2 # | o 1 br --> substate = 3 | ||||
hg ci -m1 # |/ | ||||
hg up 2 # o 0 default --> substate = 2 | ||||
hg -R s up 4 | ||||
echo d > d | ||||
hg ci -Am1 | ||||
hg up 3 | ||||
hg -R s up 5 | ||||
echo e > e | ||||
hg ci -Am1 | ||||
hg up 5 | ||||
hg merge 4 # try to merge default into br again | ||||
Saint Germain
|
r10378 | cd .. | ||
Saint Germain
|
r10522 | echo % test subrepo delete from .hgsubstate | ||
hg init testdelete | ||||
mkdir testdelete/nested testdelete/nested2 | ||||
hg init testdelete/nested | ||||
hg init testdelete/nested2 | ||||
echo test > testdelete/nested/foo | ||||
echo test > testdelete/nested2/foo | ||||
hg -R testdelete/nested add | ||||
hg -R testdelete/nested2 add | ||||
hg -R testdelete/nested ci -m test | ||||
hg -R testdelete/nested2 ci -m test | ||||
echo nested = nested > testdelete/.hgsub | ||||
echo nested2 = nested2 >> testdelete/.hgsub | ||||
hg -R testdelete add | ||||
hg -R testdelete ci -m "nested 1 & 2 added" | ||||
echo nested = nested > testdelete/.hgsub | ||||
hg -R testdelete ci -m "nested 2 deleted" | ||||
cat testdelete/.hgsubstate | sed "s:.* ::" | ||||
hg -R testdelete remove testdelete/.hgsub | ||||
hg -R testdelete ci -m ".hgsub deleted" | ||||
cat testdelete/.hgsubstate | ||||
Saint Germain
|
r10378 | echo % test repository cloning | ||
mkdir mercurial mercurial2 | ||||
hg init nested_absolute | ||||
echo test > nested_absolute/foo | ||||
hg -R nested_absolute add | ||||
hg -R nested_absolute ci -mtest | ||||
cd mercurial | ||||
hg init nested_relative | ||||
echo test2 > nested_relative/foo2 | ||||
hg -R nested_relative add | ||||
hg -R nested_relative ci -mtest2 | ||||
hg init main | ||||
Mads Kiilerich
|
r10775 | echo "nested_relative = ../nested_relative" > main/.hgsub | ||
echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub | ||||
Saint Germain
|
r10378 | hg -R main add | ||
hg -R main ci -m "add subrepos" | ||||
cd .. | ||||
hg clone mercurial/main mercurial2/main | ||||
Patrick Mezard
|
r10468 | cat mercurial2/main/nested_absolute/.hg/hgrc \ | ||
mercurial2/main/nested_relative/.hg/hgrc \ | ||||
| "$TESTDIR/filtertmp.py" | ||||
Saint Germain
|
r10378 | rm -rf mercurial mercurial2 | ||
Benoit Boissinot
|
r10251 | |||
Wagner Bruna
|
r11069 | echo % issue 1977 | ||
hg init repo | ||||
hg init repo/s | ||||
echo a > repo/s/a | ||||
hg -R repo/s ci -Am0 | ||||
echo s = s > repo/.hgsub | ||||
hg -R repo ci -Am1 | ||||
Thomas Arendsen Hein
|
r11086 | hg clone repo repo2 | sed 's|from .*/sub|from .../sub|g' | ||
Wagner Bruna
|
r11069 | hg -q -R repo2 pull -u | ||
echo 1 > repo2/s/a | ||||
hg -R repo2/s ci -m2 | ||||
hg -q -R repo2/s push | ||||
hg -R repo2/s up -C 0 | ||||
echo 2 > repo2/s/a | ||||
hg -R repo2/s ci -m3 | ||||
hg -R repo2 ci -m3 | ||||
hg -q -R repo2 push | ||||
hg -R repo update | ||||
rm -rf repo2 repo | ||||
Benoit Boissinot
|
r10251 | exit 0 | ||