2010-10-01 18:10:06 +04:00
|
|
|
$ cat >> $HGRCPATH <<EOF
|
2015-10-20 04:14:36 +03:00
|
|
|
> [format]
|
|
|
|
> usegeneraldelta=yes
|
2010-10-01 18:10:06 +04:00
|
|
|
> [extensions]
|
|
|
|
> rebase=
|
2017-06-24 20:31:41 +03:00
|
|
|
> drawdag=$TESTDIR/drawdag.py
|
2010-10-01 18:10:06 +04:00
|
|
|
>
|
2011-12-27 03:11:22 +04:00
|
|
|
> [phases]
|
|
|
|
> publish=False
|
|
|
|
>
|
2010-10-01 18:10:06 +04:00
|
|
|
> [alias]
|
2013-03-12 02:37:28 +04:00
|
|
|
> tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
|
2010-10-01 18:10:06 +04:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg init a
|
|
|
|
$ cd a
|
|
|
|
$ echo c1 >common
|
|
|
|
$ hg add common
|
|
|
|
$ hg ci -m C1
|
|
|
|
|
|
|
|
$ echo c2 >>common
|
|
|
|
$ hg ci -m C2
|
|
|
|
|
|
|
|
$ echo c3 >>common
|
|
|
|
$ hg ci -m C3
|
|
|
|
|
|
|
|
$ hg up -q -C 1
|
|
|
|
|
|
|
|
$ echo l1 >>extra
|
|
|
|
$ hg add extra
|
|
|
|
$ hg ci -m L1
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ sed -e 's/c2/l2/' common > common.new
|
|
|
|
$ mv common.new common
|
|
|
|
$ hg ci -m L2
|
|
|
|
|
|
|
|
$ echo l3 >> extra2
|
|
|
|
$ hg add extra2
|
|
|
|
$ hg ci -m L3
|
2013-03-12 02:37:28 +04:00
|
|
|
$ hg bookmark mybook
|
2010-10-01 18:10:06 +04:00
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
$ hg phase --force --secret 4
|
|
|
|
|
2010-10-01 18:10:06 +04:00
|
|
|
$ hg tglog
|
2013-03-12 02:37:28 +04:00
|
|
|
@ 5:secret 'L3' mybook
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 4:secret 'L2'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 3:draft 'L1'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
| o 2:draft 'C3'
|
2010-10-01 18:10:06 +04:00
|
|
|
|/
|
2012-01-17 12:12:14 +04:00
|
|
|
o 1:draft 'C2'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 0:draft 'C1'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
Try to call --continue:
|
|
|
|
|
|
|
|
$ hg rebase --continue
|
|
|
|
abort: no rebase in progress
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Conflicting rebase:
|
|
|
|
|
|
|
|
$ hg rebase -s 3 -d 2
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 3:3163e20567cc "L1"
|
|
|
|
rebasing 4:46f0b057b5c0 "L2"
|
2010-10-01 18:10:06 +04:00
|
|
|
merging common
|
2015-10-09 23:54:52 +03:00
|
|
|
warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
|
2013-02-09 02:27:59 +04:00
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
2013-02-09 02:17:46 +04:00
|
|
|
[1]
|
2010-10-01 18:10:06 +04:00
|
|
|
|
2017-08-03 02:42:35 +03:00
|
|
|
$ hg status --config commands.status.verbose=1
|
|
|
|
M common
|
|
|
|
? common.orig
|
|
|
|
# The repository is in an unfinished *rebase* state.
|
|
|
|
|
|
|
|
# Unresolved merge conflicts:
|
|
|
|
#
|
|
|
|
# common
|
|
|
|
#
|
|
|
|
# To mark files as resolved: hg resolve --mark FILE
|
|
|
|
|
|
|
|
# To continue: hg rebase --continue
|
|
|
|
# To abort: hg rebase --abort
|
|
|
|
|
|
|
|
|
2010-10-01 18:10:06 +04:00
|
|
|
Try to continue without solving the conflict:
|
|
|
|
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg rebase --continue
|
2016-09-21 02:48:08 +03:00
|
|
|
abort: unresolved merge conflicts (see 'hg help resolve')
|
2010-10-01 18:10:06 +04:00
|
|
|
[255]
|
|
|
|
|
|
|
|
Conclude rebase:
|
|
|
|
|
|
|
|
$ echo 'resolved merge' >common
|
|
|
|
$ hg resolve -m common
|
2014-07-26 05:32:49 +04:00
|
|
|
(no more unresolved files)
|
2015-12-24 23:41:40 +03:00
|
|
|
continue: hg rebase --continue
|
2010-10-01 18:10:06 +04:00
|
|
|
$ hg rebase --continue
|
2014-12-09 05:45:26 +03:00
|
|
|
already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
|
|
|
|
rebasing 4:46f0b057b5c0 "L2"
|
|
|
|
rebasing 5:8029388f38dc "L3" (mybook)
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
2013-03-12 02:37:28 +04:00
|
|
|
@ 5:secret 'L3' mybook
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 4:secret 'L2'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 3:draft 'L1'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 2:draft 'C3'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 1:draft 'C2'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
o 0:draft 'C1'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
Check correctness:
|
|
|
|
|
|
|
|
$ hg cat -r 0 common
|
|
|
|
c1
|
|
|
|
|
|
|
|
$ hg cat -r 1 common
|
|
|
|
c1
|
|
|
|
c2
|
|
|
|
|
|
|
|
$ hg cat -r 2 common
|
|
|
|
c1
|
|
|
|
c2
|
|
|
|
c3
|
|
|
|
|
|
|
|
$ hg cat -r 3 common
|
|
|
|
c1
|
|
|
|
c2
|
|
|
|
c3
|
|
|
|
|
|
|
|
$ hg cat -r 4 common
|
|
|
|
resolved merge
|
|
|
|
|
|
|
|
$ hg cat -r 5 common
|
|
|
|
resolved merge
|
|
|
|
|
2013-03-12 02:37:28 +04:00
|
|
|
Bookmark stays active after --continue
|
|
|
|
$ hg bookmarks
|
|
|
|
* mybook 5:d67b21408fc0
|
|
|
|
|
2012-06-11 03:40:51 +04:00
|
|
|
$ cd ..
|
2013-10-30 22:45:14 +04:00
|
|
|
|
|
|
|
Check that the right ancestors is used while rebasing a merge (issue4041)
|
|
|
|
|
|
|
|
$ hg clone "$TESTDIR/bundles/issue4041.hg" issue4041
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 11 changesets with 8 changes to 3 files (+1 heads)
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 24797d4f68de:2f2496ddf49d
|
2013-10-30 22:45:14 +04:00
|
|
|
updating to branch default
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd issue4041
|
|
|
|
$ hg log -G
|
|
|
|
o changeset: 10:2f2496ddf49d
|
|
|
|
|\ branch: f1
|
|
|
|
| | tag: tip
|
|
|
|
| | parent: 7:4c9fbe56a16f
|
|
|
|
| | parent: 9:e31216eec445
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Thu Sep 05 12:59:39 2013 -0400
|
|
|
|
| | summary: merge
|
|
|
|
| |
|
|
|
|
| o changeset: 9:e31216eec445
|
|
|
|
| | branch: f1
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Thu Sep 05 12:59:10 2013 -0400
|
|
|
|
| | summary: more changes to f1
|
|
|
|
| |
|
|
|
|
| o changeset: 8:8e4e2c1a07ae
|
|
|
|
| |\ branch: f1
|
|
|
|
| | | parent: 2:4bc80088dc6b
|
|
|
|
| | | parent: 6:400110238667
|
|
|
|
| | | user: szhang
|
|
|
|
| | | date: Thu Sep 05 12:57:59 2013 -0400
|
|
|
|
| | | summary: bad merge
|
|
|
|
| | |
|
|
|
|
o | | changeset: 7:4c9fbe56a16f
|
|
|
|
|/ / branch: f1
|
|
|
|
| | parent: 2:4bc80088dc6b
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Thu Sep 05 12:54:00 2013 -0400
|
|
|
|
| | summary: changed f1
|
|
|
|
| |
|
|
|
|
| o changeset: 6:400110238667
|
|
|
|
| | branch: f2
|
|
|
|
| | parent: 4:12e8ec6bb010
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Tue Sep 03 13:58:02 2013 -0400
|
|
|
|
| | summary: changed f2 on f2
|
|
|
|
| |
|
|
|
|
| | @ changeset: 5:d79e2059b5c0
|
|
|
|
| | | parent: 3:8a951942e016
|
|
|
|
| | | user: szhang
|
|
|
|
| | | date: Tue Sep 03 13:57:39 2013 -0400
|
|
|
|
| | | summary: changed f2 on default
|
|
|
|
| | |
|
|
|
|
| o | changeset: 4:12e8ec6bb010
|
|
|
|
| |/ branch: f2
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Tue Sep 03 13:57:18 2013 -0400
|
|
|
|
| | summary: created f2 branch
|
|
|
|
| |
|
|
|
|
| o changeset: 3:8a951942e016
|
|
|
|
| | parent: 0:24797d4f68de
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Tue Sep 03 13:57:11 2013 -0400
|
|
|
|
| | summary: added f2.txt
|
|
|
|
| |
|
|
|
|
o | changeset: 2:4bc80088dc6b
|
|
|
|
| | branch: f1
|
|
|
|
| | user: szhang
|
|
|
|
| | date: Tue Sep 03 13:56:20 2013 -0400
|
|
|
|
| | summary: added f1.txt
|
|
|
|
| |
|
|
|
|
o | changeset: 1:ef53c9e6b608
|
|
|
|
|/ branch: f1
|
|
|
|
| user: szhang
|
|
|
|
| date: Tue Sep 03 13:55:26 2013 -0400
|
|
|
|
| summary: created f1 branch
|
|
|
|
|
|
|
|
|
o changeset: 0:24797d4f68de
|
|
|
|
user: szhang
|
|
|
|
date: Tue Sep 03 13:55:08 2013 -0400
|
|
|
|
summary: added default.txt
|
|
|
|
|
|
|
|
$ hg rebase -s9 -d2 --debug # use debug to really check merge base used
|
2016-09-13 23:49:42 +03:00
|
|
|
rebase onto 4bc80088dc6b starting from e31216eec445
|
2017-12-11 09:39:46 +03:00
|
|
|
rebasing on disk
|
2017-03-08 03:30:31 +03:00
|
|
|
rebase status stored
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 9:e31216eec445 "more changes to f1"
|
2013-10-30 22:45:14 +04:00
|
|
|
future parents are 2 and -1
|
2017-06-27 18:40:24 +03:00
|
|
|
rebase status stored
|
2013-10-30 22:45:14 +04:00
|
|
|
update to 2:4bc80088dc6b
|
|
|
|
resolving manifests
|
|
|
|
branchmerge: False, force: True, partial: False
|
|
|
|
ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
|
|
|
|
f2.txt: other deleted -> r
|
|
|
|
removing f2.txt
|
2014-04-22 04:10:25 +04:00
|
|
|
f1.txt: remote created -> g
|
2013-10-30 22:45:14 +04:00
|
|
|
getting f1.txt
|
|
|
|
merge against 9:e31216eec445
|
|
|
|
detach base 8:8e4e2c1a07ae
|
|
|
|
searching for copies back to rev 3
|
2016-10-13 03:19:43 +03:00
|
|
|
unmatched files in other (from topological common ancestor):
|
|
|
|
f2.txt
|
2013-10-30 22:45:14 +04:00
|
|
|
resolving manifests
|
|
|
|
branchmerge: True, force: True, partial: False
|
|
|
|
ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
|
|
|
|
f1.txt: remote is newer -> g
|
|
|
|
getting f1.txt
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2013-10-30 22:45:14 +04:00
|
|
|
f1.txt
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2017-06-30 01:21:52 +03:00
|
|
|
updating the branch cache
|
2014-12-10 08:20:35 +03:00
|
|
|
rebased as 19c888675e13
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 10:2f2496ddf49d "merge" (tip)
|
2013-10-30 22:45:14 +04:00
|
|
|
future parents are 11 and 7
|
2017-06-27 18:40:24 +03:00
|
|
|
rebase status stored
|
2017-05-12 08:38:15 +03:00
|
|
|
already in destination
|
2013-10-30 22:45:14 +04:00
|
|
|
merge against 10:2f2496ddf49d
|
|
|
|
detach base 9:e31216eec445
|
|
|
|
searching for copies back to rev 3
|
2016-10-13 03:19:43 +03:00
|
|
|
unmatched files in other (from topological common ancestor):
|
|
|
|
f2.txt
|
2013-10-30 22:45:14 +04:00
|
|
|
resolving manifests
|
|
|
|
branchmerge: True, force: True, partial: False
|
|
|
|
ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
|
|
|
|
f1.txt: remote is newer -> g
|
|
|
|
getting f1.txt
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2013-10-30 22:45:14 +04:00
|
|
|
f1.txt
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2017-06-30 01:21:52 +03:00
|
|
|
updating the branch cache
|
2014-12-10 08:20:35 +03:00
|
|
|
rebased as 2a7f09cac94c
|
2013-10-30 22:45:14 +04:00
|
|
|
rebase merging completed
|
|
|
|
update back to initial working directory parent
|
|
|
|
resolving manifests
|
|
|
|
branchmerge: False, force: False, partial: False
|
|
|
|
ancestor: 2a7f09cac94c, local: 2a7f09cac94c+, remote: d79e2059b5c0
|
|
|
|
f1.txt: other deleted -> r
|
|
|
|
removing f1.txt
|
2014-04-22 04:10:25 +04:00
|
|
|
f2.txt: remote created -> g
|
2013-10-30 22:45:14 +04:00
|
|
|
getting f2.txt
|
2015-06-29 21:20:09 +03:00
|
|
|
2 changesets found
|
2013-10-30 22:45:14 +04:00
|
|
|
list of changesets:
|
|
|
|
e31216eec445e44352c5f01588856059466a24c9
|
|
|
|
2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
|
2017-06-15 10:15:52 +03:00
|
|
|
bundle2-output-bundle: "HG20", (1 params) 2 parts total
|
2016-07-18 01:13:51 +03:00
|
|
|
bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
|
2017-06-15 10:15:52 +03:00
|
|
|
bundle2-output-part: "phase-heads" 24 bytes payload
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
|
2013-10-30 22:45:14 +04:00
|
|
|
3 changesets found
|
|
|
|
list of changesets:
|
|
|
|
4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
|
|
|
|
19c888675e133ab5dff84516926a65672eaf04d9
|
|
|
|
2a7f09cac94c7f4b73ebd5cd1a62d3b2e8e336bf
|
2017-06-15 10:15:52 +03:00
|
|
|
bundle2-output-bundle: "HG20", 2 parts total
|
2016-07-18 01:13:51 +03:00
|
|
|
bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
|
2017-06-15 10:15:52 +03:00
|
|
|
bundle2-output-part: "phase-heads" 24 bytes payload
|
2013-10-30 22:45:14 +04:00
|
|
|
adding branch
|
2015-10-20 04:14:36 +03:00
|
|
|
bundle2-input-bundle: with-transaction
|
2016-07-18 01:13:51 +03:00
|
|
|
bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
|
2013-10-30 22:45:14 +04:00
|
|
|
adding changesets
|
|
|
|
add changeset 4c9fbe56a16f
|
|
|
|
add changeset 19c888675e13
|
|
|
|
add changeset 2a7f09cac94c
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
adding f1.txt revisions
|
|
|
|
added 2 changesets with 2 changes to 1 files
|
2016-10-14 02:31:11 +03:00
|
|
|
bundle2-input-part: total payload size 1686
|
2017-06-15 10:15:52 +03:00
|
|
|
bundle2-input-part: "phase-heads" supported
|
|
|
|
bundle2-input-part: total payload size 24
|
|
|
|
bundle2-input-bundle: 1 parts total
|
2017-05-02 23:27:44 +03:00
|
|
|
updating the branch cache
|
2013-10-30 22:45:14 +04:00
|
|
|
invalid branchheads cache (served): tip differs
|
|
|
|
rebase completed
|
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 3d22d20aa950.
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.
2016-02-10 20:06:08 +03:00
|
|
|
|
|
|
|
Test minimization of merge conflicts
|
|
|
|
$ hg up -q null
|
|
|
|
$ echo a > a
|
|
|
|
$ hg add a
|
|
|
|
$ hg commit -q -m 'a'
|
|
|
|
$ echo b >> a
|
|
|
|
$ hg commit -q -m 'ab'
|
|
|
|
$ hg bookmark ab
|
|
|
|
$ hg up -q '.^'
|
|
|
|
$ echo b >> a
|
|
|
|
$ echo c >> a
|
|
|
|
$ hg commit -q -m 'abc'
|
|
|
|
$ hg rebase -s 7bc217434fc1 -d ab --keep
|
|
|
|
rebasing 13:7bc217434fc1 "abc" (tip)
|
|
|
|
merging a
|
|
|
|
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
|
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
$ hg diff
|
|
|
|
diff -r 328e4ab1f7cc a
|
|
|
|
--- a/a Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/a * (glob)
|
|
|
|
@@ -1,2 +1,6 @@
|
|
|
|
a
|
|
|
|
b
|
2016-11-20 02:41:37 +03:00
|
|
|
+<<<<<<< dest: 328e4ab1f7cc ab - test: ab
|
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 3d22d20aa950.
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.
2016-02-10 20:06:08 +03:00
|
|
|
+=======
|
|
|
|
+c
|
|
|
|
+>>>>>>> source: 7bc217434fc1 - test: abc
|
|
|
|
$ hg rebase --abort
|
|
|
|
rebase aborted
|
|
|
|
$ hg up -q -C 7bc217434fc1
|
|
|
|
$ hg rebase -s . -d ab --keep -t internal:merge3
|
|
|
|
rebasing 13:7bc217434fc1 "abc" (tip)
|
|
|
|
merging a
|
|
|
|
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
|
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
$ hg diff
|
|
|
|
diff -r 328e4ab1f7cc a
|
|
|
|
--- a/a Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/a * (glob)
|
|
|
|
@@ -1,2 +1,8 @@
|
|
|
|
a
|
2016-11-20 02:41:37 +03:00
|
|
|
+<<<<<<< dest: 328e4ab1f7cc ab - test: ab
|
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 3d22d20aa950.
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.
2016-02-10 20:06:08 +03:00
|
|
|
b
|
|
|
|
+||||||| base
|
|
|
|
+=======
|
|
|
|
+b
|
|
|
|
+c
|
|
|
|
+>>>>>>> source: 7bc217434fc1 - test: abc
|
2017-06-24 20:31:41 +03:00
|
|
|
|
|
|
|
Test rebase with obsstore turned on and off (issue5606)
|
|
|
|
|
|
|
|
$ cd $TESTTMP
|
|
|
|
$ hg init b
|
|
|
|
$ cd b
|
|
|
|
$ hg debugdrawdag <<'EOS'
|
|
|
|
> D
|
|
|
|
> |
|
|
|
|
> C
|
|
|
|
> |
|
|
|
|
> B E
|
|
|
|
> |/
|
|
|
|
> A
|
|
|
|
> EOS
|
|
|
|
|
|
|
|
$ hg update E -q
|
|
|
|
$ echo 3 > B
|
|
|
|
$ hg commit --amend -m E -A B -q
|
2017-10-17 12:29:26 +03:00
|
|
|
$ hg rebase -r B+D -d . --config experimental.evolution=true
|
2017-06-24 20:31:41 +03:00
|
|
|
rebasing 1:112478962961 "B" (B)
|
|
|
|
merging B
|
|
|
|
warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
|
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
|
|
|
|
|
|
|
$ echo 4 > B
|
|
|
|
$ hg resolve -m
|
|
|
|
(no more unresolved files)
|
|
|
|
continue: hg rebase --continue
|
2017-10-17 12:29:26 +03:00
|
|
|
$ hg rebase --continue --config experimental.evolution=none
|
2017-06-24 20:31:41 +03:00
|
|
|
rebasing 1:112478962961 "B" (B)
|
|
|
|
rebasing 3:f585351a92f8 "D" (D)
|
2017-07-08 04:51:46 +03:00
|
|
|
warning: orphaned descendants detected, not stripping 112478962961
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
|
2017-06-24 20:31:41 +03:00
|
|
|
|
|
|
|
$ rm .hg/localtags
|
|
|
|
$ hg tglog
|
2017-07-08 04:51:46 +03:00
|
|
|
o 5:draft 'D'
|
2017-06-24 20:31:41 +03:00
|
|
|
|
|
2017-07-08 04:51:46 +03:00
|
|
|
o 4:draft 'B'
|
2017-06-24 20:31:41 +03:00
|
|
|
|
|
2017-07-08 04:51:46 +03:00
|
|
|
@ 3:draft 'E'
|
2017-06-24 20:31:41 +03:00
|
|
|
|
|
2017-07-08 04:51:46 +03:00
|
|
|
| o 2:draft 'C'
|
|
|
|
| |
|
|
|
|
| o 1:draft 'B'
|
|
|
|
|/
|
2017-06-24 20:31:41 +03:00
|
|
|
o 0:draft 'A'
|
|
|
|
|