Previous: , Up: Tree   [Contents][Index]


4.2.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. See Merge Conflicts.

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.

The commands are listed in the order they are typically used, not in alphabetical order. Then the conflict resolutions are discussed.

Commands

mtn conflicts store [--conflicts-file=file] [left_rev_id right_rev_id]

Store the conflicts encountered by merging left_rev_id with right_rev_id, in the specified file (defaults to _MTN/conflicts. 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 mtn automate show_conflicts.

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 show_first [--conflicts-file=file]

Show the first unresolved conflict in the conflicts file, and list the possible resolutions.

mtn conflicts show_remaining [--conflicts-file=file]

Show remaining unresolved conflicts in the conflicts file.

mtn conflicts resolve_first [--conflicts-file=file] 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 resolve_first_left [--conflicts-file=file] resolution
mtn conflicts resolve_first_right [--conflicts-file=file] 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. Note that resolved_user_left is used even for single file conflicts.

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. If not specified, file defaults to _MTN/resolutions/<path>, where <path> is the path to the file that has the conflict.

This inserts a resolved_user_left 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_left 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.


Previous: , Up: Tree   [Contents][Index]