Hello!
Maybe this is not a real subversion question but I am learning too
many things at the same time. Though it maybe a perl issue I hope to
get some help here. I have a problem writing a post-commit script in
perl on a W2K server (perl as a means to overcome the cmd-limitations
of Windows). However I am neither a windows nor a perl or subversion
expert.
My perl script (post-commit) fails to capture the output of a
backtick-call to svnlook, but only when invoked by subversion. When I
forge the svn call from the command line the scrpt works fine.
I reduced the complexity to make myself clear:
The repository resides in c:/joe/svnrepositories/svn.
Subversion resides in c:/Programme/subversion
!-------------------------------------------------------------------------
! C:\>type c:\joe\svnrepositories\joe\hooks\post-commit.cmd
! c:\perl\bin\perl -Ic:\joe\perlscripts c:\joe\perlscripts\post-commit.pl %1 %2
! C:\>
! --------------------------------------------------------------------------
! C:\>type c:\joe\perlscripts\post-commit.pl
! #!/usr/bin/perl
!
! $reppath = $ARGV[0];
! $revision = $ARGV[1];
!
! #`echo hook output $reppath $revision > c:\\log.txt`;
! #`c:/Programme/subversion/bin/svnlook.exe -r $revision changed $reppath >> c:/log.txt`;
! # exit;
!
! @svnlook_output = `c:/Programme/subversion/bin/svnlook.exe -r $revision changed $reppath`;
! open(HLOG, ">C:/log.txt");
! print HLOG "hook output $reppath $revision\n";
! print HLOG @svnlook_output;
! close(HLOG);
!
! C:\>
--------------------------------------------------------------------------
The script works fine when called from the command prompt:
--------------------------------------------------------------------------
! C:\>perl c:\joe\perlscripts\post-commit.pl /joe/svnrepositories/joe 250
!
! C:\>type c:\log.txt
! hook output /joe/svnrepositories/joe 250
! U trunk/listserv/lists/joe-test/mailtpl/POST_EDITOR
!
! C:\>
--------------------------------------------------------------------------
However when called directly from svn after a commit the STDOUT-output
is not captured:
--------------------------------------------------------------------------
! C:\>type c:\log.txt
! hook output /joe/svnrepositories/joe 254
!
! C:\>
--------------------------------------------------------------------------
When I change post-commit.pl and uncomment the lines that redirect the
output directly to the file c:\log.txt, this file contains everything
what is needed. My conclusion is that the backtick operator genarally
works (svnlook *is* being executed) however perl does not capture the
output in my first variant. But of course I need that output for
parsing...
I'm sure I am missing something here. But what...?
Just in case some version information:
--------------------------------------------------------------------------
! C:\>perl -v
!
! This is perl, version 5.005_03 built for MSWin32-x86-object
! (with 1 registered patch, see perl -V for more detail)
!
...
!
! C:\>
--------------------------------------------------------------------------
and
--------------------------------------------------------------------------
! C:\>svn --version
! svn, Version 1.2.3 (r15833)
! Subversion ist Open Source Software, siehe http://subversion.tigris.org/
! Dieses Proukt enthlt von CollabNet entwickelte Software.
! (http://www.collab.net/)
...
! C:\>
--------------------------------------------------------------------------
Thanks in advance for any hints,
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Jan 17 08:36:38 2006