post-commit hook not firing when copying to create new tag

slyford
slyford
I have a post-commit hook which I have tested and know works when I do a "commit" of any changes I make to files/folders that I have checked out.    I assumed it would fire when I copy from the "trunk" to a new tag... i.e. copy current trunk to something like "\tags\session1.0" but it doesn't appear to be firing then.    Is copying from /trunk/ to /tags/... NOT a commit?    FYI this is in Windows. Thanks!

Last updated

andyl
andyl
Anything that modifies the repository (aside from a a revprop change) is a commit and fires the post-commit hook script when successful.    So, your script either isn't working the way you think it is, or the action it's taking isn't readily apparent to you.
slyford
slyford
All I have the hook do is gather some info via "svnlook" commands, and print them to STDERR for debugging/viewing.  If I do something like: create a new folder in my working copy from the trunk, and commit the change, the hook fires exactly as I expect and I see the debug info from STDERR in the popup window.  But if I simply copy the /trunk to something like /tags/session1.0 I get no output from the hook at all.
andyl
andyl
If you could loan us your crystal ball, we might be able to help more. Mine's in the shop, so I can't see your code. You see nothing obvious in your code - another set of eyeballs may spot the problem immediately.    STDERR is not an appropriate way to return information from post-commit. It may make the client think that the script failed. Write to a logfile or send an email instead. STDERR should be used for errors, not non-error information.
slyford
slyford
andyl;122626If you could loan us your crystal ball, we might be able to help more. Mine's in the shop, so I can't see your code. You see nothing obvious in your code - another set of eyeballs may spot the problem immediately.    STDERR is not an appropriate way to return information from post-commit. It may make the client think that the script failed. Write to a logfile or send an email instead. STDERR should be used for errors, not non-error information.
   The snarkiness was a nice touch from someone who is voluntarily responding to a request for help. I didn't post code because I was guessing/thinking that a copy from trunk to tags would somehow be different than other actions and might not fire a post-commit hook.    Also, according to documentation STDERR is perfectly fine for printing debug info:  http://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.post-commit.html    Here is the script (Perl, being called by a .bat file):  
#!e:\Perl64\bin;
 
 my $svnlook		= "E:\\Program Files (x86)\\VisualSVN Server\\bin\\svnlook.exe";
 my $svn			= "E:\\Program Files (x86)\\VisualSVN Server\\bin\\svn.exe";
 
 my $repos		= $ARGV[0];
 my $rev		= $ARGV[1];
 
 my $svn_info		= `"$svnlook" info -r "$rev" "$repos"`;
 my $svn_log		= `"$svnlook" log -r "$rev" "$repos"`;
 my $svn_changed		= `"$svnlook" changed -r "$rev" "$repos"`;
 chomp $svn_info;
 chomp $svn_log;
 chomp $svn_changed;
 
 print STDERR "svn_info:\n$svn_info\n\nsvn_log:\n$svn_log\n\nsvn_changed:\n$svn_changed";
 
 exit(1); # this line to ensure that debug print statement goes to STDERR after commit completes. doesn't stop commit from completing.
 
 
slyford
slyford
Well no answer yet so I have additional details to add:  * the post-commit hook works just fine if you have:  - checked out code to local folder  - made any changes (add folder or file)  - commit changes from the folder back to the repository  * it doesn't seem to fire if:  - I'm using the repo browser  - I create a new folder, or add a file, via the repo browser  - or copy from trunk to tags, for example  Why doesn't the post-commit hook fire via the repo browser? Any info would be helpful, thanks.
slyford
slyford
Anyone? Still cannot find any info on whether or not actions performed from repo browser are different (i.e. do or do-not fire the post-commit hook) from those in a working copy. Wouldn't any action that rev's the repository be post-commit and execute the hook?
philip
philip
Commits via the repository browser cannot bypass hooks. The most likely explanation is that the hook is running but is not producing the output you expect.
slyford
slyford
philip: thanks for the response.  That is my guess. Per recommendation from documentation, I have debug info going to STDERR (using Perl for the hook itself, called by .bat file). This works fine if I make & commit changes via working copy. But doing a copy or mkdir via repo browser does NOT yield output. Is there a better method for reading debug output from a post-commit hook?

1-9 of 9

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.