views:

66

answers:

3

Hi everyone,

I have a SVN server running on Windows.

I need to force an update on every "working copy" (for each people using the svn repos) after a commit. I tried with a post-commit.bat script in the hook directory on the svn server. The problem is that the update occures on the server and not in the client file.

Here an extract :

    @ECHO OFF

SET REPOS=%1
SET REV=%2

SET DIR=%REPOS%/hooks

SET WORKING_COPY=c:\path\to\working\copy
svn update %WORKING_COPY%

Exemple : Person 1 : commit

post-commit Person 2 : update

If it's not possible, I would like to have at least on automatic update for the person 1. Person 1 : commit, then automatic update in his working copy.

I've seen the solution with a Windows Scheduled task, but it's my very LAST solution.

Can you help ? Thanks a lot.

+3  A: 

SVN post-commit hooks are for server-side actions. You will not be able to control the other users who have checked out a copy of the repository.

You should just have everyone get in the practice of running svn update at the start of every day.

webdestroya
Just at the start of the day isn't often enough in my opinion. I would say you need it before you start working on a feature/bug. The more often you update, the less likely you are to run into conflicts
Sander Rijken
Or at least when appropriate - which may be once or more a day or may be based on other criteria.
Murph
@Sander - Agreed, you should update as often as you can, but I think updating for *every* commit is a bit much.
webdestroya
+2  A: 

I need to force an update on every "working copy" (for each people using the svn repos) after a commit.

I don't think an update of every "working copy" upon commit is possible - at least not without doing some horribly complex things.

If it's not possible, I would like to have at least on automatic update for the person 1.

Not sure WHAT you want to do exactly but if you are using Tortoise, it supports Client-side hook scripts. Maybe they could help (but they'll only help on the originating working copy). But as I said, I'm not sure I understood your exact needs.

Pascal Thivent
Client-side hook scripts can't force other clients to run update either. And updating your own WC after commit is quite silly, because you already have those changes.
Sander Rijken
@Sander Did I wrote that client-side hook scripts could update other clients?
Pascal Thivent
I wonder why this answer has been downvoted... I don't know what the OP wants to do exactly but client-side hook scripts might help him, that's somehow what he's asking for.
Pascal Thivent
@Pascal - It seems to be implied by your response.
webdestroya
I didn't downvote it, just noted that it's not possible. I think the "right" answer to the question is that it's something you shouldn't want to implement.
Sander Rijken
@Sander You should post this as answer. Anyway, I thought client-side hook scripts were worth being mentioned, especially if the OP was not aware of them and don't understand why this answer deserves a downvote. I don't care the downvote but I like to get the opportunity to understand what is wrong, so that I can also improve.
Pascal Thivent
Just did, and maybe the downvoter will explain?
Sander Rijken
I downvoted because of the reference to client-side hook scripts being something that would lead people down the wrong path. Those will do something _on the working copy that did the commit_, rather than on each working copy, as the OP asked.
Yuliy
@Yuliy And may I know how you read *"If it's not possible, I would like to have at least on automatic update for the person 1"*? I'm not saying it makes sense (I still do not fully understand what the OP wants), but I'd like to hear how you interpret that.
Pascal Thivent
Ah, I missed that. Could you edit your post to clarify that client-side hooks only help on the originating working copy? I'll remove the downvote then.
Yuliy
@Yuliy Done. Let me know if it isn't clear enough.
Pascal Thivent
+2  A: 

I think it's a very bad idea to update several working copies whenever something in the repository changes.

What's the reason you want this? And how will you make this scale?

Subversion is designed to work the same with an unlimited amount of working copies checked out. Pushing updates to each and every working copy at each commit makes each commit a very expensive operation.

Also consider what you'll do if certain client computers are turned off for instance.

Sander Rijken
+1, **"What If?"** What if you miss a working copy? What if the machines are turned off? What if someone has local changes, and updating dumps a whole bunch of merge conflicts on them automatically and without warning? This problem is about communication, not technical wizardry.
shambulator
I agree with this of course, +1
Pascal Thivent