Difference between revisions of "Tip 4: svn conflicts"

From Vlsiwiki
Jump to: navigation, search
(New page: You should all know the basics about SVN already, but what about a conflict? First, how does a conflict happen? You and I both make changes to the same file. I check mine in first. N...)
 
 
Line 42: Line 42:
 
2) copy one of bar.c.mine, bar.c.rOLDREV or bar.c.rNEWREV as   
 
2) copy one of bar.c.mine, bar.c.rOLDREV or bar.c.rNEWREV as   
 
appropriate. This will either undo all changes, keep all of your   
 
appropriate. This will either undo all changes, keep all of your   
changes and undo mine, keep all of mine and ignore yours.
+
changes and undo mine, keep all of mine and ignore yours. Note, that this is RARELY the correct way since you usually want to keep all changes!
  
  

Latest revision as of 22:48, 3 August 2011

You should all know the basics about SVN already, but what about a conflict?

First, how does a conflict happen?

You and I both make changes to the same file. I check mine in first. Now, you have an updated file without my changes. To get these changes, do an "svn up" with your modified file in your svn directory. When you do this, svn takes care of any lines that either of us change (but not both). If we both change it, it isn't sure which one to keep and then it has a conflict (specified by a C during check- in) and requires a manual merge.

So, what do I do?

When there is a conflict (i.e. rarely) are 3 copies placed in your directory:

bar.c.mine
bar.c.rOLDREV
bar.c.rNEWREV
  • bar.c.mine is your copy in its original form
  • bar.c.rOLDREV is the old revision without any of your or the latest changes
  • bar.c.rNEWREV is the new revision without any of your changes
  • bar.c is the "merge" with diff sections that show the conflicts.

To resolve, you can:

1) edit bar.c by hand and resolve all the conflicts.This is typically what I do. These are indicated by text like:

<<<<<
old stuff
=====
new stuff

You just pick one or the other and delete the special characters.


2) copy one of bar.c.mine, bar.c.rOLDREV or bar.c.rNEWREV as appropriate. This will either undo all changes, keep all of your changes and undo mine, keep all of mine and ignore yours. Note, that this is RARELY the correct way since you usually want to keep all changes!


After you are done, you MUST delete all the extra bar.c.r* and bar.c.mine files. This is required so that svn knows you merged to complete the check in.