Domanda

We are about to set up subversion for a development project where most of the code will be edited in VisualStudio 2012.

To avoid people locking files, we would like to set up a polling mechanism so that a warning is issued to team members that somebody else has started editing a specific file. This warning will tell them that if they do make changes they will have to merge their changes against the other ongoing changes that are currently in the making.

The only reference to polling subversion I can find with ease is Jenkins, but that does not fit in a VS2012/VisualSVN setup.

I would have expected that the use case to monitoring remote svn status changes to be common. Has anyone found a solution for this?

Setting up some form of polling, and perhaps including a special property to files on commit with or without a post-commit hook to triger changes on all machines may be more difficult that it appears. If there is not existing solution can you give me pointers to set this up?

È stato utile?

Soluzione

I don't think there is anything built in to SVN that will do this for you. This isn't a common use case because concurrent editing is handled gracefully by SVN, and therefore isn't considered to be a problem worth notifying other developers about.

If you want to be notified when a developer starts editing a SVN-tracked file, you'll probably need to develop a mechanism yourself. You could have a script running on each developer's machine that every 5 minutes does a "svn status | grep ^M" (or whatever the Windows equivalent of that is) and then sends the resulting text output to a (custom) server. The server could then compare the text received from each developer machine, and if it differs from the text received previously from that machine, it could email the other developers to notify them about the change.

That seems like a lot of work for not-so-much benefit, though. I also wonder if the developers might find that too intrusive.

Altri suggerimenti

SVN has the needs-lock property that you can set on a file that means a user must 'lock' the file for editing, and only one lock can exist at a time. This is essentially for binary and other non-mergable files to prevent nasty conflicts.

Its not quite what you want though, as it prevents more than 1 user from editing that file (though, admittedly, getting a warning isn't much use if you ignore it anyway).

SVN isn't like VSS or TFS, you don't need to worry about 2 people making changes to a file simultaneously - SVN (despite some fanboi-ism from the DVCS guys) merges quite well.

What you really need is to have a read of the Redbook, especially the bit about different ways of working with a VCS.

If you still decide you need a notification of checkouts, you'll need to run Apache with SVN and parse the logs as SVN itself doesn't have a 'checkout' hook. (TortoiseSVN does however, so you might like to use that, but some people won't use Tortoise, they'll use VisualSVN or AnkhSVN inside Visual Studio).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top