author | Kevin Gessner <kevin@fogcreek.com> |
Fri, 23 Sep 2011 09:02:27 -0700 | |
branch | stable |
changeset 15157 | c208dcd0f709 |
parent 13659 | a73f38d8bbdb |
child 15447 | 9910f60a37ee |
permissions | -rw-r--r-- |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
1 |
$ echo "[extensions]" >> $HGRCPATH |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
2 |
$ echo "relink=" >> $HGRCPATH |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
4 |
$ fix_path() { |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
5 |
> tr '\\' / |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
6 |
> } |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
8 |
$ cat > arelinked.py <<EOF |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
9 |
> import sys, os |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
10 |
> from mercurial import util |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
11 |
> path1, path2 = sys.argv[1:3] |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
12 |
> if util.samefile(path1, path2): |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
13 |
> print '%s == %s' % (path1, path2) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
14 |
> else: |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
15 |
> print '%s != %s' % (path1, path2) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
16 |
> EOF |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
17 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
18 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
19 |
create source repository |
10218
750b7a4f01f6
Add support for relinking on Windows.
Siddharth Agarwal <sid.bugzilla@gmail.com>
parents:
10217
diff
changeset
|
20 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
21 |
$ hg init repo |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
22 |
$ cd repo |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
23 |
$ echo a > a |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
24 |
$ echo b > b |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
25 |
$ hg ci -Am addfile |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
26 |
adding a |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
27 |
adding b |
13656
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
28 |
$ cat $TESTDIR/binfile.bin >> a |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
29 |
$ cat $TESTDIR/binfile.bin >> b |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
30 |
$ hg ci -Am changefiles |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
31 |
|
13656
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
32 |
make another commit to create files larger than 1 KB to test |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
33 |
formatting of final byte count |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
34 |
|
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
35 |
$ cat $TESTDIR/binfile.bin >> a |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
36 |
$ cat $TESTDIR/binfile.bin >> b |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
37 |
$ hg ci -m anotherchange |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
38 |
|
13657
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
39 |
don't sit forever trying to double-lock the source repo |
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
40 |
|
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
41 |
$ hg relink . |
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
42 |
relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store |
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
43 |
there is nothing to relink |
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
44 |
|
13659 | 45 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
46 |
Test files are read in binary mode |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
47 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
48 |
$ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')" |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
49 |
$ cd .. |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
50 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
51 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
52 |
clone and pull to break links |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
54 |
$ hg clone --pull -r0 repo clone |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
55 |
adding changesets |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
56 |
adding manifests |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
57 |
adding file changes |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
58 |
added 1 changesets with 2 changes to 2 files |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
59 |
updating to branch default |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
60 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
61 |
$ cd clone |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
62 |
$ hg pull -q |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
63 |
$ echo b >> b |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
64 |
$ hg ci -m changeb |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
65 |
created new head |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
66 |
$ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')" |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
67 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
68 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
69 |
relink |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
70 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
71 |
$ hg relink --debug | fix_path |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
72 |
relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
73 |
tip has 2 files, estimated total number of files: 3 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
74 |
collecting: 00changelog.i 1/3 files (33.33%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
75 |
collecting: 00manifest.i 2/3 files (66.67%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
76 |
collecting: a.i 3/3 files (100.00%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
77 |
collecting: b.i 4/3 files (133.33%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
78 |
collecting: dummy.i 5/3 files (166.67%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
79 |
collected 5 candidate storage files |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
80 |
not linkable: 00changelog.i |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
81 |
not linkable: 00manifest.i |
12744
0793d763e413
progress: dropping superfluous space from units
timeless <timeless@gmail.com>
parents:
12640
diff
changeset
|
82 |
pruning: data/a.i 3/5 files (60.00%) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
83 |
not linkable: data/b.i |
12744
0793d763e413
progress: dropping superfluous space from units
timeless <timeless@gmail.com>
parents:
12640
diff
changeset
|
84 |
pruning: data/dummy.i 5/5 files (100.00%) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
85 |
pruned down to 2 probably relinkable files |
12744
0793d763e413
progress: dropping superfluous space from units
timeless <timeless@gmail.com>
parents:
12640
diff
changeset
|
86 |
relinking: data/a.i 1/2 files (50.00%) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
87 |
not linkable: data/dummy.i |
13656
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
88 |
relinked 1 files (1.37 KB reclaimed) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
89 |
$ cd .. |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
90 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
91 |
|
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
92 |
check hardlinks |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
93 |
|
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
94 |
$ python arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
95 |
repo/.hg/store/data/a.i == clone/.hg/store/data/a.i |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
96 |
$ python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
97 |
repo/.hg/store/data/b.i != clone/.hg/store/data/b.i |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
98 |