Show More
@@ -143,7 +143,7 b' static int longest_match(struct bdiff_li' | |||||
143 | struct pos *pos, |
|
143 | struct pos *pos, | |
144 | int a1, int a2, int b1, int b2, int *omi, int *omj) |
|
144 | int a1, int a2, int b1, int b2, int *omi, int *omj) | |
145 | { |
|
145 | { | |
146 | int mi = a1, mj = b1, mk = 0, i, j, k, half; |
|
146 | int mi = a1, mj = b1, mk = 0, i, j, k, half, bhalf; | |
147 |
|
147 | |||
148 | /* window our search on large regions to better bound |
|
148 | /* window our search on large regions to better bound | |
149 | worst-case performance. by choosing a window at the end, we |
|
149 | worst-case performance. by choosing a window at the end, we | |
@@ -152,6 +152,7 b' static int longest_match(struct bdiff_li' | |||||
152 | a1 = a2 - 30000; |
|
152 | a1 = a2 - 30000; | |
153 |
|
153 | |||
154 | half = (a1 + a2 - 1) / 2; |
|
154 | half = (a1 + a2 - 1) / 2; | |
|
155 | bhalf = (b1 + b2 - 1) / 2; | |||
155 |
|
156 | |||
156 | for (i = a1; i < a2; i++) { |
|
157 | for (i = a1; i < a2; i++) { | |
157 | /* skip all lines in b after the current block */ |
|
158 | /* skip all lines in b after the current block */ | |
@@ -187,8 +188,8 b' static int longest_match(struct bdiff_li' | |||||
187 | /* same match but closer to half */ |
|
188 | /* same match but closer to half */ | |
188 | mi = i; |
|
189 | mi = i; | |
189 | mj = j; |
|
190 | mj = j; | |
190 | } else if (i == mi) { |
|
191 | } else if (i == mi && mj > bhalf) { | |
191 | /* same i but earlier j */ |
|
192 | /* same i but best earlier j */ | |
192 | mj = j; |
|
193 | mj = j; | |
193 | } |
|
194 | } | |
194 | } |
|
195 | } |
@@ -91,9 +91,9 b' annotate (JSON)' | |||||
91 | annotate -n b |
|
91 | annotate -n b | |
92 |
|
92 | |||
93 | $ hg annotate -n b |
|
93 | $ hg annotate -n b | |
|
94 | 1: a | |||
94 | 0: a |
|
95 | 0: a | |
95 | 1: a |
|
96 | 1: a | |
96 | 1: a |
|
|||
97 | 3: b4 |
|
97 | 3: b4 | |
98 | 3: b5 |
|
98 | 3: b5 | |
99 | 3: b6 |
|
99 | 3: b6 | |
@@ -111,8 +111,8 b' annotate --no-follow b' | |||||
111 | annotate -nl b |
|
111 | annotate -nl b | |
112 |
|
112 | |||
113 | $ hg annotate -nl b |
|
113 | $ hg annotate -nl b | |
|
114 | 1:1: a | |||
114 | 0:1: a |
|
115 | 0:1: a | |
115 | 1:2: a |
|
|||
116 | 1:3: a |
|
116 | 1:3: a | |
117 | 3:4: b4 |
|
117 | 3:4: b4 | |
118 | 3:5: b5 |
|
118 | 3:5: b5 | |
@@ -121,9 +121,9 b' annotate -nl b' | |||||
121 | annotate -nf b |
|
121 | annotate -nf b | |
122 |
|
122 | |||
123 | $ hg annotate -nf b |
|
123 | $ hg annotate -nf b | |
|
124 | 1 a: a | |||
124 | 0 a: a |
|
125 | 0 a: a | |
125 | 1 a: a |
|
126 | 1 a: a | |
126 | 1 a: a |
|
|||
127 | 3 b: b4 |
|
127 | 3 b: b4 | |
128 | 3 b: b5 |
|
128 | 3 b: b5 | |
129 | 3 b: b6 |
|
129 | 3 b: b6 | |
@@ -131,8 +131,8 b' annotate -nf b' | |||||
131 | annotate -nlf b |
|
131 | annotate -nlf b | |
132 |
|
132 | |||
133 | $ hg annotate -nlf b |
|
133 | $ hg annotate -nlf b | |
|
134 | 1 a:1: a | |||
134 | 0 a:1: a |
|
135 | 0 a:1: a | |
135 | 1 a:2: a |
|
|||
136 | 1 a:3: a |
|
136 | 1 a:3: a | |
137 | 3 b:4: b4 |
|
137 | 3 b:4: b4 | |
138 | 3 b:5: b5 |
|
138 | 3 b:5: b5 | |
@@ -156,9 +156,9 b' annotate -nlf b' | |||||
156 | annotate after merge |
|
156 | annotate after merge | |
157 |
|
157 | |||
158 | $ hg annotate -nf b |
|
158 | $ hg annotate -nf b | |
|
159 | 1 a: a | |||
159 | 0 a: a |
|
160 | 0 a: a | |
160 | 1 a: a |
|
161 | 1 a: a | |
161 | 1 a: a |
|
|||
162 | 3 b: b4 |
|
162 | 3 b: b4 | |
163 | 4 b: c |
|
163 | 4 b: c | |
164 | 3 b: b5 |
|
164 | 3 b: b5 | |
@@ -166,8 +166,8 b' annotate after merge' | |||||
166 | annotate after merge with -l |
|
166 | annotate after merge with -l | |
167 |
|
167 | |||
168 | $ hg annotate -nlf b |
|
168 | $ hg annotate -nlf b | |
|
169 | 1 a:1: a | |||
169 | 0 a:1: a |
|
170 | 0 a:1: a | |
170 | 1 a:2: a |
|
|||
171 | 1 a:3: a |
|
171 | 1 a:3: a | |
172 | 3 b:4: b4 |
|
172 | 3 b:4: b4 | |
173 | 4 b:5: c |
|
173 | 4 b:5: c | |
@@ -198,7 +198,7 b' annotate after merge with -l' | |||||
198 | annotate after rename merge |
|
198 | annotate after rename merge | |
199 |
|
199 | |||
200 | $ hg annotate -nf b |
|
200 | $ hg annotate -nf b | |
201 |
|
|
201 | 1 a: a | |
202 | 6 b: z |
|
202 | 6 b: z | |
203 | 1 a: a |
|
203 | 1 a: a | |
204 | 3 b: b4 |
|
204 | 3 b: b4 | |
@@ -209,7 +209,7 b' annotate after rename merge' | |||||
209 | annotate after rename merge with -l |
|
209 | annotate after rename merge with -l | |
210 |
|
210 | |||
211 | $ hg annotate -nlf b |
|
211 | $ hg annotate -nlf b | |
212 |
|
|
212 | 1 a:1: a | |
213 | 6 b:2: z |
|
213 | 6 b:2: z | |
214 | 1 a:3: a |
|
214 | 1 a:3: a | |
215 | 3 b:4: b4 |
|
215 | 3 b:4: b4 | |
@@ -226,7 +226,7 b' Issue2807: alignment of line numbers wit' | |||||
226 | $ echo more >> b |
|
226 | $ echo more >> b | |
227 | $ hg ci -mmore -d '7 0' |
|
227 | $ hg ci -mmore -d '7 0' | |
228 | $ hg annotate -nlf b |
|
228 | $ hg annotate -nlf b | |
229 |
|
|
229 | 1 a: 1: a | |
230 | 6 b: 2: z |
|
230 | 6 b: 2: z | |
231 | 1 a: 3: a |
|
231 | 1 a: 3: a | |
232 | 3 b: 4: b4 |
|
232 | 3 b: 4: b4 | |
@@ -240,15 +240,15 b' Issue2807: alignment of line numbers wit' | |||||
240 | linkrev vs rev |
|
240 | linkrev vs rev | |
241 |
|
241 | |||
242 | $ hg annotate -r tip -n a |
|
242 | $ hg annotate -r tip -n a | |
|
243 | 1: a | |||
243 | 0: a |
|
244 | 0: a | |
244 | 1: a |
|
245 | 1: a | |
245 | 1: a |
|
|||
246 |
|
246 | |||
247 | linkrev vs rev with -l |
|
247 | linkrev vs rev with -l | |
248 |
|
248 | |||
249 | $ hg annotate -r tip -nl a |
|
249 | $ hg annotate -r tip -nl a | |
|
250 | 1:1: a | |||
250 | 0:1: a |
|
251 | 0:1: a | |
251 | 1:2: a |
|
|||
252 | 1:3: a |
|
252 | 1:3: a | |
253 |
|
253 | |||
254 | Issue589: "undelete" sequence leads to crash |
|
254 | Issue589: "undelete" sequence leads to crash |
@@ -79,14 +79,14 b' testfixws("", "", 0)' | |||||
79 |
|
79 | |||
80 | print("done") |
|
80 | print("done") | |
81 |
|
81 | |||
82 |
print(" |
|
82 | print("Nice diff for a trivial change:") | |
83 | showdiff( |
|
83 | showdiff( | |
84 | ''.join('<%s\n-\n' % i for i in range(5)), |
|
84 | ''.join('<%s\n-\n' % i for i in range(5)), | |
85 | ''.join('>%s\n-\n' % i for i in range(5))) |
|
85 | ''.join('>%s\n-\n' % i for i in range(5))) | |
86 |
|
86 | |||
87 |
print("Diff 1 to 3 lines - preference for |
|
87 | print("Diff 1 to 3 lines - preference for balanced recursion:") | |
88 | showdiff('a\n', 'a\n' * 3) |
|
88 | showdiff('a\n', 'a\n' * 3) | |
89 |
print("Diff 1 to 5 lines - preference for |
|
89 | print("Diff 1 to 5 lines - preference for balanced recursion:") | |
90 | showdiff('a\n', 'a\n' * 5) |
|
90 | showdiff('a\n', 'a\n' * 5) | |
91 | print("Diff 3 to 1 lines - preference for balanced recursion:") |
|
91 | print("Diff 3 to 1 lines - preference for balanced recursion:") | |
92 | showdiff('a\n' * 3, 'a\n') |
|
92 | showdiff('a\n' * 3, 'a\n') |
@@ -42,31 +42,34 b' showdiff(' | |||||
42 | 'f\n' |
|
42 | 'f\n' | |
43 | done |
|
43 | done | |
44 | done |
|
44 | done | |
45 |
|
|
45 | Nice diff for a trivial change: | |
46 | showdiff( |
|
46 | showdiff( | |
47 | '<0\n-\n<1\n-\n<2\n-\n<3\n-\n<4\n-\n', |
|
47 | '<0\n-\n<1\n-\n<2\n-\n<3\n-\n<4\n-\n', | |
48 | '>0\n-\n>1\n-\n>2\n-\n>3\n-\n>4\n-\n'): |
|
48 | '>0\n-\n>1\n-\n>2\n-\n>3\n-\n>4\n-\n'): | |
49 |
0 |
|
49 | 0 3 '<0\n' -> '>0\n' | |
50 | '-\n' |
|
50 | '-\n' | |
51 |
|
|
51 | 5 8 '<1\n' -> '>1\n' | |
|
52 | '-\n' | |||
|
53 | 10 13 '<2\n' -> '>2\n' | |||
52 | '-\n' |
|
54 | '-\n' | |
53 |
15 18 '<3\n' -> '> |
|
55 | 15 18 '<3\n' -> '>3\n' | |
54 | '-\n' |
|
56 | '-\n' | |
55 |
20 23 '<4\n' -> '> |
|
57 | 20 23 '<4\n' -> '>4\n' | |
56 | '-\n' |
|
58 | '-\n' | |
57 | 25 25 '' -> '>4\n-\n' |
|
59 | Diff 1 to 3 lines - preference for balanced recursion: | |
58 | Diff 1 to 3 lines - preference for adding / removing at the end of sequences: |
|
|||
59 | showdiff( |
|
60 | showdiff( | |
60 | 'a\n', |
|
61 | 'a\n', | |
61 | 'a\na\na\n'): |
|
62 | 'a\na\na\n'): | |
|
63 | 0 0 '' -> 'a\n' | |||
62 | 'a\n' |
|
64 | 'a\n' | |
63 |
2 2 '' -> 'a\n |
|
65 | 2 2 '' -> 'a\n' | |
64 |
Diff 1 to 5 lines - preference for |
|
66 | Diff 1 to 5 lines - preference for balanced recursion: | |
65 | showdiff( |
|
67 | showdiff( | |
66 | 'a\n', |
|
68 | 'a\n', | |
67 | 'a\na\na\na\na\n'): |
|
69 | 'a\na\na\na\na\n'): | |
|
70 | 0 0 '' -> 'a\na\n' | |||
68 | 'a\n' |
|
71 | 'a\n' | |
69 |
2 2 '' -> 'a\na\n |
|
72 | 2 2 '' -> 'a\na\n' | |
70 | Diff 3 to 1 lines - preference for balanced recursion: |
|
73 | Diff 3 to 1 lines - preference for balanced recursion: | |
71 | showdiff( |
|
74 | showdiff( | |
72 | 'a\na\na\n', |
|
75 | 'a\na\na\n', |
@@ -47,9 +47,9 b' Amending changeset with changes in worki' | |||||
47 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
47 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
48 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
48 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
49 | @@ -1,1 +1,3 @@ |
|
49 | @@ -1,1 +1,3 @@ | |
|
50 | +a | |||
50 | a |
|
51 | a | |
51 | +a |
|
52 | +a | |
52 | +a |
|
|||
53 |
$ |
|
53 | $ hg log | |
54 | changeset: 1:43f1ba15f28a |
|
54 | changeset: 1:43f1ba15f28a | |
55 | tag: tip |
|
55 | tag: tip | |
@@ -122,13 +122,13 b' No changes, just a different message:' | |||||
122 | uncompressed size of bundle content: |
|
122 | uncompressed size of bundle content: | |
123 | 254 (changelog) |
|
123 | 254 (changelog) | |
124 | 163 (manifests) |
|
124 | 163 (manifests) | |
125 |
1 |
|
125 | 141 a | |
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob) |
|
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob) | |
127 | 1 changesets found |
|
127 | 1 changesets found | |
128 | uncompressed size of bundle content: |
|
128 | uncompressed size of bundle content: | |
129 | 250 (changelog) |
|
129 | 250 (changelog) | |
130 | 163 (manifests) |
|
130 | 163 (manifests) | |
131 |
1 |
|
131 | 141 a | |
132 | adding branch |
|
132 | adding branch | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
@@ -140,9 +140,9 b' No changes, just a different message:' | |||||
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
142 | @@ -1,1 +1,3 @@ |
|
142 | @@ -1,1 +1,3 @@ | |
|
143 | +a | |||
143 | a |
|
144 | a | |
144 | +a |
|
145 | +a | |
145 | +a |
|
|||
146 |
$ |
|
146 | $ hg log | |
147 | changeset: 1:1cd866679df8 |
|
147 | changeset: 1:1cd866679df8 | |
148 | tag: tip |
|
148 | tag: tip | |
@@ -266,13 +266,13 b' then, test editing custom commit message' | |||||
266 | uncompressed size of bundle content: |
|
266 | uncompressed size of bundle content: | |
267 | 249 (changelog) |
|
267 | 249 (changelog) | |
268 | 163 (manifests) |
|
268 | 163 (manifests) | |
269 |
13 |
|
269 | 143 a | |
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob) |
|
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob) | |
271 | 1 changesets found |
|
271 | 1 changesets found | |
272 | uncompressed size of bundle content: |
|
272 | uncompressed size of bundle content: | |
273 | 257 (changelog) |
|
273 | 257 (changelog) | |
274 | 163 (manifests) |
|
274 | 163 (manifests) | |
275 |
13 |
|
275 | 143 a | |
276 | adding branch |
|
276 | adding branch | |
277 | adding changesets |
|
277 | adding changesets | |
278 | adding manifests |
|
278 | adding manifests | |
@@ -309,13 +309,13 b' Same, but with changes in working dir (d' | |||||
309 | uncompressed size of bundle content: |
|
309 | uncompressed size of bundle content: | |
310 | 464 (changelog) |
|
310 | 464 (changelog) | |
311 | 322 (manifests) |
|
311 | 322 (manifests) | |
312 |
2 |
|
312 | 261 a | |
313 | saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend-backup.hg (glob) |
|
313 | saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend-backup.hg (glob) | |
314 | 1 changesets found |
|
314 | 1 changesets found | |
315 | uncompressed size of bundle content: |
|
315 | uncompressed size of bundle content: | |
316 | 257 (changelog) |
|
316 | 257 (changelog) | |
317 | 163 (manifests) |
|
317 | 163 (manifests) | |
318 |
1 |
|
318 | 145 a | |
319 | adding branch |
|
319 | adding branch | |
320 | adding changesets |
|
320 | adding changesets | |
321 | adding manifests |
|
321 | adding manifests |
@@ -51,8 +51,8 b' specified)' | |||||
51 | --- a/a |
|
51 | --- a/a | |
52 | +++ b/a |
|
52 | +++ b/a | |
53 | @@ -1,1 +1,3 @@ |
|
53 | @@ -1,1 +1,3 @@ | |
|
54 | +a | |||
54 | a |
|
55 | a | |
55 | +a |
|
|||
56 | +b |
|
56 | +b | |
57 |
|
57 | |||
58 | Fold with local changes: |
|
58 | Fold with local changes: | |
@@ -67,8 +67,8 b' Fold with local changes:' | |||||
67 | --- a/a |
|
67 | --- a/a | |
68 | +++ b/a |
|
68 | +++ b/a | |
69 | @@ -1,1 +1,3 @@ |
|
69 | @@ -1,1 +1,3 @@ | |
|
70 | +a | |||
70 | a |
|
71 | a | |
71 | +a |
|
|||
72 | +b |
|
72 | +b | |
73 |
|
73 | |||
74 | $ hg revert -a --no-backup |
|
74 | $ hg revert -a --no-backup |
General Comments 0
You need to be logged in to leave comments.
Login now