How subversion merges

A bit confused about how the subversion model works. So tell me that my coworker and I have the same file, but we work in different places in the file, if subversion just changes both changes?

Most of the time we will be working with php and xml files, does this mean that we should use the standard substitution model and not block files?

+2


source to share


4 answers


The situation is as follows:

  • you both check the same file.
  • you make some changes to the file
  • one of you makes the change first.
  • another trying to make a mistake will receive a message that the file needs updating because it has changed in the repository since the last checkout
  • when updating file svn client tries to merge repository differences with local

Results are subject to change. If the changes are in different sections of the code, the merge is done automatically.



If the changes overlap, Subversion tells you that the file is in conflict and you need to decide

  • merge manually
  • you are overwriting the latest changes from the repository with your changes
  • undo changes and work with the version from the repository

After you have resolved the conflict, you must commit the file again for your changes to be permanent.

+8


source


That's right, if you're working in different areas of the same file, Subversion can figure it out. If you are working in the same (or very close) region of a file, you will have to deal with merge conflicts.



+3


source


As Frank said.

There's also a great article on this thread. It may be geared towards flexible version control, but should also help you understand how svn works: http://www.infoq.com/articles/agile-version-control

+1


source


Yes, the parallel subversion model will finally work for you.

If you are editing the same file, the script will look like this:

For the first one, which commits a file, the behavior is simple. The file is updated in the repository.

For the second, the process is slightly different, it will be guided by the ool.

  • When trying to commit, it will be prompted to update the file first, because the repository was updated on average. The update will be, if possible, an automatic merge and identify possible conflicts.

  • When the local copy has been merged, conflicts, if they need to be resolved manually, a round of testing needs to be done to confirm that your changes do not conflict with each other.

  • When the local code is in order, the commit will update the repository (at the time, the repository assumed that your local code was based on the latest version.

+1


source







All Articles