Skip to main content

Resolving a property conflict

A property conflict can occur when two users in parallel edit the same versioned property (a property with the same name attached to the same item within a branch) in mutually contradicting ways.

Subversion’s versioned properties allow users to attach arbitrary versioned metadata to files or directories. For example, users might occasionally set or change standard properties such as svn:ignore and svn:global-ignores on a directory (see Ignoring Unversioned Items). Or users might set completely custom versioned properties with an arbitrary name and value.

Changes that users make to versioned properties are tracked and recorded in the version history, just like other changes made in versioned files and directories. And just like changes made to a file’s contents, parallel changes made by users to versioned properties can contradict each other, resulting in a conflict.

Property conflicts cannot occur in unversioned properties (such as svn:log), which are attached to revisions, not to files or directories.

Regardless of the operation (a merge, update or switch) during which the conflict occurred, the effects of conflicts and the ways to resolve them are essentially the same.

Example of a property conflict

Changes on your feature branch

Suppose that you have created a new feature branch called my_property_test and switched your working copy to reflect that branch. Suppose that the root directory of your project contains a subdirectory called docs.

Suppose that you want to set a versioned property named example_property on that docs subdirectory, and want to set the value of this property to be Foo:

C:\Users\Alex\my_work_dir> svn propset example_property "Foo" docs

Then you commit this change.

The svn propset command allows you to set the property with the specified name and value on any specified target path in the working copy. You can set properties on any specified directories (including the working copy’s root) or files in the working copy. If the property with this name already exists on that target path, svn propset overwrites the existing property’s current value with the new value specified in the command.

If you are using TortoiseSVN, see the Subversion Properties section in its documentation for information about setting or viewing versioned properties with TortoiseSVN.

During normal use, you must never set or edit the svn:mergeinfo property, which is reserved for internal use by Subversion.

Changes on the trunk

Suppose that in the meantime, after you created your my_property_test branch, your teammate sets a property with the same name (i.e. example_property) on the docs subdirectory inside the trunk, but sets its value to be Boo.

That teammate does this by setting a property with the same name example_property on the docs subdirectory in their working copy reflecting the trunk:

C:\Users\Jamie\another_work_dir> svn propset example_property "Boo" docs

And your teammate commits that change to the trunk.

Syncing the feature branch

Now if you perform a sync merge from the trunk into your working copy reflecting the my_property_test branch, Subversion will inform you that there is a conflict:

...
Property conflicts: 1
Conflict for property 'example_property' discovered on 'docs'.
local add, incoming add upon merge

This is a contradicting-change conflict that occurred because your change and your teammate’s change both affect the same property (example_property) set on the same path (on the docs subdirectory) and contradict each other.

Postponing conflict resolution

You can choose to postpone conflict resolution, by entering p (for “postpone”) when prompted. This lets the current command (such as a merge or an update) finish. Then you can examine the conflicted items in the working copy one by one, and resolve these conflicts at a convenient pace.

Resolving a property conflict

Identifying the conflicted directory or file

To see which items in the working copy currently have unresolved conflicts, display the status of the working copy:

C:\Users\Alex\my_work_dir> svn status
M .
C docs
? docs\dir_conflicts.prej
Summary of conflicts:
Property conflicts: 1

A C in the second column is displayed next to the object that has a conflicted property attached. Since the working copy contains a conflict in a versioned property, there is also a new unversioned auxiliary file with the .prej extension, which provides details about the competing versions of the property.

Resolving interactively

For property conflicts, interactive resolution options are rather limited. Subversion currently does not support line-based merging of user-edited properties. To use interactive resolution, run the svn resolve command on the conflicted item:

C:\Users\Alex\my_work_dir> svn resolve docs

You can then enter dc (display conflict) to view details about the conflict. And you can resolve the displayed conflict by accepting the incoming version or your version of the conflicted property, by entering tf or mf respectively. To quit without resolving, enter q or p.

Resolving manually

A more flexible way is to resolve the property conflict manually and mark it as resolved.

To decide how to resolve the property conflict, you should first view the details about the conflict. You can use dc (display conflict) in the interactive resolver or you can simply examine the contents of the .prej file.

In this case, the dir_conflicts.prej file in the docs directory will contain the following:

Trying to add new property 'example_property'
but the property already exists.
<<<<<<< (local property value)
Foo||||||| (incoming 'changed from' value)
=======
Boo>>>>>>> (incoming 'changed to' value)

Then you need to set or edit the value of the conflicted property in the working copy to the desired state. You might decide that this property’s current value is already what you want, or may set a different value with the svn propset command just like you did previously.

Suppose that you want to keep both your teammate Jamie’s and your values in that example_property. Then it may be more convenient to edit and save the property’s value via a text editor:

C:\Users\Alex\my_work_dir> svn propedit example_property docs --editor-cmd Notepad

The --editor-cmd COMMAND option lets you specify the command to launch a text editor. In this case it launches Notepad on Windows. On Linux, you may specify your preferred editor, e.g. nano, gedit or vim. On macOS, the COMMAND may be "open -f" to open TextEdit.

To verify the property’s current value in the working copy, you can display it:

C:\Users\Alex\my_work_dir> svn propget example_property docs
Foo
Boo

Once the current value is what you want, use the svn resolve command on the path that has the conflicted property, to mark the conflict as manually resolved using the property’s current value:

C:\Users\Alex\my_work_dir> svn resolve docs --accept working

In the TortoiseSVN GUI, to mark a conflict as manually resolved, right-click at the root of your working copy, select TortoiseSVN | Check for modifications, then right-click the conflicted item and select Resolved.

Now you can commit the results of the sync merge:

C:\Users\Alex\my_work_dir> svn commit -m "On my_property_test: merged changes from the trunk."