views:

128

answers:

3

Hi all,

I am new to use svn and the company in which I work uses three levels (I don't know whether this is a correct word to use here) of svn. I mean the developers are provided a working directory on a testing server. When we commit, it goes to the dev server. When a manager commits it from there it goes to production server. I am a developer here and one of my files is giving error (conflict) when I commit from directory. Not only, but also it gives conflict when manager tries to commit. I am now given access as manager too but I am still unable to resolve it.

What I've tried till now:

svn update
svn delete
svn commit

It gives conflict on all of these operations.

Earlier on a simple error happened and the manager preferred to just delete file on dev, copy it manually and then commit from there. I don't know this may be a reason of this problem or not.

Please help me resolve this issue. I've read some things in read-bean book too but to no avail yet.

Thanks

Ok, here's the update. The actual problem is that a file (ex lib/a.php) used to be in my working directory as well as in dev and production servers. Now it was deleted by someone (using del command, not svn delete) from dev server. Now question here is how I add it again so that it becomes part of svn again. The simple svn add doesn't work.


Update 2 From one of the answers below I understood that its a tree conflict. Some searching brought me to http://svnbook.red-bean.com/nightly/en/svn.tour.treeconflicts.html . Following the instructions, I took the backup of the file and then svn delete it from everywhere. Then I svn add it to my directory, commit it and tried to update dev and production. End result is that it doesn't go there. No error is shown either.

svn info in my directory shows complete info of the file but on dev and production it shows

file_name:  (Not a versioned resource)

:S

Any more ideas please?

+1  A: 

Try to resolve the conflicts then commit again:

svn resolve --accept working
Kevin Yang
+3  A: 

Alternatively you can take backup of the file ,then say svn revert filename insert you new code.Do a svn up just to make sure you do not have any conflicts,and then commit

Or

fix the conflicts in the file and then you can say svn resolved filename and then you can continue operations on the file

Update:If your file is deleted using rm or del command use svn revert filename to get it back and you do not have to add it again.Just put in your new changes and say svn ci -m"your comments" filename

svn revert will fetch back the last checked in copy into SVN and it wouldnt have your any changes made before the user had used del command

Update 2:After u say svn delete ,u need to commit it until u get the message Deleting filename with a new revision number.Then add the file using svn add command,then commit again.Once this is done you can check the svn info, let me know..

Use svn status command to know the status of the file

The only problem apart from this i can think of is this the directory may not have been added.Is this a new directory?

Hulk
I did the commit after issuing svn delete and it told me "Deleting filename". Then I did svn add and committed again. Directory is old and it has many files that synchronize finely among all servers except the file in question. Also, my manager told me that I must do "svnmerge merge" to get it updated at production. Don't know why but mentioning here since it might give some clue.
Muhammad Yasir
Do this..1.svn delete 2.svn commit 3.svn add 4.svn ci..One another way to track the problem ..Take a backup of the directory ,delete the old directory.Get a new version of the directory.Do your file operations on this..
Hulk
Thanks Hulk for all the time you are giving to solve my problem. But looks like I've worsened it now. I svn deleted the whole directory and followed as you said. Then I did svn up on remote server and it shows same version number as local (bit encouraging) but the whole directory is still missing from remote and "svn info directory_name" responds with "directory_name: (Not a versioned resource)" :(
Muhammad Yasir
I did not say to svn delete it..I just asked you to take a back and delete the directory using rm command and do a svn up .Anyways dont worry,go back to a previous revision number by doing say svn up -r "revision number" directory name.You will get it back..And then do a svn add directoryname.You may also want to read http://www.linuxfromscratch.org/blfs/edguide/chapter03.html
Hulk
In GTA VC when you fail a particular mission you are told "You walk like a man, talk like a man but drive like an idiot". In a similar fashion my boss compared my programming skills with the versioning skills!!! He was not harsh anyway. lol. Anyhow I appreciate your help efforts. Regards.
Muhammad Yasir
@Muhammad Yasir:Glad to help
Hulk
+2  A: 

ah, the old tree conflict problem.

The issue is that SVN is letting you know that you're adding a file that used to be there but it cannot tell whether you're trying to delete it, add it or just update it! So it does the only thing it can - flags a conflict so you can sort it out and fix it. Its basically a conflict on the directory level (rather than a conflict of a file's contents).

What you do is resolve the error (as others have pointed out), then update the directory to get the original file back, then commit your changes. Note that the file was never deleted from SVN - its still in the repo, and if you checkout out a new WC, you'd get the file.

gbjbaanb