Loading...
Searching...
No Matches
Conflict callback functionality
Working copy management

Interactive conflict handling. More...

## Data Structures

struct | svn_wc_conflict_version_t
| Info about one of the conflicting versions of a node. More...
struct | svn_wc_conflict_description2_t
| A struct that describes a conflict that has occurred in the working copy. More...
struct | svn_wc_conflict_description_t
| Similar to svn_wc_conflict_description2_t, but with relative paths and adm_access batons. More...
struct | svn_wc_conflict_result_t
| The final result returned by svn_wc_conflict_resolver_func_t. More...

## Typedefs

typedef enum svn_wc_conflict_action_t | svn_wc_conflict_action_t
| The type of action being attempted on an object.
typedef enum svn_wc_conflict_reason_t | svn_wc_conflict_reason_t
| The pre-existing condition which is causing a state of conflict.
typedef enum svn_wc_conflict_kind_t | svn_wc_conflict_kind_t
| The type of conflict being described by an svn_wc_conflict_description2_t (see below).
typedef enum svn_wc_operation_t | svn_wc_operation_t
| The user operation that exposed a conflict.
typedef struct svn_wc_conflict_version_t | svn_wc_conflict_version_t
| Info about one of the conflicting versions of a node.
typedef struct svn_wc_conflict_description2_t | svn_wc_conflict_description2_t
| A struct that describes a conflict that has occurred in the working copy.
typedef struct svn_wc_conflict_description_t | svn_wc_conflict_description_t
| Similar to svn_wc_conflict_description2_t, but with relative paths and adm_access batons.
typedef enum svn_wc_conflict_choice_t | svn_wc_conflict_choice_t
| The way in which the conflict callback chooses a course of action.
typedef struct svn_wc_conflict_result_t | svn_wc_conflict_result_t
| The final result returned by svn_wc_conflict_resolver_func_t.
typedef svn_error_t *(* | svn_wc_conflict_resolver_func2_t) (svn_wc_conflict_result_t **result, const svn_wc_conflict_description2_t *description, void *baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
| A callback used in merge, update and switch for resolving conflicts during the application of a tree delta to a working copy.
typedef svn_error_t *(* | svn_wc_conflict_resolver_func_t) (svn_wc_conflict_result_t **result, const svn_wc_conflict_description_t *description, void *baton, apr_pool_t *pool)
| Similar to svn_wc_conflict_resolver_func2_t, but using svn_wc_conflict_description_t instead of svn_wc_conflict_description2_t.

## Enumerations

enum | svn_wc_conflict_action_t { svn_wc_conflict_action_edit , svn_wc_conflict_action_add , svn_wc_conflict_action_delete , svn_wc_conflict_action_replace }
| The type of action being attempted on an object. More...
enum | svn_wc_conflict_reason_t { svn_wc_conflict_reason_edited , svn_wc_conflict_reason_obstructed , svn_wc_conflict_reason_deleted , svn_wc_conflict_reason_missing , svn_wc_conflict_reason_unversioned , svn_wc_conflict_reason_added , svn_wc_conflict_reason_replaced , svn_wc_conflict_reason_moved_away , svn_wc_conflict_reason_moved_here }
| The pre-existing condition which is causing a state of conflict. More...
enum | svn_wc_conflict_kind_t { svn_wc_conflict_kind_text , svn_wc_conflict_kind_property , svn_wc_conflict_kind_tree }
| The type of conflict being described by an svn_wc_conflict_description2_t (see below). More...
enum | svn_wc_operation_t { svn_wc_operation_none = 0 , svn_wc_operation_update , svn_wc_operation_switch , svn_wc_operation_merge }
| The user operation that exposed a conflict. More...
enum | svn_wc_conflict_choice_t { svn_wc_conflict_choose_undefined = -1 , svn_wc_conflict_choose_postpone = 0 , svn_wc_conflict_choose_base , svn_wc_conflict_choose_theirs_full , svn_wc_conflict_choose_mine_full , svn_wc_conflict_choose_theirs_conflict , svn_wc_conflict_choose_mine_conflict , svn_wc_conflict_choose_merged , svn_wc_conflict_choose_unspecified }
| The way in which the conflict callback chooses a course of action. More...

## Functions

svn_wc_conflict_version_t * | svn_wc_conflict_version_create2 (const char *repos_root_url, const char *repos_uuid, const char *repos_relpath, svn_revnum_t revision, svn_node_kind_t kind, apr_pool_t *result_pool)
| Allocate an svn_wc_conflict_version_t structure in pool, initialize to contain a conflict origin, and return it.
svn_wc_conflict_version_t * | svn_wc_conflict_version_create (const char *repos_url, const char *path_in_repos, svn_revnum_t peg_rev, svn_node_kind_t node_kind, apr_pool_t *pool)
| Similar to svn_wc_conflict_version_create2(), but doesn't set all required values.
svn_wc_conflict_version_t * | svn_wc_conflict_version_dup (const svn_wc_conflict_version_t *version, apr_pool_t *pool)
| Return a duplicate of version, allocated in pool.
svn_wc_conflict_description2_t * | svn_wc_conflict_description_create_text2 (const char *local_abspath, apr_pool_t *result_pool)
| Allocate an svn_wc_conflict_description2_t structure in result_pool, initialize to represent a text conflict, and return it.
svn_wc_conflict_description_t * | svn_wc_conflict_description_create_text (const char *path, svn_wc_adm_access_t *adm_access, apr_pool_t *pool)
| Similar to svn_wc_conflict_description_create_text2(), but returns a svn_wc_conflict_description_t *.
svn_wc_conflict_description2_t * | svn_wc_conflict_description_create_prop2 (const char *local_abspath, svn_node_kind_t node_kind, const char *property_name, apr_pool_t *result_pool)
| Allocate an svn_wc_conflict_description2_t structure in result_pool, initialize to represent a property conflict, and return it.
svn_wc_conflict_description_t * | svn_wc_conflict_description_create_prop (const char *path, svn_wc_adm_access_t *adm_access, svn_node_kind_t node_kind, const char *property_name, apr_pool_t *pool)
| Similar to svn_wc_conflict_descriptor_create_prop(), but returns a svn_wc_conflict_description_t *.
svn_wc_conflict_description2_t * | svn_wc_conflict_description_create_tree2 (const char *local_abspath, svn_node_kind_t node_kind, svn_wc_operation_t operation, const svn_wc_conflict_version_t *src_left_version, const svn_wc_conflict_version_t *src_right_version, apr_pool_t *result_pool)
| Allocate an svn_wc_conflict_description2_t structure in pool, initialize to represent a tree conflict, and return it.
svn_wc_conflict_description_t * | svn_wc_conflict_description_create_tree (const char *path, svn_wc_adm_access_t *adm_access, svn_node_kind_t node_kind, svn_wc_operation_t operation, svn_wc_conflict_version_t *src_left_version, svn_wc_conflict_version_t *src_right_version, apr_pool_t *pool)
| Similar to svn_wc_conflict_description_create_tree(), but returns a svn_wc_conflict_description_t *.
svn_wc_conflict_description2_t * | svn_wc_conflict_description2_dup (const svn_wc_conflict_description2_t *conflict, apr_pool_t *result_pool)
| Return a duplicate of conflict, allocated in result_pool.
svn_wc_conflict_description2_t * | svn_wc__conflict_description2_dup (const svn_wc_conflict_description2_t *conflict, apr_pool_t *result_pool)
| Like svn_wc_conflict_description2_dup(), but is improperly named as a private function when it is intended to be a public API.
svn_wc_conflict_result_t * | svn_wc_create_conflict_result (svn_wc_conflict_choice_t choice, const char *merged_file, apr_pool_t *pool)
| Allocate an svn_wc_conflict_result_t structure in pool, initialize and return it.

## Detailed Description

Interactive conflict handling.

This API gives a Subversion client application the opportunity to define a callback that allows the user to resolve conflicts interactively during updates and merges.

If a conflict is discovered, libsvn_wc invokes the callback with an svn_wc_conflict_description_t. This structure describes the path in conflict, whether it's a text or property conflict, and may also present up to three files that can be used to resolve the conflict (perhaps by launching an editor or 3rd-party merging tool). The structure also provides a possible fourth file (`merged_file`) which, if not NULL, represents libsvn_wc's attempt to contextually merge the first three files. (Note that libsvn_wc will not attempt to merge a file that it believes is binary, and it will only attempt to merge property values it believes to be a series of multi-line text.)

When the callback is finished interacting with the user, it responds by returning a svn_wc_conflict_result_t. This structure indicates whether the user wants to postpone the conflict for later (allowing libsvn_wc to mark the path "conflicted" as usual), or whether the user wants libsvn_wc to use one of the four files as the "final" state for resolving the conflict immediately.

Note that the callback is at liberty (and encouraged) to merge the three files itself. If it does so, it signals this to libsvn_wc by returning a choice of svn_wc_conflict_choose_merged. To return the 'final' merged file to libsvn_wc, the callback has the option of either:

- editing the original `merged_file` in-place

  or, if libsvn_wc never supplied a merged_file in the description structure (i.e. passed NULL for that field),

- return the merged file in the svn_wc_conflict_result_t.

## Typedef Documentation

## svn_wc_conflict_action_t

typedef enum svn_wc_conflict_action_t svn_wc_conflict_action_t

The type of action being attempted on an object.

Since
  New in 1.5.

## svn_wc_conflict_choice_t

typedef enum svn_wc_conflict_choice_t svn_wc_conflict_choice_t

The way in which the conflict callback chooses a course of action.

Since
  New in 1.5.

## svn_wc_conflict_description2_t

typedef struct svn_wc_conflict_description2_t svn_wc_conflict_description2_t

A struct that describes a conflict that has occurred in the working copy.

The conflict described by this structure is one of:

- a conflict on the content of the file node local_abspath
- a conflict on the property property_name of local_abspath
- a tree conflict, of which local_abspath is the victim Be aware that the victim of a tree conflict can be a non-existent node. The three kinds of conflict are distinguished by kind.

Note
  Fields may be added to the end of this structure in future versions. Therefore, to preserve binary compatibility, users should not directly allocate structures of this type but should use svn_wc_conflict_description_create_text2() or svn_wc_conflict_description_create_prop2() or svn_wc_conflict_description_create_tree2() instead.

Since
  New in 1.7.

## svn_wc_conflict_description_t

typedef struct svn_wc_conflict_description_t svn_wc_conflict_description_t

Similar to svn_wc_conflict_description2_t, but with relative paths and adm_access batons.

Passed to svn_wc_conflict_resolver_func_t.

Since
  New in 1.5.

Deprecated:
  Provided for backward compatibility with the 1.6 API.

## svn_wc_conflict_kind_t

typedef enum svn_wc_conflict_kind_t svn_wc_conflict_kind_t

The type of conflict being described by an svn_wc_conflict_description2_t (see below).

Since
  New in 1.5.

## svn_wc_conflict_reason_t

typedef enum svn_wc_conflict_reason_t svn_wc_conflict_reason_t

The pre-existing condition which is causing a state of conflict.

Since
  New in 1.5.

## svn_wc_conflict_resolver_func2_t

typedef svn_error_t *(* svn_wc_conflict_resolver_func2_t) (svn_wc_conflict_result_t **result, const svn_wc_conflict_description2_t *description, void *baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool)

A callback used in merge, update and switch for resolving conflicts during the application of a tree delta to a working copy.

description describes the exact nature of the conflict, and provides information to help resolve it. baton is a closure object; it should be provided by the implementation, and passed by the caller. When finished, the callback signals its resolution by returning a structure in *result, which should be allocated in result_pool. (See svn_wc_conflict_result_t.) scratch_pool should be used for any temporary allocations.

The values svn_wc_conflict_choose_mine_conflict and svn_wc_conflict_choose_theirs_conflict are not legal for conflicts in binary files or binary properties.

Implementations of this callback are free to present the conflict using any user interface. This may include simple contextual conflicts in a file's text or properties, or more complex 'tree'-based conflicts related to obstructed additions, deletions, and edits. The callback implementation is free to decide which sorts of conflicts to handle; it's also free to decide which types of conflicts are automatically resolvable and which require user interaction.

Since
  New in 1.7.

Definition at line 2276 of file svn_wc.h.

## svn_wc_conflict_resolver_func_t

typedef svn_error_t *(* svn_wc_conflict_resolver_func_t) (svn_wc_conflict_result_t **result, const svn_wc_conflict_description_t *description, void *baton, apr_pool_t *pool)

Similar to svn_wc_conflict_resolver_func2_t, but using svn_wc_conflict_description_t instead of svn_wc_conflict_description2_t.

Since
  New in 1.5.

Deprecated:
  Provided for backward compatibility with the 1.6 API.

Definition at line 2291 of file svn_wc.h.

## svn_wc_conflict_result_t

typedef struct svn_wc_conflict_result_t svn_wc_conflict_result_t

The final result returned by svn_wc_conflict_resolver_func_t.

Note
  Fields may be added to the end of this structure in future versions. Therefore, to preserve binary compatibility, users should not directly allocate structures of this type. Instead, construct this structure using svn_wc_create_conflict_result() below.

Since
  New in 1.5.

## svn_wc_conflict_version_t

typedef struct svn_wc_conflict_version_t svn_wc_conflict_version_t

Info about one of the conflicting versions of a node.

Each field may have its respective null/invalid/unknown value if the corresponding information is not relevant or not available.

Todo:
  Consider making some or all of the info mandatory, to reduce complexity.

Note
  Fields may be added to the end of this structure in future versions. Therefore, to preserve binary compatibility, users should not directly allocate structures of this type.

See also
  svn_wc_conflict_version_create()
  svn_wc_conflict_version_dup()

Since
  New in 1.6.

## svn_wc_operation_t

typedef enum svn_wc_operation_t svn_wc_operation_t

The user operation that exposed a conflict.

Since
  New in 1.6.

## Enumeration Type Documentation

## svn_wc_conflict_action_t

enum svn_wc_conflict_action_t

The type of action being attempted on an object.

Since
  New in 1.5.

Enumerator
svn_wc_conflict_action_edit | attempting to change text or props
svn_wc_conflict_action_add | attempting to add object
svn_wc_conflict_action_delete | attempting to delete object

svn_wc_conflict_action_replace

attempting to replace object,

Since
  New in 1.7

Definition at line 1623 of file svn_wc.h.

## svn_wc_conflict_choice_t

enum svn_wc_conflict_choice_t

The way in which the conflict callback chooses a course of action.

Since
  New in 1.5.

Enumerator

svn_wc_conflict_choose_undefined

Undefined; for private use only.

This value must never be returned in svn_wc_conflict_result_t, but a separate value, unequal to all other pre-defined values may be useful in conflict resolver implementations to signal that no choice is made yet.

Since
  New in 1.9

svn_wc_conflict_choose_postpone | Don't resolve the conflict now. Let libsvn_wc mark the path 'conflicted', so user can run 'svn resolved' later.
svn_wc_conflict_choose_base | If there were files to choose from, select one as a way of resolving the conflict here and now. libsvn_wc will then do the work of "installing" the chosen file. original version
svn_wc_conflict_choose_theirs_full | incoming version
svn_wc_conflict_choose_mine_full | own version
svn_wc_conflict_choose_theirs_conflict | incoming (for conflicted hunks)
svn_wc_conflict_choose_mine_conflict | own (for conflicted hunks)
svn_wc_conflict_choose_merged | merged version

svn_wc_conflict_choose_unspecified

undecided

Since
  New in 1.8.

Definition at line 2163 of file svn_wc.h.

## svn_wc_conflict_kind_t

enum svn_wc_conflict_kind_t

The type of conflict being described by an svn_wc_conflict_description2_t (see below).

Since
  New in 1.5.

Enumerator
svn_wc_conflict_kind_text | textual conflict (on a file)
svn_wc_conflict_kind_property | property conflict (on a file or dir)

svn_wc_conflict_kind_tree

tree conflict (on a dir)

Since
  New in 1.6.

Definition at line 1666 of file svn_wc.h.

## svn_wc_conflict_reason_t

enum svn_wc_conflict_reason_t

The pre-existing condition which is causing a state of conflict.

Since
  New in 1.5.

Enumerator
svn_wc_conflict_reason_edited | Local edits are already present.
svn_wc_conflict_reason_obstructed | Another object is in the way.
svn_wc_conflict_reason_deleted | Object is already schedule-delete.
svn_wc_conflict_reason_missing | Object is unknown or missing.
svn_wc_conflict_reason_unversioned | Object is unversioned.

svn_wc_conflict_reason_added

Object is already added or schedule-add.

Since
  New in 1.6.

svn_wc_conflict_reason_replaced

Object is already replaced.

Since
  New in 1.7.

svn_wc_conflict_reason_moved_away

Object is moved away.

Since
  New in 1.8.

svn_wc_conflict_reason_moved_here

Object is moved here.

Since
  New in 1.8.

Definition at line 1637 of file svn_wc.h.

## svn_wc_operation_t

enum svn_wc_operation_t

The user operation that exposed a conflict.

Since
  New in 1.6.

Definition at line 1681 of file svn_wc.h.

## Function Documentation

## svn_wc__conflict_description2_dup()

svn_wc_conflict_description2_t * svn_wc__conflict_description2_dup | ( | const svn_wc_conflict_description2_t * | conflict,
|  | apr_pool_t * | result_pool
| ) |  |

Like svn_wc_conflict_description2_dup(), but is improperly named as a private function when it is intended to be a public API.

Since
  New in 1.7.

Deprecated:
  Provided for backward compatibility with the 1.8 API.

## svn_wc_conflict_description2_dup()

svn_wc_conflict_description2_t * svn_wc_conflict_description2_dup | ( | const svn_wc_conflict_description2_t * | conflict,
|  | apr_pool_t * | result_pool
| ) |  |

Return a duplicate of conflict, allocated in result_pool.

A deep copy of all members will be made.

Since
  New in 1.9.

## svn_wc_conflict_description_create_prop()

svn_wc_conflict_description_t * svn_wc_conflict_description_create_prop | ( | const char * | path,
|  | svn_wc_adm_access_t * | adm_access,
|  | svn_node_kind_t | node_kind,
|  | const char * | property_name,
|  | apr_pool_t * | pool
| ) |  |

Similar to svn_wc_conflict_descriptor_create_prop(), but returns a svn_wc_conflict_description_t *.

Since
  New in 1.6.

Deprecated:
  Provided for backward compatibility with the 1.6 API.

## svn_wc_conflict_description_create_prop2()

svn_wc_conflict_description2_t * svn_wc_conflict_description_create_prop2 | ( | const char * | local_abspath,
|  | svn_node_kind_t | node_kind,
|  | const char * | property_name,
|  | apr_pool_t * | result_pool
| ) |  |

Allocate an svn_wc_conflict_description2_t structure in result_pool, initialize to represent a property conflict, and return it.

Set the `local_abspath` field of the created struct to local_abspath (which must be an absolute path), the `kind` field to svn_wc_conflict_kind_property, the `node_kind` to node_kind, and the `property_name` to property_name.

Note
  : It is the caller's responsibility to set the other required fields (such as the four file names and `action` and `reason`).

Since
  New in 1.7.

## svn_wc_conflict_description_create_text()

svn_wc_conflict_description_t * svn_wc_conflict_description_create_text | ( | const char * | path,
|  | svn_wc_adm_access_t * | adm_access,
|  | apr_pool_t * | pool
| ) |  |

Similar to svn_wc_conflict_description_create_text2(), but returns a svn_wc_conflict_description_t *.

Since
  New in 1.6.

Deprecated:
  Provided for backward compatibility with the 1.6 API.

## svn_wc_conflict_description_create_text2()

svn_wc_conflict_description2_t * svn_wc_conflict_description_create_text2 | ( | const char * | local_abspath,
|  | apr_pool_t * | result_pool
| ) |  |

Allocate an svn_wc_conflict_description2_t structure in result_pool, initialize to represent a text conflict, and return it.

Set the `local_abspath` field of the created struct to local_abspath (which must be an absolute path), the `kind` field to svn_wc_conflict_kind_text, the `node_kind` to svn_node_file, the `action` to svn_wc_conflict_action_edit, and the `reason` to svn_wc_conflict_reason_edited.

Note
  It is the caller's responsibility to set the other required fields (such as the four file names and `mime_type` and `is_binary`).

Since
  New in 1.7.

## svn_wc_conflict_description_create_tree()

svn_wc_conflict_description_t * svn_wc_conflict_description_create_tree | ( | const char * | path,
|  | svn_wc_adm_access_t * | adm_access,
|  | svn_node_kind_t | node_kind,
|  | svn_wc_operation_t | operation,
|  | svn_wc_conflict_version_t * | src_left_version,
|  | svn_wc_conflict_version_t * | src_right_version,
|  | apr_pool_t * | pool
| ) |  |

Similar to svn_wc_conflict_description_create_tree(), but returns a svn_wc_conflict_description_t *.

Since
  New in 1.6.

Deprecated:
  Provided for backward compatibility with the 1.6 API.

## svn_wc_conflict_description_create_tree2()

svn_wc_conflict_description2_t * svn_wc_conflict_description_create_tree2 | ( | const char * | local_abspath,
|  | svn_node_kind_t | node_kind,
|  | svn_wc_operation_t | operation,
|  | const svn_wc_conflict_version_t * | src_left_version,
|  | const svn_wc_conflict_version_t * | src_right_version,
|  | apr_pool_t * | result_pool
| ) |  |

Allocate an svn_wc_conflict_description2_t structure in pool, initialize to represent a tree conflict, and return it.

Set the `local_abspath` field of the created struct to local_abspath (which must be an absolute path), the `kind` field to svn_wc_conflict_kind_tree, the `node_kind` to node_kind, the `operation` to operation, the `src_left_version` field to src_left_version, and the `src_right_version` field to src_right_version.

Note
  : It is the caller's responsibility to set the other required fields (such as the four file names and `action` and `reason`).

Since
  New in 1.7.

## svn_wc_conflict_version_create()

svn_wc_conflict_version_t * svn_wc_conflict_version_create | ( | const char * | repos_url,
|  | const char * | path_in_repos,
|  | svn_revnum_t | peg_rev,
|  | svn_node_kind_t | node_kind,
|  | apr_pool_t * | pool
| ) |  |

Similar to svn_wc_conflict_version_create2(), but doesn't set all required values.

Since
  New in 1.6.

Deprecated:
  Provided for backward compatibility with the 1.7 API.

## svn_wc_conflict_version_create2()

svn_wc_conflict_version_t * svn_wc_conflict_version_create2 | ( | const char * | repos_root_url,
|  | const char * | repos_uuid,
|  | const char * | repos_relpath,
|  | svn_revnum_t | revision,
|  | svn_node_kind_t | kind,
|  | apr_pool_t * | result_pool
| ) |  |

Allocate an svn_wc_conflict_version_t structure in pool, initialize to contain a conflict origin, and return it.

Set the `repos_url` field of the created struct to repos_root_url, the `path_in_repos` field to repos_relpath, the `peg_rev` field to revision and the `node_kind` to kind. Make only shallow copies of the pointer arguments.

repos_root_url, repos_relpath and revision must be valid, non-null values. repos_uuid should be a valid UUID, but can be NULL if unknown. kind can be any kind, even 'none' or 'unknown'.

Since
  New in 1.8.

## svn_wc_conflict_version_dup()

svn_wc_conflict_version_t * svn_wc_conflict_version_dup | ( | const svn_wc_conflict_version_t * | version,
|  | apr_pool_t * | pool
| ) |  |

Return a duplicate of version, allocated in pool.

No part of the new version will be shared with version.

Since
  New in 1.6.

## svn_wc_create_conflict_result()

svn_wc_conflict_result_t * svn_wc_create_conflict_result | ( | svn_wc_conflict_choice_t | choice,
|  | const char * | merged_file,
|  | apr_pool_t * | pool
| ) |  |

Allocate an svn_wc_conflict_result_t structure in pool, initialize and return it.

Set the `choice` field of the structure to choice, `merged_file` to merged_file, and `save_merged` to false. Make only a shallow copy of the pointer argument merged_file. merged_file may be NULL if setting merged_file is not needed.

Since
  New in 1.5.