Small Engineer
Small Engineer

Reputation: 41

Automatically update SVN working copy after commit

We have team of 125+ people and we are using tortoise SVN for version control. we have one excel sheet where every user have to update their daily work by end of the day but thing is that no body is updating (SVN update) excel file before making their changes and due to that person who had added his details went missing. so to avoid this i want one svn post commit script which force svn update command to everyone's working copy so whenever they open their working copy it will be up to date. please help me to apply this to my repository we are using tortoise svn with windows clients and we had integrated tortoise svn with collabnet team-forge

Upvotes: 0

Views: 1512

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97365

  1. As noted You selected the wrong way
  2. You selected the wrong tool: Excel-sheets are not text-files for SVN and thus - they can't be merged nicely (if not merged at all)
  3. You fight with miracles: if all users modify the same file, only fastest will win and can commit file: all other will get "resource outdated" on commit-attempt, have to update own WC and foreign changes will be merged into locally changed file (but see the above warning)

At last - server-side hooks can't do nothing on client's workspaces in common (svn up is client's job, not server), except some exotic cases (ssh CLIENT && cd WC && svn up), which aren't your case

Upvotes: 1

Ben
Ben

Reputation: 8905

No, you don't want that. This could obliterate work in progress. And it won't help if multiple people try to edit at the same time.

What you want, is a way to tell users "someone else is editing this file now, don't touch it".

The way to do this is to set the svn:needs-lock property on any binary files, such as Excel spreadsheets.

With this property, the file becomes read-only on everybody's working copy. To edit the file, you first use svn lock which makes the file writeable, and prevents anyone else from locking or committing the file. Then, when your changes are done, and you commit, the lock goes away and others can get lock and make changes.

Getting a lock will fail, if your version of the file is out of date, forcing an update.

But be careful not to have the file open when you do an update, or you may write over the incoming changes.

Upvotes: 1

Related Questions