[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

windows c++ hooks

From: Mike Crouse <burnclouds_at_gmail.com>
Date: Wed, 23 Jul 2008 09:45:39 -0400

I'm trying to write some hooks using c++.
I am using svnsync to replicate data across two servers.

I use start-commit on the primary so that it blocks user "replicator" from
committing to the primary repo:

     if (USER != "replicator") return 0;
     return 1;

I use start-commit on the backup so that it blocks all other users from
committing to the backup repo:

     if (USER != "replicator") exit 1;
     return 0;

I use post-commit on the primary to call:

/usr/local/bin/svnsync --non-interactive sync svn://primary/repo1
--no-auth-cache --source-username replicator --source-password replicator
--sync-username replicator --sync-password replicator &

and post-revprop-change to call (using short hand for the REV variable):

/usr/local/bin/svnsync --non-interactive copy-revprops svn://primary/repo1
$REV --source-username replicator --source-password replicator
--sync-username replicator --sync-password replicator --no-auth-cache &

Here is a short copy similar to my start-commit on the primary:

#include <iostream>
using namespace std;
int main(int argc, char * argv[])
{

    if (argc>=2){
     string REPO=argv[1];
     string USER=argv[2];
    }
    else{
    cerr << "Not enought arguments";
    return 1;
    }
     if (USER != "replicator") return 0;
     cerr<<" The replicator is not allowed to commit to the primary server";
     return 1;
}

I compiled using gcc.
Made the exe executable by every one.
put it in repo1/hooks/start-commit.exe
and ...
When i try to commit as a normal user on the primary server i get:
>svn ci -m "test commit"

Sending testcommit.text
Transmitting file data .svn: Commit failed (details follow):
svn: 'start-commit' hook failed with error output:

>
No error output.

if I call the start-commit explicitly all works fine.
but svn can't seen to handle it.

Help. Please.
Received on 2008-07-24 08:33:08 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.