tags:

views:

415

answers:

2

Hi, I'm kinda new to SVN plus I'm usually on a 1-2 man project so most of the time I'm the only one using it.

Here's the deal,

In my repository there are a total of 2 revisions of all of the src code. The src code are currently on revision 2 but one of my files fuzzed up so I reverted it to its revision 1 counterpart.

Now after a few hours of debugging and stuff that javafile works but I can't commit it, it says javafile is out of date, this is probably because I'm currently editing javafile.java revision 1 right?

So how do I resolve this? I know that one solution is to copy paste my javafile revision 1 code into its revision 2 counterpart and the committing, but is there any other way? am I using svn wrong?

+1  A: 

Updating the working copy should fix it.

From the command line:

X:\WorkingCopy>svn up

or right-click and choose SVN Update... in TortoiseSVN

When you update, you may come across conflicts, which will be marked in your code with

>>>>>
...
-----
...
<<<<<

You'll need to manually resolve these. When you're done, don't forget to mark the file as resolved.

X:\WorkingCopy>svn resolve \path\to\file

or right-click and choose TortoiseSVN -> Mark as Resolved... in TortoiseSVN

Benny Hallett
But what if I've edited some methods, I'll get conflicts errors right? How would I resolve that? :(
lemon
Conflicts mean that you and someone else have made changes to the same bunch of code. You will see >>>>>> --------- and <<<<<< markers in your source code now. They show you the different versions of the code. You'll need to sort out with the other developers which code is the correct one.
Benny Hallett
You can mostly prevent large, painful conflicts by following the advice: 'commit early, commit often'
Benny Hallett
In part it depends on how or what you mean by 'reverting' the file to revision 1. If you where working on version 2, and dropped a copy of the version 1 file over it, then there will be no update or need to resolve conflicts. If you set your working revision to 1, then edited and tried to commit, then you get this out of date issue. Instead you should leave your working revision at the head, and use the revert/merge tool (or drop new content) to remove the change which would be applied to your working version.
Greg Domjan
Ty Benny. Got it Greg, I should've udpated the head revision instead of the previous revision TY.
lemon
A: 

Update your working copy, and resolve the merge conflicts by copying the resulting file that has your locally modified version over the version with conflict markers in in. Run svn resolved on it, and check that in. This does assume there are no other changes that you want to preserve.

Novelocrat