Jox
Jox

Reputation: 7172

Completely manual Mercurial merge

Is there any way to take complete manual control over the merge process in Mercurial?

I want to be able to choose direction of file-merge, even for files without conflicts. Is that possible?

Upvotes: 19

Views: 9248

Answers (4)

Nikita
Nikita

Reputation: 399

In case of KDiff3 it is vital to add option --qall (see http://kdiff3.sourceforge.net/doc/documentation.html). There will be an automatic merge of some conflicts without this key (like "Automatically Solve Simple Conflicts" from "Merge" menu). Thus the more proper command line is:

[ui]
merge = kdiff3

[merge-tools]
kdiff3.premerge = False
kdiff3.args=$base $local $other -o $output --L1 base --L2 local --L3 other --qall

Upvotes: 1

Eduardo
Eduardo

Reputation: 5933

Edit your configuration file this way:

[ui]
merge = kdiff3

[merge-tools]
kdiff3.premerge = false
kdiff3.args=--L1 base --L2 local --L3 other $base $local $other -o $output

By default it puts the --auto argument on kdiff3 so kdiff3 auto merges.

Upvotes: 12

Ry4an Brase
Ry4an Brase

Reputation: 78330

Turn "pre-merge" off in your merge configuration. Then everything counts as a conflict and you can pick "left" or "right" for each and every file change.

[merge-tools]
mymergetool.premerge = False

from MergeToolConfiguration on the Mercurial wiki.

Upvotes: 20

David Webb
David Webb

Reputation: 193696

A merge is always performed between the working directory's parent revision and another revision, by default the other head in your repository.

If you want to merge in the other "direction" you can change which branch is in your working directory by checking out a specific revision:

hg update -r [rev]

To see which heads you have in your repository run the following command:

hg heads

Alternatively, if you're using fetch you can use the --switch-parent option to merge in the other direction:

hg fetch --switch-parent

You can't change the direction of the merge on a file-by-file basis as Mercurial works with changesets which affect a whole repository not by tracking changes on to individual files like CVS.

Upvotes: 2

Related Questions