Show More
@@ -1,54 +1,89 b'' | |||
|
1 | #!/bin/sh | |
|
1 | $ echo "[extensions]" >> $HGRCPATH | |
|
2 | $ echo "relink=" >> $HGRCPATH | |
|
2 | 3 | |
|
3 | echo "[extensions]" >> $HGRCPATH | |
|
4 | echo "relink=" >> $HGRCPATH | |
|
4 | $ fix_path() { | |
|
5 | > tr '\\' / | |
|
6 | > } | |
|
5 | 7 | |
|
6 | fix_path() | |
|
7 | { | |
|
8 | tr '\\' / | |
|
9 | } | |
|
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 | |
|
10 | 20 | |
|
11 | cat > arelinked.py <<EOF | |
|
12 | import sys, os | |
|
13 | from mercurial import util | |
|
14 | path1, path2 = sys.argv[1:3] | |
|
15 | if util.samefile(path1, path2): | |
|
16 | print '%s == %s' % (path1, path2) | |
|
17 | else: | |
|
18 | print '%s != %s' % (path1, path2) | |
|
19 | EOF | |
|
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 | |
|
20 | 41 | |
|
21 | echo '% create source repository' | |
|
22 | hg init repo | |
|
23 | cd repo | |
|
24 | echo '[ui]' > .hg/hgrc | |
|
25 | echo 'username= A. Foo <a.foo@bar.com>' >> .hg/hgrc | |
|
26 | echo a > a | |
|
27 | echo b > b | |
|
28 | hg ci -Am addfile | |
|
29 | echo a >> a | |
|
30 | echo a >> b | |
|
31 | hg ci -Am changefiles | |
|
32 | # Test files are read in binary mode | |
|
33 | python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')" | |
|
34 | cd .. | |
|
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 | |
|
35 | 61 | |
|
36 | echo '% clone and pull to break links' | |
|
37 | hg clone --pull -r0 repo clone | |
|
38 | cd clone | |
|
39 | echo '[ui]' >> .hg/hgrc | |
|
40 | echo 'username= A. Baz <a.baz@bar.com>' >> .hg/hgrc | |
|
41 | hg pull -q | |
|
42 | echo b >> b | |
|
43 | hg ci -m changeb | |
|
44 | python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')" | |
|
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 .. | |
|
45 | 81 | |
|
46 | echo '% relink' | |
|
47 | hg relink --debug | sed 's:relinking.*store:relinking .hg/store:g' \ | |
|
48 | | fix_path | |
|
49 | cd .. | |
|
82 | ||
|
83 | check hardlinks | |
|
50 | 84 | |
|
51 | echo '% check hardlinks' | |
|
52 |
|
|
|
53 | python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i | |
|
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 | |
|
54 | 89 |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now