Domanda

I've written a Perl post-commit hook that sends out emails via the Perl Net::SMTP module. I was getting the following error when I try to do a commit:

Sending        subversion/README
Transmitting file data .svn: Commit failed (details follow):
svn: MERGE of '/mfxcm/trunk/subversion': 200 OK (http://source)

The commit actually had worked, but the revision of my working copy wasn't updated until I did a "svn up":

$ svn commit -m"Finding what's causing commit errors. I think it's the post-commit script"
Sending        subversion/README
Transmitting file data .svn: Commit failed (details follow):
svn: MERGE of '/mfxcm/trunk/subversion': 200 OK (http://source)
david@DaveBook.local:~/workspace/svn-cm-trunk/subversion
$ svn up
G    README
Updated to revision 94.

I've played around with my post-commit script. First I wrote a simple one that just prints out a simple text message just to make sure things work. Then, I used mine and exited at various times to see where the MERGE issue was coming from.

I got to the point in my script where I created a new Net::SMTP object:

    if ($smtpUser) {
        $smtp->auth( $self->SmtpUser, $self->SmtpPassword)
            or croak qq(Unable to connect to mailhost "@{[$self->SmtpHost]}")
        . qq( as user "@{[$self->SmtpUser]}");
    }

If this line is enabled in my script, I get the MERGE issue. Otherwise, my entire script runs more or less as expected.

I can also run the script from the command line, and everything works just fine. It's only when triggered as a post-commit hook where things fail. I've even logged in as Apache and ran the script without any problems.

What does that MERGE error mean, and why do I get it when Subversion runs the post-commit hook?

È stato utile?

Soluzione

SVN post-commit hooks run under a special account in Windows, and I'd guess the same is true for UNIX/Linux, which it looks like you're using. We ran into something like this in Windows.

Is it possible that this account is unable to send mail thru that server?

The script would work fine when run directly (as you), but not when run in a post-commit hook. It's similar to certain cron systems, where your environment/permission could be very different than what you're used to in an interactive shell.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top