tests/test-bundle
changeset 11870 33eb803e9343
parent 11869 36a5e7cb6c8d
child 11871 f22b101e33e4
equal deleted inserted replaced
11869:36a5e7cb6c8d 11870:33eb803e9343
     1 #!/bin/sh
       
     2 
       
     3 cp "$TESTDIR"/printenv.py .
       
     4 
       
     5 echo "====== Setting up test"
       
     6 hg init test
       
     7 cd test
       
     8 echo 0 > afile
       
     9 hg add afile
       
    10 hg commit -m "0.0" -d "1000000 0"
       
    11 echo 1 >> afile
       
    12 hg commit -m "0.1" -d "1000000 0"
       
    13 echo 2 >> afile
       
    14 hg commit -m "0.2" -d "1000000 0"
       
    15 echo 3 >> afile
       
    16 hg commit -m "0.3" -d "1000000 0"
       
    17 hg update -C 0
       
    18 echo 1 >> afile
       
    19 hg commit -m "1.1" -d "1000000 0"
       
    20 echo 2 >> afile
       
    21 hg commit -m "1.2" -d "1000000 0"
       
    22 echo "a line" > fred
       
    23 echo 3 >> afile
       
    24 hg add fred
       
    25 hg commit -m "1.3" -d "1000000 0"
       
    26 hg mv afile adifferentfile
       
    27 hg commit -m "1.3m" -d "1000000 0"
       
    28 hg update -C 3
       
    29 hg mv afile anotherfile
       
    30 hg commit -m "0.3m" -d "1000000 0"
       
    31 hg verify
       
    32 cd ..
       
    33 hg init empty
       
    34 
       
    35 echo "====== Bundle --all"
       
    36 hg -R test bundle --all all.hg
       
    37 
       
    38 echo "====== Bundle test to full.hg"
       
    39 hg -R test bundle full.hg empty
       
    40 echo "====== Unbundle full.hg in test"
       
    41 hg -R test unbundle full.hg
       
    42 echo "====== Verify empty"
       
    43 hg -R empty heads
       
    44 hg -R empty verify
       
    45 
       
    46 echo "====== Pull full.hg into test (using --cwd)"
       
    47 hg --cwd test pull ../full.hg
       
    48 echo "====== Pull full.hg into empty (using --cwd)"
       
    49 hg --cwd empty pull ../full.hg
       
    50 echo "====== Rollback empty"
       
    51 hg -R empty rollback
       
    52 echo "====== Pull full.hg into empty again (using --cwd)"
       
    53 hg --cwd empty pull ../full.hg
       
    54 
       
    55 echo "====== Pull full.hg into test (using -R)"
       
    56 hg -R test pull full.hg
       
    57 echo "====== Pull full.hg into empty (using -R)"
       
    58 hg -R empty pull full.hg
       
    59 echo "====== Rollback empty"
       
    60 hg -R empty rollback
       
    61 echo "====== Pull full.hg into empty again (using -R)"
       
    62 hg -R empty pull full.hg
       
    63 
       
    64 echo "====== Log -R full.hg in fresh empty"
       
    65 rm -r empty
       
    66 hg init empty
       
    67 cd empty
       
    68 hg -R bundle://../full.hg log
       
    69 
       
    70 echo "====== Pull ../full.hg into empty (with hook)"
       
    71 echo '[hooks]' >> .hg/hgrc
       
    72 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
       
    73 #doesn't work (yet ?)
       
    74 #hg -R bundle://../full.hg verify
       
    75 hg pull bundle://../full.hg
       
    76 echo "====== Rollback empty"
       
    77 hg rollback
       
    78 cd ..
       
    79 echo "====== Log -R bundle:empty+full.hg"
       
    80 hg -R bundle:empty+full.hg log --template="{rev} "
       
    81 echo ""
       
    82 echo "====== Pull full.hg into empty again (using -R; with hook)"
       
    83 hg -R empty pull full.hg
       
    84 
       
    85 echo "====== Create partial clones"
       
    86 rm -r empty
       
    87 hg init empty
       
    88 hg clone -r 3 test partial
       
    89 hg clone partial partial2
       
    90 cd partial
       
    91 echo "====== Log -R full.hg in partial"
       
    92 hg -R bundle://../full.hg log
       
    93 echo "====== Incoming full.hg in partial"
       
    94 hg incoming bundle://../full.hg
       
    95 echo "====== Outgoing -R full.hg vs partial2 in partial"
       
    96 hg -R bundle://../full.hg outgoing ../partial2
       
    97 echo "====== Outgoing -R does-not-exist.hg vs partial2 in partial"
       
    98 hg -R bundle://../does-not-exist.hg outgoing ../partial2
       
    99 cd ..
       
   100 
       
   101 echo "====== Direct clone from bundle (all-history)"
       
   102 hg clone full.hg full-clone
       
   103 hg -R full-clone heads
       
   104 rm -r full-clone
       
   105 
       
   106 # test for http://mercurial.selenic.com/bts/issue216
       
   107 echo "====== Unbundle incremental bundles into fresh empty in one go"
       
   108 rm -r empty
       
   109 hg init empty
       
   110 hg -R test bundle --base null -r 0 ../0.hg
       
   111 hg -R test bundle --base 0    -r 1 ../1.hg
       
   112 hg -R empty unbundle -u ../0.hg ../1.hg
       
   113 
       
   114 # test for 540d1059c802
       
   115 echo "====== test for 540d1059c802"
       
   116 hg init orig
       
   117 cd orig
       
   118 echo foo > foo
       
   119 hg add foo
       
   120 hg ci -m 'add foo'
       
   121 
       
   122 hg clone . ../copy
       
   123 hg tag foo
       
   124 
       
   125 cd ../copy
       
   126 echo >> foo
       
   127 hg ci -m 'change foo'
       
   128 hg bundle ../bundle.hg ../orig
       
   129 
       
   130 cd ../orig
       
   131 hg incoming ../bundle.hg
       
   132 cd ..
       
   133 
       
   134 # test for http://mercurial.selenic.com/bts/issue1144
       
   135 echo "===== test that verify bundle does not traceback"
       
   136 # partial history bundle, fails w/ unkown parent
       
   137 hg -R bundle.hg verify
       
   138 # full history bundle, refuses to verify non-local repo
       
   139 hg -R all.hg verify
       
   140 # but, regular verify must continue to work
       
   141 hg -R orig verify
       
   142 
       
   143 echo "====== diff against bundle"
       
   144 hg init b
       
   145 cd b
       
   146 hg -R ../all.hg diff -r tip
       
   147 cd ..
       
   148 
       
   149 echo "====== bundle single branch"
       
   150 hg init branchy
       
   151 cd branchy
       
   152 echo a >a
       
   153 hg ci -Ama
       
   154 echo b >b
       
   155 hg ci -Amb
       
   156 echo b1 >b1
       
   157 hg ci -Amb1
       
   158 hg up 0
       
   159 echo c >c
       
   160 hg ci -Amc
       
   161 echo c1 >c1
       
   162 hg ci -Amc1
       
   163 hg clone -q .#tip part
       
   164 echo "== bundling via incoming"
       
   165 hg in -R part --bundle incoming.hg --template "{node}\n" .
       
   166 echo "== bundling"
       
   167 hg bundle bundle.hg part --debug
       
   168