karthik.raju has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, In one of my project, we need to automate the svnsync process between two repositories through Perl script.

And when we run the perl script with the following code then it is working fine.

system('svnsync sync https://xxxxxx64.xxx-xxx.com/svn/repo2/');

But when we are trying to call the same script from pre-commit.bat hook it is not working,

can any one help on this.

Thanks in advance.

-Karthik

Replies are listed 'Best First'.
Re: svn sync with perlscript
by MidLifeXis (Monsignor) on Jun 02, 2015 at 12:10 UTC

    Please define "not working". Is it complaining that this action will start a warp core breach? Include the error messages within <code>...</code>.

    If I were to guess, I would look to see if you are running with the same environment in both locations. Hooks running under the control of another process can have a much different environment than the user does at their shell level.

    --MidLifeXis

Re: svn sync with perlscript
by stevieb (Canon) on Jun 02, 2015 at 14:27 UTC

    I'm assuming this is Windows, but that doesn't really matter. Try putting the whole path to svnsync in the system call... eg: "c:\program files\svn\svnsync" or whatever it may be.

    After that, try the pre-commit again.

    This is a common issue on Unix when running a script from the scheduler... runs fine on the CLI, but the environment isn't set up the same when running it from cron.

    -stevieb

Re: svn sync with perlscript
by locked_user sundialsvc4 (Abbot) on Jun 02, 2015 at 11:28 UTC

    What is the message that is displayed?

    I suspect that, at the point this hook will be running, you cannot issue a svnsync command because, well, “that would run the hook.”   The pre-commit process is already begun.