--- a/src/mercurialserver/servelog.py Sat Dec 18 17:05:36 2010 +0000
+++ b/src/mercurialserver/servelog.py Thu Jan 20 21:18:29 2011 +0100
@@ -9,7 +9,8 @@
import os
import time
import fcntl
-import json
+try: import simplejson as json
+except ImportError: import json
from mercurialserver import ruleset, changes
def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
@@ -25,13 +26,13 @@
fcntl.flock(log.fileno(), fcntl.LOCK_EX)
log.seek(0, os.SEEK_END)
# YAML log file format
- log.write("- {0}\n".format(json.dumps(dict(
+ log.write("- %s\n" % json.dumps(dict(
timestamp=time.strftime("%Y-%m-%d_%H:%M:%S Z", time.gmtime()),
op=op,
key=ruleset.rules.get('user'),
ssh_connection=os.environ['SSH_CONNECTION'],
nodes=[mercurial.node.hex(ctx.node())
for ctx in changes.changes(repo, node)],
- ))))
+ )))
finally:
log.close()