tests/test-bundle
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 09 Jun 2007 01:04:28 -0300
changeset 4531 b51a8138292a
parent 4287 ce71da8ab4f5
child 4699 a6b62584d0b2
permissions -rwxr-xr-x
Avoid extra filelogs entries. Right now, there are some situations in which localrepo.filecommit can create filelog entries even though they're not needed. For example: - permissions for a file have changed; - qrefresh can create a filelog entry identical to its parent (see the added test); - convert-repo creates extra filelog entries in every merge where the first parent has added files (for example, changeset ebebe9577a1a of the kernel repo added extra filelog entries to files in the arch/blackfin directory, even though the merge should only touch the drivers/ata directory). This makes "hg log file" in a converted repo less useful than it could be, since it may mention many merges that don't actually touch that specific file. They all come from the same basic problem: localrepo.commit (through filecommit) creates new filelog entries for all files passed to it (except for some cases during a merge). Patch and test case provided by Benoit. This should fix issue351.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     1
#!/bin/sh
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
4287
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
     3
cp "$TESTDIR"/printenv.py .
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
     4
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     5
hg init test
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     6
cd test
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     7
echo 0 > afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     8
hg add afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     9
hg commit -m "0.0" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    10
echo 1 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    11
hg commit -m "0.1" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    12
echo 2 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    13
hg commit -m "0.2" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    14
echo 3 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    15
hg commit -m "0.3" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    16
hg update -C 0
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    17
echo 1 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    18
hg commit -m "1.1" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    19
echo 2 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    20
hg commit -m "1.2" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    21
echo "a line" > fred
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    22
echo 3 >> afile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    23
hg add fred
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    24
hg commit -m "1.3" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    25
hg mv afile adifferentfile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    26
hg commit -m "1.3m" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    27
hg update -C 3
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    28
hg mv afile anotherfile
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    29
hg commit -m "0.3m" -d "1000000 0"
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    30
hg verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
cd ..
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    32
hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    33
hg -R test bundle full.hg empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    34
hg -R test unbundle full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    35
hg -R empty heads
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    36
hg -R empty verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    37
2738
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    38
hg --cwd test pull ../full.hg
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    39
hg --cwd empty pull ../full.hg
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    40
hg -R empty rollback
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    41
hg --cwd empty pull ../full.hg
400a4a502001 pull: allow to pull from bundle file without need for bundle: syntax
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2673
diff changeset
    42
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3429
diff changeset
    43
rm -r empty
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    44
hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    45
cd empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    46
hg -R bundle://../full.hg log
2673
109a22f5434a hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2274
diff changeset
    47
echo '[hooks]' >> .hg/hgrc
4287
ce71da8ab4f5 test-bundle: use printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4042
diff changeset
    48
echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    49
#doesn't work (yet ?)
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    50
#hg -R bundle://../full.hg verify
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    51
hg pull bundle://../full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    52
cd ..
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    53
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3429
diff changeset
    54
rm -r empty
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    55
hg init empty
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    56
hg clone -r 3 test partial
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    57
hg clone partial partial2
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    58
cd partial
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    59
hg -R bundle://../full.hg log
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    60
hg incoming bundle://../full.hg
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    61
hg -R bundle://../full.hg outgoing ../partial2
3429
b19360aa21e9 bundlerepo: avoid exception in __del__ when the bundle doesn't exist
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2738
diff changeset
    62
hg -R bundle://../does-not-exist.hg outgoing ../partial2
2274
89b15372df18 tests for bundles and bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    63
cd ..
4042
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    64
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    65
# test for 540d1059c802
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    66
hg init orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    67
cd orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    68
echo foo > foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    69
hg add foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    70
hg ci -m 'add foo' -d '0 0'
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    71
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    72
hg clone . ../copy
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    73
hg tag -d '0 0' foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    74
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    75
cd ../copy
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    76
echo >> foo
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    77
hg ci -m 'change foo' -d '0 0'
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    78
hg bundle ../bundle.hg ../orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    79
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    80
cd ../orig
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    81
hg incoming ../bundle.hg
f6f65a8d8ed3 add test for 540d1059c802
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
    82
cd ..