Search code examples
pythonsvntortoisesvnpost-commitvisualsvn-server

Yet another Subversion "Commit failed" MERGE of 'blabla': 200 OK


I get the infamous "MERGE of 'whatever': 200 OK" whenever I try to commit using a post-commit hook on Windows (running the repository and Trac locally), and I'm going crazy. I've been looking all over for a day now, without finding any solutions.

So here's how it's set up and what I've tried so far:

Settings: Windows 7 (64-bit) VisualSVN Server TortoiseSVN Trac 0.11.6

  • I'm using the three standard scripts for post-commit on Windows.
  • Everything works when I run post-commit.cmd from the command prompt with repo and changesetnumber as parameters.
  • After extensive trouble-shooting, I found that if I remove the last line in trac-post-commit.cmd, Python "%~dp0\trac-post-commit-hook.py" -p "%TRAC_ENV%" -r "%REV%" -u "%AUTHOR%" -m "%LOG%", the Commit failed error goes away.
  • Adding 1/0 (generating a division by zero error) in the python script doesn't show anything different. From the command prompt I get an error, though.
  • Removing all code in the python script also makes the commit failed go away, so I guess the culprit is in trac-post-commit-hook.py.

Perhaps if I could send the actual error to a log file, I could dig a little deeper, but I'm not sure how.

post-commit.cmd:

call %~dp0\trac-post-commit-hook.cmd %1 %2

trac-post-commit-hook.cmd:
http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook?rev=920

Thank you so much, it would mean alot if someone could assist a little here! /Martin


Solution

  • To get the error message while doing the SVN commit, you should be able to change:

    if __name__ == "__main__": 
        if len(sys.argv) < 5: 
            print "For usage: %s --help" % (sys.argv[0]) 
        else: 
            CommitHook() 
    

    to:

    if __name__ == "__main__": 
        if len(sys.argv) < 5: 
            print "For usage: %s --help" % (sys.argv[0]) 
        else: 
            try:
                CommitHook()
            except Exception, e:
                print >> sys.stderr, str(e)
                sys.exit(1)