Over a million developers have joined DZone.

Resolving Conflicts in Subversion

· DevOps Zone

The DevOps zone is brought to you in partnership with Sonatype Nexus. The Nexus suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

When you’re committing changes to Apache Subversion’s central repository, you may occasionally encounter a conflict which will cause your commit to fail.

resolving conflict

You’ll be unable to commit any changes to the repository until you’ve resolved all the conflicts. The good news is that Apache Subversion has all the functionality needed to quickly resolve whatever conflicts you may encounter.

1) Perform an Update

It’s possible that the changes you’ve made and the changes that have already been committed affect different parts of the conflicted file. Therefore, the first step is to perform an svn update:

svn update (path)

Subversion will then try and merge the changes from the server into your working copy, without overriding any of your local changes. If the changes affect different areas of the file, the server will merge the changes and you’ll be able to perform your commit. However, if you’ve modified the same sections of the file (e.g the same lines in a text file), Subversion will be unable to automatically merge the changes and the command line window will present you with several options to resolve the conflict:

  • (p) postpone – marks the conflict to be resolved later.

  • (df) diff-full – displays the differences between the HEAD revision and the conflicted file.

  • (e) edit – opens the conflicted file in an editor (this is set in the EDITOR environment variable)

  • (mc) mine-conflict – discards changes from the server that conflict with your local changes; all non-conflicting changes are accepted

  • (tc) theirs-conflict – discards local changes that conflict with changes from the server; all non-conflicting local changes are preserved

  • (s) show all options – displays additional options

resolving conflict 2

Enter ‘s’ to be presented with some additional options:

avoiding conflicts 3

Once you’ve resolved the conflict, perform an ‘svn commit’ to send your changes to the repository.

The DevOps zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today


Published at DZone with permission of Jessica Thornsby, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}