##// END OF EJS Templates
tests: update test-relink to pass our import checker
Augie Fackler -
r33990:afb33e73 default
parent child Browse files
Show More
@@ -1,100 +1,102 b''
1 #require hardlink
1 #require hardlink
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "relink=" >> $HGRCPATH
4 $ echo "relink=" >> $HGRCPATH
5
5
6 $ fix_path() {
6 $ fix_path() {
7 > tr '\\' /
7 > tr '\\' /
8 > }
8 > }
9
9
10 $ cat > arelinked.py <<EOF
10 $ cat > arelinked.py <<EOF
11 > import sys, os
11 > from __future__ import absolute_import, print_function
12 > import os
13 > import sys
12 > from mercurial import util
14 > from mercurial import util
13 > path1, path2 = sys.argv[1:3]
15 > path1, path2 = sys.argv[1:3]
14 > if util.samefile(path1, path2):
16 > if util.samefile(path1, path2):
15 > print '%s == %s' % (path1, path2)
17 > print('%s == %s' % (path1, path2))
16 > else:
18 > else:
17 > print '%s != %s' % (path1, path2)
19 > print('%s != %s' % (path1, path2))
18 > EOF
20 > EOF
19
21
20
22
21 create source repository
23 create source repository
22
24
23 $ hg init repo
25 $ hg init repo
24 $ cd repo
26 $ cd repo
25 $ echo a > a
27 $ echo a > a
26 $ echo b > b
28 $ echo b > b
27 $ hg ci -Am addfile
29 $ hg ci -Am addfile
28 adding a
30 adding a
29 adding b
31 adding b
30 $ cat "$TESTDIR/binfile.bin" >> a
32 $ cat "$TESTDIR/binfile.bin" >> a
31 $ cat "$TESTDIR/binfile.bin" >> b
33 $ cat "$TESTDIR/binfile.bin" >> b
32 $ hg ci -Am changefiles
34 $ hg ci -Am changefiles
33
35
34 make another commit to create files larger than 1 KB to test
36 make another commit to create files larger than 1 KB to test
35 formatting of final byte count
37 formatting of final byte count
36
38
37 $ cat "$TESTDIR/binfile.bin" >> a
39 $ cat "$TESTDIR/binfile.bin" >> a
38 $ cat "$TESTDIR/binfile.bin" >> b
40 $ cat "$TESTDIR/binfile.bin" >> b
39 $ hg ci -m anotherchange
41 $ hg ci -m anotherchange
40
42
41 don't sit forever trying to double-lock the source repo
43 don't sit forever trying to double-lock the source repo
42
44
43 $ hg relink .
45 $ hg relink .
44 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
46 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
45 there is nothing to relink
47 there is nothing to relink
46
48
47
49
48 Test files are read in binary mode
50 Test files are read in binary mode
49
51
50 $ $PYTHON -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
52 $ $PYTHON -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
51 $ cd ..
53 $ cd ..
52
54
53
55
54 clone and pull to break links
56 clone and pull to break links
55
57
56 $ hg clone --pull -r0 repo clone
58 $ hg clone --pull -r0 repo clone
57 adding changesets
59 adding changesets
58 adding manifests
60 adding manifests
59 adding file changes
61 adding file changes
60 added 1 changesets with 2 changes to 2 files
62 added 1 changesets with 2 changes to 2 files
61 updating to branch default
63 updating to branch default
62 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 $ cd clone
65 $ cd clone
64 $ hg pull -q
66 $ hg pull -q
65 $ echo b >> b
67 $ echo b >> b
66 $ hg ci -m changeb
68 $ hg ci -m changeb
67 created new head
69 created new head
68 $ $PYTHON -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
70 $ $PYTHON -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
69
71
70
72
71 relink
73 relink
72
74
73 $ hg relink --debug --config progress.debug=true | fix_path
75 $ hg relink --debug --config progress.debug=true | fix_path
74 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
76 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
75 tip has 2 files, estimated total number of files: 3
77 tip has 2 files, estimated total number of files: 3
76 collecting: 00changelog.i 1/3 files (33.33%)
78 collecting: 00changelog.i 1/3 files (33.33%)
77 collecting: 00manifest.i 2/3 files (66.67%)
79 collecting: 00manifest.i 2/3 files (66.67%)
78 collecting: a.i 3/3 files (100.00%)
80 collecting: a.i 3/3 files (100.00%)
79 collecting: b.i 4/3 files (133.33%)
81 collecting: b.i 4/3 files (133.33%)
80 collecting: dummy.i 5/3 files (166.67%)
82 collecting: dummy.i 5/3 files (166.67%)
81 collected 5 candidate storage files
83 collected 5 candidate storage files
82 not linkable: 00changelog.i
84 not linkable: 00changelog.i
83 not linkable: 00manifest.i
85 not linkable: 00manifest.i
84 pruning: data/a.i 3/5 files (60.00%)
86 pruning: data/a.i 3/5 files (60.00%)
85 not linkable: data/b.i
87 not linkable: data/b.i
86 pruning: data/dummy.i 5/5 files (100.00%)
88 pruning: data/dummy.i 5/5 files (100.00%)
87 pruned down to 2 probably relinkable files
89 pruned down to 2 probably relinkable files
88 relinking: data/a.i 1/2 files (50.00%)
90 relinking: data/a.i 1/2 files (50.00%)
89 not linkable: data/dummy.i
91 not linkable: data/dummy.i
90 relinked 1 files (1.36 KB reclaimed)
92 relinked 1 files (1.36 KB reclaimed)
91 $ cd ..
93 $ cd ..
92
94
93
95
94 check hardlinks
96 check hardlinks
95
97
96 $ $PYTHON arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
98 $ $PYTHON arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
97 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
99 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
98 $ $PYTHON arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
100 $ $PYTHON arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
99 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
101 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
100
102
General Comments 0
You need to be logged in to leave comments. Login now