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

Re: windows c++ hooks

From: burnclouds <burnclouds_at_gmail.com>
Date: Fri, 25 Jul 2008 00:45:35 -0400

there are two "pre" commit scripts. One pre-commit happens first and
handles things like ensuring no tabs in a c++ src file. The other
start-commit is for doing just what i'm trying. I have implemented,
tested and currently using these scripts in bash. I am creating a
BACKUP server that has to run on windows. I can't install perl, php,
python or any other scripting lang. so I have to compile the exe on my
workstation then had it off to the admin to load it into the hooks dir.

I tried the previous suggestion of using strcmp and no joy.

I even reduced my code to

int main(){
return 0;
}

and still nothing.

Kevin Grover wrote:
> Just guessing, perhaps return is not the same as exit? It's been too
> long since I've used C/C++.
>
> You could also try creating the script in bash, python, or perl
> first. Why do you need it in C++? It's seems trivial?
>
> Also: look at the example scripts for what arguments are passed into
> the hooks. According to the pre-commit.tmpl script in my hooks
> directory. The arguments are repo and txn NOT repo and user. You'll
> have to use a command on txn to look up the user.
>
> Just some quick throughts.
>
> - Kevin
>
> On Wed, Jul 23, 2008 at 6:45 AM, Mike Crouse <burnclouds_at_gmail.com
> <mailto:burnclouds_at_gmail.com>> wrote:
>
> 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.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-07-26 06:30:54 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.