4
votes

How can we force users that are using TortoiseSVN to "Update" their branch before they can "Commit"?

We ran into this issue earlier today:

  • Joe commits to Branch1, revision 101
  • Bob downloads Branch1 and then commits to Branch1, revision 102
  • Joe commits to Branch1, revision 103... and SVN never told him "You must update before you can Commit" as typically happens

Also:

  • Joe was working in /svnrepo/ProjectXYZ/branches/Branch1/DirectoryA/
  • Bob was working in /svnrepo/ProjectXYZ/branches/Branch1/DirectoryB/

Any ideas on reasons/ways SVN will skip this step of not making the user update first?

1
I have never seen Subversion behave this way - it always prompts for an update on an out-of-date working copy. There's something you're overlooking with the workflow here. Or, perhaps your users are making changes in different subdirectories, which won't always require an update before committing.alroc
I updated the question to include the fact that Joe and Bob were working in different directoriesSED

1 Answers

4
votes

I suspected that once Bob made changes only in DirectoryB, then he made a commit from DirectoryB level, not from root level. That means that none of files modified earlier by Joe, where affected by Bob's commit. In other words all files modified by Bob where up to date, so no update was required.

I see 2 possible solutions:
1) make everyone commit from root level - i.e. "/svnrepo/ProjectXYZ/branches/Branch1" in that case
2) write a svn pre-commit hook http://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.pre-commit.html

** A little bit longer explanation of what I mean by commiting from levels, and why this matters in this case.

So lets say that Joe commited from root level

cd /svnrepo/ProjectXYZ/branches/Branch1
svn commit DirectoryA/Hello.java

Then what svn registered as modified were Branch1 directory, DirectoryA directory and Hello.java file

And then Bob commited from DirectoryB level

cd /svnrepo/ProjectXYZ/branches/Branch1/DirectoryB
svn commit Hello2.java

Then svn registered only DirectoryB and file Hello2.java as being changed. As you can see there is no common part of these to sets of changes, so no update was required.