annotate tests/test-convert-tla.t @ 36672:9e7b14caf67f

xdiff: remove patience and histogram diff algorithms Patience diff is the normal diff algorithm, plus some greediness that unconditionally matches common common unique lines. That means it is easy to construct cases to let it generate suboptimal result, like: ``` open('a', 'w').write('\n'.join(list('a' + 'x' * 300 + 'u' + 'x' * 700 + 'a\n'))) open('b', 'w').write('\n'.join(list('b' + 'x' * 700 + 'u' + 'x' * 300 + 'b\n'))) ``` Patience diff has been advertised as being able to generate better results for some C code changes. However, the more scientific way to do that is the indention heuristic [1]. Since patience diff could generate suboptimal result more easily and its "better" diff feature could be replaced by the new indention heuristic, let's just remove it and its variant histogram diff to simplify the code. [1]: https://github.com/git/git/commit/433860f3d0beb0c6f205290bd16cda413148f098 Test Plan: `gcc -fPIC *.c --shared -o xdiff.so` still builds. Differential Revision: https://phab.mercurial-scm.org/D2573
author Jun Wu <quark@fb.com>
date Sat, 03 Mar 2018 10:39:55 -0800
parents 561a019c0268
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 20117
diff changeset
1 #require tla symlink
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
2
30888
561a019c0268 misc: replace domain of mercurial ML address by mercurial-scm.org
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22046
diff changeset
3 $ tla my-id "mercurial <mercurial@mercurial-scm.org>"
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
4 $ echo "[extensions]" >> $HGRCPATH
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
5 $ echo "convert=" >> $HGRCPATH
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
6
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
7 create tla archive
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
8
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
9 $ tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
10
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
11 initialize tla repo
6084
a672df805855 Document and fix tla/baz conversion tests
Patrick Mezard <pmezard@gmail.com>
parents: 6079
diff changeset
12
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
13 $ mkdir tla-repo
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
14 $ cd tla-repo/
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
15 $ tla init-tree tla@mercurial--convert/tla--test--0
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
16 $ tla import
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
17 * creating version tla@mercurial--convert/tla--test--0
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
18 * imported tla@mercurial--convert/tla--test--0
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
19
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
20 create initial files
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
21
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
22 $ echo 'this is a file' > a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
23 $ tla add a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
24 $ mkdir src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
25 $ tla add src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
26 $ cd src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
27 $ dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
28 $ tla add b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
29 $ tla commit -s "added a file, src and src/b (binary)"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
30 A/ .arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
31 A/ src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
32 A/ src/.arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
33 A .arch-ids/a.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
34 A a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
35 A src/.arch-ids/=id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
36 A src/.arch-ids/b.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
37 A src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
38 * update pristine tree (tla@mercurial--convert/tla--test--0--base-0 => tla--test--0--patch-1)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
39 * committed tla@mercurial--convert/tla--test--0--patch-1
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
40
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
41 create link file and modify a
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
42
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
43 $ ln -s ../a a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
44 $ tla add a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
45 $ echo 'this a modification to a' >> ../a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
46 $ tla commit -s "added link to a and modify a"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
47 A src/.arch-ids/a-link.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
48 A src/a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
49 M a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
50 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-1 => tla--test--0--patch-2)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
51 * committed tla@mercurial--convert/tla--test--0--patch-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
52
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
53 create second link and modify b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
54
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
55 $ ln -s ../a a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
56 $ tla add a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
57 $ dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
58 $ tla commit -s "added second link and modify b"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
59 A src/.arch-ids/a-link-2.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
60 A src/a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
61 Mb src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
62 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-2 => tla--test--0--patch-3)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
63 * committed tla@mercurial--convert/tla--test--0--patch-3
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
64
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
65 b file to link and a-link-2 to regular file
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
66
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
67 $ rm -f a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
68 $ echo 'this is now a regular file' > a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
69 $ ln -sf ../a b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
70 $ tla commit -s "file to link and link to file test"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
71 fl src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
72 lf src/a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
73 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-3 => tla--test--0--patch-4)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
74 * committed tla@mercurial--convert/tla--test--0--patch-4
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
75
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
76 move a-link-2 file and src directory
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
77
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
78 $ cd ..
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
79 $ tla mv src/a-link-2 c
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
80 $ tla mv src test
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
81 $ tla commit -s "move and rename a-link-2 file and src directory"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
82 D/ src/.arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
83 A/ test/.arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
84 /> src test
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
85 => src/.arch-ids/a-link-2.id .arch-ids/c.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
86 => src/a-link-2 c
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
87 => src/.arch-ids/=id test/.arch-ids/=id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
88 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
89 => src/.arch-ids/b.id test/.arch-ids/b.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
90 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-4 => tla--test--0--patch-5)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
91 * committed tla@mercurial--convert/tla--test--0--patch-5
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
92 $ cd ..
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
93
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
94 converting tla repo to Mercurial
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
95
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
96 $ hg convert tla-repo tla-repo-hg
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
97 initializing destination tla-repo-hg repository
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
98 analyzing tree version tla@mercurial--convert/tla--test--0...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
99 scanning source...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
100 sorting...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
101 converting...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
102 5 initial import
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
103 4 added a file, src and src/b (binary)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
104 3 added link to a and modify a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
105 2 added second link and modify b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
106 1 file to link and link to file test
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
107 0 move and rename a-link-2 file and src directory
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
108 $ tla register-archive -d tla@mercurial--convert
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
109 $ glog()
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
110 > {
20117
aa9385f983fa tests: don't load unnecessary graphlog extension
Martin Geisler <martin@geisler.net>
parents: 15441
diff changeset
111 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
112 > }
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
113
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
114 show graph log
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
115
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
116 $ glog -R tla-repo-hg
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
117 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
118 |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
119 o 4 "file to link and link to file test" files: src/a-link-2 src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
120 |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
121 o 3 "added second link and modify b" files: src/a-link-2 src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
122 |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
123 o 2 "added link to a and modify a" files: a src/a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
124 |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
125 o 1 "added a file, src and src/b (binary)" files: a src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
126 |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
127 o 0 "initial import" files:
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
128
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
129 $ hg up -q -R tla-repo-hg
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
130 $ hg -R tla-repo-hg manifest --debug
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
131 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
132 0201ac32a3a8e86e303dff60366382a54b48a72e 644 c
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
133 c0067ba5ff0b7c9a3eb17270839d04614c435623 644 @ test/a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
134 375f4263d86feacdea7e3c27100abd1560f2a973 644 @ test/b