SVN tree conflict totally wrecked my code in eclipse
I am working in Eclipse using Subclipse (SVN client) and I have been working on my project for a while, in the process I chan开发者_JS百科ged a java package name. When I tried to SVN commit it told me that I had a tree conflict. I opened the conflicts and sure enough there was a conflict with the new package name, I left the selection as the default which said something about merging and pressed ok.
Now all my code has things like this
<<<<<<< .working
getProviders();
=======
>>>>>>> .merge-right.r44
This is shown multiple times and I have compile errors everywhere. I cannot revert the project because I have made so many changes locally already.
In addition, now I have all these new files named like Constants.java.merge-right.r43 where 'Constants.java' is a real file and 'Constants.java.merge-right.r43' is some new file.
What can I do to undo this tree conflict problem?
Find all the merge conflicts indicated by the
<<<<<<< .working
<your code>
=======
<their code>
>>>>>>> .merge-right
parts and check which code is the correct code (or a combination of both parts). Keep/Modify that code and remove the conflict indicators <
, =
and >
lines.
As you noticed there are several versions of the files which have conflicts:
- The
.mine
version of those files is the version you have - The
.merge-right.r43
is the new server version - The
.merge-right.rXX
(where XX < 43) is the old server version which you used to create your own version.
After you fixed the working version, you need to use svn resolved <filename>
to tell SVN you resolved the merge conflict. After resolving all conflict you can commit your code again.
For more information read: How to resolve Subversion Conflicts
You must use your intimate knowledge of the code to decide for each <<< === >>>
item what should actually stand in its place. It could be top part, it could be bottom part, it could be some combination of the both, or it could be something else entirely. Only you know. For each such <<< === >>>
item...
The final result must not have those items. When you finish manually editing the code mark the file as resolved. When all files are resolved you are free to commit the changes.
First of all, you should consider using locks the next time :-)
Second of all, you can right-click the file and say Team, Mark resolved then the added files are deleted, but you have to edit the .java file manually. Or you use a merge tool like WinMerge.
精彩评论