tags:

views:

151

answers:

3

So developer X and Y did checkout from svn repo with revision no as 2. Dev Y makes changes and does a commit. Dev X makes change and go to make a commit. Now I want to enforce that he shouldn't be able to commit if his repo is not the latest?

How do I do this?

How do i stop user from commiting to a repo without doing svn update and thereby over writing prev developers changes ?

+9  A: 

SVN does this automatically, for files which have been changed on the server, you have to bring your working copy up to date and resolve all of the conflicts before you can commit.

1800 INFORMATION
+4  A: 

You can't really enforce SVN to make the programmer always do an update, but if there is a conflict, ie. files that programmer X changed has been updated in the repository, then SVN will need the update, to resolve conflicts.

In other words, if programmer Y updates file TEST.TXT from revision 2 to revision 3, and programmer X, having revision 2 of TEST.TXT, and changes that file, when he tries to commit revision 4, SVN will force programmer X to update first.

However, if programmer X and Y works on different files, SVN will not force that update.

It might be possible with client-side hooks.

What specific problems are you trying to solve here? Why do you want to do this?

Lasse V. Karlsen
"if programmer Y updates file TEST.TXT from revision 2 to revision 3, and programmer X, having revision 2 of TEST.TXT, and changes that file, when he tries to commit revision 4, SVN will force programmer X to update first."Does default svn configuration handle this ?. This is what i want.
Ankur Gupta
Yes. Just test it, add a repository to c:\temp\svn, and check it out to c:\temp\X and c:\temp\Y, and just do the changes as layed out, you'll notice that it will force the programmer to update first. But not if he's working on different files, then the commit goes in without problems.
Lasse V. Karlsen
thanks dude. I ass-umed that I will have to manually enforce it.
Ankur Gupta
+2  A: 

Dear versesane,

Here is the official Subversion documentation chapter about "commiting you changes":

http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.commit

The last paragraph says that you must execute svn update before commiting an "out of date" file in your local working copy.

ulrichb