views:

514

answers:

3

When running a commit with the trac-post-commit-hook I receive a MERGE 200 OK error, I understand that this means that the commit has succeeded on the server but the file status has not updated on my local machine. But I can't find anyway to fix this issue. Would this be a problem with my setup or something in the script. I'm using stock standard script from the trac site, I'm committing through tortoiseSVN to VisualSVN Server which is hosted on a windows 2008 server. When I run the script through a command line I receive no errors, I only receive this error through TortoiseSVN.

A: 

Your problem with the Trac post-commit hook sounds like this:

http://ariejan.net/2007/05/21/merge-request-failed-on-pathtofile/

William Leara
A: 

I've had this problems for hooks that had nothing to do with Trac. From post-commit I called some other script that did svnlook changed and cat in the repository, and I got MERGE 200 OK error. The solution was to call the other script in the background so that the hook exits immediately after starting the script.

A: 

I got this error using Trac & Subversion under Debian "Lenny".

For me it boiled down to a bug in Trac. In trac.util.datefmt:

def to_timestamp(dt):
"""Return the corresponding POSIX timestamp"""
if dt:
    diff = dt - _epoc
    return diff.days * 86400 + diff.seconds
else:
    return 0

Where dt is a timestamp. So convert to a datetime first:

def to_timestamp(dt):
"""Return the corresponding POSIX timestamp"""
if dt:
    dtt = to_datetime(dt)
    diff = dtt - _epoc
    return diff.days * 86400 + diff.seconds
else:
    return 0

Now we have to fix a problem in the trac-post-commit-hook script, since the 'href' and 'abs_href' attributes of trac.env.Environment are get-only properties (there is no setter):

--- trac/trac-post-commit-hook  (revision 8)
+++ trac/trac-post-commit-hook  (working copy)
@@ -152,11 +152,7 @@
         self.author = chgset.author
         self.rev = rev
         self.msg = "(In [%s]) %s" % (rev, chgset.message)
         self.now = int(time.time()) 
-        if url is None:
-            url = self.env.config.get('trac', 'base_url')
-        self.env.href = Href(url)
-        self.env.abs_href = Href(url)

This is all on Debian "Lenny", trac 0.11.1-2.1

ManicDee
LOL... and I posted the answer on the wrong question. Ah well.
ManicDee