Mercurial > hg
annotate tests/test-relink.t @ 42142:5382d8f8530b
changelog: parse copy metadata if available in extras
This lets read back the copy metadata we just started writing. There
are still many places left to teach about getting the copy information
from the changeset, but we have enough ({file_copies}, specifically)
that we can add it now and have some test coverage of it.
Differential Revision: https://phab.mercurial-scm.org/D6186
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 27 Dec 2017 22:05:20 -0800 |
parents | 43f0a37bd9ed |
children | 42d2b31cee0b |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
16971
diff
changeset
|
1 #require hardlink |
16971
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
2 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
3 $ echo "[extensions]" >> $HGRCPATH |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
4 $ echo "relink=" >> $HGRCPATH |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
6 $ fix_path() { |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
7 > tr '\\' / |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
8 > } |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
10 $ cat > arelinked.py <<EOF |
33988
afb33e73e515
tests: update test-relink to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
32940
diff
changeset
|
11 > from __future__ import absolute_import, print_function |
afb33e73e515
tests: update test-relink to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
32940
diff
changeset
|
12 > import os |
afb33e73e515
tests: update test-relink to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
32940
diff
changeset
|
13 > import sys |
40307
43f0a37bd9ed
py3: byteify extension in test-relink.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
39707
diff
changeset
|
14 > from mercurial import ( |
43f0a37bd9ed
py3: byteify extension in test-relink.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
39707
diff
changeset
|
15 > pycompat, |
43f0a37bd9ed
py3: byteify extension in test-relink.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
39707
diff
changeset
|
16 > util, |
43f0a37bd9ed
py3: byteify extension in test-relink.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
39707
diff
changeset
|
17 > ) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
18 > path1, path2 = sys.argv[1:3] |
40307
43f0a37bd9ed
py3: byteify extension in test-relink.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
39707
diff
changeset
|
19 > if util.samefile(pycompat.fsencode(path1), pycompat.fsencode(path2)): |
33988
afb33e73e515
tests: update test-relink to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
32940
diff
changeset
|
20 > print('%s == %s' % (path1, path2)) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
21 > else: |
33988
afb33e73e515
tests: update test-relink to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
32940
diff
changeset
|
22 > print('%s != %s' % (path1, path2)) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
23 > EOF |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
24 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
25 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
26 create source repository |
10218
750b7a4f01f6
Add support for relinking on Windows.
Siddharth Agarwal <sid.bugzilla@gmail.com>
parents:
10217
diff
changeset
|
27 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
28 $ hg init repo |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
29 $ cd repo |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
30 $ echo a > a |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
31 $ echo b > b |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
32 $ hg ci -Am addfile |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
33 adding a |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
34 adding b |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15447
diff
changeset
|
35 $ cat "$TESTDIR/binfile.bin" >> a |
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15447
diff
changeset
|
36 $ cat "$TESTDIR/binfile.bin" >> b |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
37 $ hg ci -Am changefiles |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
38 |
13656
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
39 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
|
40 formatting of final byte count |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
41 |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15447
diff
changeset
|
42 $ cat "$TESTDIR/binfile.bin" >> a |
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15447
diff
changeset
|
43 $ cat "$TESTDIR/binfile.bin" >> b |
13656
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
44 $ hg ci -m anotherchange |
0e200e1801f4
relink: format reclaimed byte count nicely
Martin Geisler <mg@lazybytes.net>
parents:
13655
diff
changeset
|
45 |
13657
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
46 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
|
47 |
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
48 $ hg relink . |
35393
4441705b7111
tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents:
34661
diff
changeset
|
49 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store |
13657
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
50 there is nothing to relink |
b69102740e57
relink: avoid trying to lock the same repo twice
Martin Geisler <mg@lazybytes.net>
parents:
12847
diff
changeset
|
51 |
13659 | 52 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
53 Test files are read in binary mode |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
54 |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
37338
diff
changeset
|
55 $ "$PYTHON" -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\r\nb\n')" |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
56 $ cd .. |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
57 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
58 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
59 clone and pull to break links |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
61 $ hg clone --pull -r0 repo clone |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
62 adding changesets |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
63 adding manifests |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
64 adding file changes |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
65 added 1 changesets with 2 changes to 2 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
33988
diff
changeset
|
66 new changesets 008c0c271c47 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
67 updating to branch default |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
68 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
|
69 $ cd clone |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
70 $ hg pull -q |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
71 $ echo b >> b |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
72 $ hg ci -m changeb |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
73 created new head |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
37338
diff
changeset
|
74 $ "$PYTHON" -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\nb\r\n')" |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
75 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
76 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
77 relink |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
78 |
37338
cbc4425e81b5
tests: conditionalize tests based on presence of revlogs for files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36019
diff
changeset
|
79 #if no-reposimplestore |
cbc4425e81b5
tests: conditionalize tests based on presence of revlogs for files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36019
diff
changeset
|
80 |
25125
bd625cd4e5e7
progress: get the extremely verbose output out of default debug
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23285
diff
changeset
|
81 $ hg relink --debug --config progress.debug=true | fix_path |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
82 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
|
83 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
|
84 collecting: 00changelog.i 1/3 files (33.33%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
85 collecting: 00manifest.i 2/3 files (66.67%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
86 collecting: a.i 3/3 files (100.00%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
87 collecting: b.i 4/3 files (133.33%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
88 collecting: dummy.i 5/3 files (166.67%) |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
89 collected 5 candidate storage files |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
90 not linkable: 00changelog.i |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
91 not linkable: 00manifest.i |
12744
0793d763e413
progress: dropping superfluous space from units
timeless <timeless@gmail.com>
parents:
12640
diff
changeset
|
92 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
|
93 not linkable: data/b.i |
12744
0793d763e413
progress: dropping superfluous space from units
timeless <timeless@gmail.com>
parents:
12640
diff
changeset
|
94 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
|
95 pruned down to 2 probably relinkable files |
12744
0793d763e413
progress: dropping superfluous space from units
timeless <timeless@gmail.com>
parents:
12640
diff
changeset
|
96 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
|
97 not linkable: data/dummy.i |
23285
6cc1f388ac80
revlog: store fulltext when compressed delta is bigger than it
Siddharth Agarwal <sid0@fb.com>
parents:
22947
diff
changeset
|
98 relinked 1 files (1.36 KB reclaimed) |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
99 $ cd .. |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
100 |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
101 |
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
102 check hardlinks |
10217
2bbb4c8eb27e
Add test for relink extension
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
103 |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
37338
diff
changeset
|
104 $ "$PYTHON" arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
105 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
37338
diff
changeset
|
106 $ "$PYTHON" arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i |
12115
a0dcbcbd1590
tests: unify test-relink
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10218
diff
changeset
|
107 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
|
108 |
37338
cbc4425e81b5
tests: conditionalize tests based on presence of revlogs for files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36019
diff
changeset
|
109 #endif |