Mercurial > hg
comparison tests/test-relink.t @ 12115:a0dcbcbd1590
tests: unify test-relink
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 14:01:57 +0900 |
parents | tests/test-relink@750b7a4f01f6 |
children | 5163e3c8aa52 |
comparison
equal
deleted
inserted
replaced
12114:0a6b2e21bc86 | 12115:a0dcbcbd1590 |
---|---|
1 $ echo "[extensions]" >> $HGRCPATH | |
2 $ echo "relink=" >> $HGRCPATH | |
3 | |
4 $ fix_path() { | |
5 > tr '\\' / | |
6 > } | |
7 | |
8 $ cat > arelinked.py <<EOF | |
9 > import sys, os | |
10 > from mercurial import util | |
11 > path1, path2 = sys.argv[1:3] | |
12 > if util.samefile(path1, path2): | |
13 > print '%s == %s' % (path1, path2) | |
14 > else: | |
15 > print '%s != %s' % (path1, path2) | |
16 > EOF | |
17 | |
18 | |
19 create source repository | |
20 | |
21 $ hg init repo | |
22 $ cd repo | |
23 $ echo '[ui]' > .hg/hgrc | |
24 $ echo 'username= A. Foo <a.foo@bar.com>' >> .hg/hgrc | |
25 $ echo a > a | |
26 $ echo b > b | |
27 $ hg ci -Am addfile | |
28 adding a | |
29 adding b | |
30 $ echo a >> a | |
31 $ echo a >> b | |
32 $ hg ci -Am changefiles | |
33 | |
34 Test files are read in binary mode | |
35 | |
36 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')" | |
37 $ cd .. | |
38 | |
39 | |
40 clone and pull to break links | |
41 | |
42 $ hg clone --pull -r0 repo clone | |
43 requesting all changes | |
44 adding changesets | |
45 adding manifests | |
46 adding file changes | |
47 added 1 changesets with 2 changes to 2 files | |
48 updating to branch default | |
49 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
50 $ cd clone | |
51 $ echo '[ui]' >> .hg/hgrc | |
52 $ echo 'username= A. Baz <a.baz@bar.com>' >> .hg/hgrc | |
53 $ hg pull -q | |
54 $ echo b >> b | |
55 $ hg ci -m changeb | |
56 created new head | |
57 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')" | |
58 | |
59 | |
60 relink | |
61 | |
62 $ hg relink --debug | fix_path | |
63 relinking .*/.hg/store | |
64 tip has 2 files, estimated total number of files: 3 | |
65 collecting: 00changelog.i 1/3 files (33.33%) | |
66 collecting: 00manifest.i 2/3 files (66.67%) | |
67 collecting: a.i 3/3 files (100.00%) | |
68 collecting: b.i 4/3 files (133.33%) | |
69 collecting: dummy.i 5/3 files (166.67%) | |
70 collected 5 candidate storage files | |
71 not linkable: 00changelog.i | |
72 not linkable: 00manifest.i | |
73 pruning: data/a.i 3/5 files (60.00%) | |
74 not linkable: data/b.i | |
75 pruning: data/dummy.i 5/5 files (100.00%) | |
76 pruned down to 2 probably relinkable files | |
77 relinking: data/a.i 1/2 files (50.00%) | |
78 not linkable: data/dummy.i | |
79 relinked 1 files (136 bytes reclaimed) | |
80 $ cd .. | |
81 | |
82 | |
83 check hardlinks | |
84 | |
85 $ python arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i | |
86 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i | |
87 $ python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i | |
88 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i | |
89 |