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