3

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.

Justin Johnson
  • 30,978
  • 7
  • 65
  • 89

3 Answers3

3

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.

Mitch Dempsey
  • 38,725
  • 6
  • 68
  • 74
  • 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 Sep 26 '10 at 21:45
  • Or at least when appropriate - which may be once or more a day or may be based on other criteria. – Murph Sep 26 '10 at 21:46
  • @Sander - Agreed, you should update as often as you can, but I think updating for *every* commit is a bit much. – Mitch Dempsey Sep 26 '10 at 21:46
3

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
  • 21,376
  • 3
  • 61
  • 85
  • 2
    +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. – anton.burger Sep 27 '10 at 08:43
2

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
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 1
    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 Sep 26 '10 at 21:46
  • @Sander Did I wrote that client-side hook scripts could update other clients? – Pascal Thivent Sep 26 '10 at 21:50
  • 1
    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 Sep 26 '10 at 21:50
  • @Pascal - It seems to be implied by your response. – Mitch Dempsey Sep 26 '10 at 21:51
  • 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 Sep 26 '10 at 21:52
  • @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 Sep 26 '10 at 21:58
  • 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 Sep 27 '10 at 00:21
  • @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 Sep 27 '10 at 01:36
  • 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 Sep 27 '10 at 02:33