Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I avoid Complicated Merges in Subversion?

I'm new to Subversion (SVN) coming from a Visual Source Safe (VSS) background. In VSS the person editing a file checks the file out and it locks the other users from editing it through Visual Studio. I understand that SVN is a concurrent model allowing multiple people to work on the same file and later merge the changes together. My question is this:

  1. What is the best approach to avoid having users editing the same file(writing tons and tons of code) and either facing a complicated merge for their changes or even worse writing a ton of code only to find that the file is locked by another user?

  2. Is there a way to notify a user when retrieving a file that it is currently being edited by another user or currently locked by another user?

Other Details:

Using VisualSVN Server as SVN Server.
Using TortoiseSVN and AnkhSVN clients.

like image 242
Achilles Avatar asked Nov 12 '09 14:11

Achilles


2 Answers

I'm also a former Visual Source Safe user. Merges used to drive me crazy until I realized that it is not a technology problem, but a people issue. When using VSS, most developers try to get as much work done as possible, before they have to check in code. This behavior is what was contributing to complicated merges.

Here are a few things to mitigate this:

  • Always update your working copy before starting
  • Check in often. This will make the code changes smaller, which will be easier to auto-merge
  • Do not leave working code unchecked
  • Developers should create their own branch, if the changes will take several days or longer

Those things helped immensely, especially as the teams I worked in kept getting bigger and bigger. Replicating the lock behavior from VSS is a very bad idea, and will cause more problems. Just embrace the new workflow.

If you still want to use a tool, then I suggest that you look at SVNMonitor.

like image 140
Hector Sosa Jr Avatar answered Oct 17 '22 04:10

Hector Sosa Jr


I would like to suggest taking a different approach to using subversion.

  • You should get updates frequently.
  • You should also check in early and often.

With this approach, merging is usually infrequent and happens automatically. In the case of conflicts, these are often smaller.

like image 45
Daniel Robinson Avatar answered Oct 17 '22 05:10

Daniel Robinson