34
import simplejson as json
42
locale.setlocale(locale.LC_CTYPE, "en_US.UTF-8")
36
client = pysvn.Client()
45
client = ivle.svn.create_auth_svn_client(username=ivle.conf.login,
46
password=ivle.conf.svn_pass)
37
47
client.exception_style = 1
38
logs = client.log(os.path.join('/home', sys.argv[1]),
48
logs = client.log(os.path.join('/home', sys.argv[1].decode('utf-8')),
39
49
discover_changed_paths=True)
40
print cjson.encode({'logs': [{'revno': log.revision.number,
42
'message': log.message,
44
'paths': [(p.path, p.action)
45
for p in log.changed_paths]}
50
print json.dumps({'logs': [{'revno': log.revision.number,
51
'author': log.author.decode('utf-8'),
52
'message': log.message.decode('utf-8'),
54
'paths': [(p.path.decode('utf-8'), p.action)
55
for p in log.changed_paths]}
47
57
except pysvn.ClientError, e:
52
62
# See subversion/include/svn_error_codes.h.
63
# 150000: ERR_ENTRY_NOT_FOUND
53
64
# 155007: WC_NOT_DIRECTORY.
65
# 160006: FS_NO_SUCH_REVISION
54
66
# 160013: FS_NOT_FOUND
55
67
# 200005: UNVERSIONED_RESOURCE
56
if code in (155007, 160013, 200005):
68
if code in (150000, 155007, 160006, 160013, 200005):
59
error = '%s (code %d)' % (error, code)
71
error = '%s (code %d)' % (error, code)
63
print cjson.encode({'error': error})
75
print json.dumps({'error': error})