Mercurial > hg
comparison tests/test-rebase-conflicts.t @ 28072:c3e9269d9602
merge: minimize conflicts when common base is not shown (issue4447)
Previously, two changes that were nearly, but not quite, identical would result
in large merge conflict regions that looked very similar, and were thus very
confusing to users, and lead people used to other source control systems to
claim that "mercurial's merge algorithms suck". In the relatively common case
of a new file being introduced in two branches with very slight modifications,
the old behavior would show the entire file as a conflict, and it would be very
difficult for a user to determine what was going on.
In the past, mercurial attempted to solve this with a "very smart" algorithm
that would find all common lines, but this has significant problems as
described in 2ea6d906cf9b.
Instead, we use a "very dumb" algorithm introduced in the previous patch that
simply matches lines at the periphery of conflict regions. This minimizes most
conflict regions well, though there may still be some degenerate edge cases,
like small modification to the beginning and end of a large file.
author | Ryan McElroy <rmcelroy@fb.com> |
---|---|
date | Wed, 10 Feb 2016 09:06:08 -0800 |
parents | 157675d0f600 |
children | 953839de96ab |
comparison
equal
deleted
inserted
replaced
28071:261324dd5f5b | 28072:c3e9269d9602 |
---|---|
303 bundle2-input-bundle: 0 parts total | 303 bundle2-input-bundle: 0 parts total |
304 invalid branchheads cache (served): tip differs | 304 invalid branchheads cache (served): tip differs |
305 rebase completed | 305 rebase completed |
306 updating the branch cache | 306 updating the branch cache |
307 truncating cache/rbc-revs-v1 to 72 | 307 truncating cache/rbc-revs-v1 to 72 |
308 | |
309 Test minimization of merge conflicts | |
310 $ hg up -q null | |
311 $ echo a > a | |
312 $ hg add a | |
313 $ hg commit -q -m 'a' | |
314 $ echo b >> a | |
315 $ hg commit -q -m 'ab' | |
316 $ hg bookmark ab | |
317 $ hg up -q '.^' | |
318 $ echo b >> a | |
319 $ echo c >> a | |
320 $ hg commit -q -m 'abc' | |
321 $ hg rebase -s 7bc217434fc1 -d ab --keep | |
322 rebasing 13:7bc217434fc1 "abc" (tip) | |
323 merging a | |
324 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
325 unresolved conflicts (see hg resolve, then hg rebase --continue) | |
326 [1] | |
327 $ hg diff | |
328 diff -r 328e4ab1f7cc a | |
329 --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
330 +++ b/a * (glob) | |
331 @@ -1,2 +1,6 @@ | |
332 a | |
333 b | |
334 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab | |
335 +======= | |
336 +c | |
337 +>>>>>>> source: 7bc217434fc1 - test: abc | |
338 $ hg rebase --abort | |
339 rebase aborted | |
340 $ hg up -q -C 7bc217434fc1 | |
341 $ hg rebase -s . -d ab --keep -t internal:merge3 | |
342 rebasing 13:7bc217434fc1 "abc" (tip) | |
343 merging a | |
344 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
345 unresolved conflicts (see hg resolve, then hg rebase --continue) | |
346 [1] | |
347 $ hg diff | |
348 diff -r 328e4ab1f7cc a | |
349 --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
350 +++ b/a * (glob) | |
351 @@ -1,2 +1,8 @@ | |
352 a | |
353 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab | |
354 b | |
355 +||||||| base | |
356 +======= | |
357 +b | |
358 +c | |
359 +>>>>>>> source: 7bc217434fc1 - test: abc |