Previous: Tree, Up: Tree


5.1.1 Conflicts

The conflicts set of commands is used to specify conflict resolutions for merges, asynchronously from the merge command itself. This lets the user take as much time as needed to prepare all the conflict resolutions, and avoids losing work when a merge is aborted due to a complicated conflict.

These commands require a workspace, to provide a place to store the conflicts and user resolution files.

For all of these commands, if the --conflicts-file option is not given, the file _MTN/conflicts is used. If the --conflicts-file option is given, the file must be in the bookkeeping directory.

Files given in these commands are relative to the current working directory, or absolute. In the conflict file, they are relative to the workspace root, or absolute.

Commands

mtn conflicts --conflicts-file=file store left_rev_id right_rev_id
Store the conflicts encountered by merging left_rev_id with right_rev_id, in the specified file.

If left_rev_id and right_rev_id are not given, the first two heads that the merge command would merge are used.

The conflicts file format is as output by the automate show_conflicts command; see See Automation.

Content conflicts that can be resolved by the internal line merger have resolutions, so they will not show up in subsequent show_first commands.

mtn conflicts --conflicts-file=file show_first
Show the first unresolved conflict in the conflicts file, and list the possible resolutions.
mtn conflicts --conflicts-file=file show_remaining
Show remaining unresolved conflicts in the conflicts file.
mtn conflicts --conflicts-file=file resolve_first resolution
Specify a resolution for the first conflict in the conflicts file; it must be a single file conflict. The conflicts file is updated.
mtn conflicts --conflicts-file=file resolve_first_left resolution
mtn conflicts --conflicts-file=file resolve_first_right resolution
Specify a resolution for one of the files in the first conflict in the conflicts file; it must be a two file conflict. The conflicts file is updated.
mtn conflicts clean
Delete the default conflicts file _MTN/conflicts, and the directory _MTN/resolutions. Users may store conflict resolution files in _MTN/resolutions; this command provides a convenient way to clean up.

Single file conflict resolutions

For single file conflicts, there are several possible resolutions:

interactive file
The Lua merge3 hook is called to allow the user to manually merge the left and right files, leaving the result in the specified file.

file must be a bookkeeping path; under _MTN.

This inserts a resolved_user file conflict resolution in the conflicts file.

user file
The file contents are replaced by the contents of the specified file.

This inserts a resolved_user file conflict resolution in the conflicts file.

drop
The file is dropped in the merge. This is useful for an orphaned file conflict.

This inserts a resolved_drop_left conflict resolution in the conflicts file.

rename filename
The file is renamed. This is useful for an orphaned file conflict.

This inserts a resolved_rename_left filename conflict resolution in the conflicts file.

Two file conflict resolutions

For two file conflicts, the possible resolutions are:

drop
The file is dropped in the merge.

This inserts a resolved_drop_left or resolved_drop_right conflict resolution in the conflicts file.

keep
The file is kept in the merge.

This inserts a resolved_keep_left or resolved_keep_right conflict resolution in the conflicts file.

rename filename
The file is renamed.

This inserts a resolved_rename_left filename or resolved_rename_right filename conflict resolution in the conflicts file.

user file
The file contents are replaced by the contents of the specified file. The other file in the conflict must be dropped or renamed.

This inserts a resolved_user_left file or resolved_user_right file conflict resolution in the conflicts file.

monotone internals note: we don't provide an interactive resolution for two-file conflicts, because monotone currently does not provide a merge2 Lua hook. two-file conflicts don't have a shared ancestor, so merge3 is not applicable.