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 (revision ids; see Selectors), 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.

Conflict resolutions

For single and two file conflicts, there are several possible resolutions. In the conflicts file, resolved_user_left is used 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 or resolved_user_right 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 or resolved_user_right file conflict resolution in the conflicts file.

drop

The file is dropped in the merge.

This inserts a resolved_drop_left or resolved_drop_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_rename contents_file rename_file

The file contents are replaced by the contents of the specified file, and renamed.

This inserts a resolved_user_left contents_file or resolved_user_right contents_file conflict resolution in the conflicts file, and a resolved_rename_left rename_file or resolved_rename_right rename_file conflict resolution.

keep

The file is kept in the merge.

This inserts a resolved_keep_left or resolved_keep_right 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]

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status