50
46
# Attempt to get the diff for these revisons
52
svnclient = ivle.svn.create_auth_svn_client(username=ivle.conf.login,
53
password=ivle.conf.svn_pass)
48
svnclient = pysvn.Client()
54
49
svnclient.exception_style = 1
55
50
diff = svnclient.diff
57
# pysvn's diff tempfile behaviour changes with Subversion 1.6.x.
58
# < 1.6 wants a filename, >= 1.6 wants a directory.
59
if pysvn.svn_version > (1, 6):
62
tmp_path = '/tmp/svndiff'
64
diff_text = diff(tmp_path,
51
diff_text = diff( '/tmp/svndiff',
65
52
os.path.join('/home', sys.argv[1]),
69
print cjson.encode({'diff': diff_text.decode('utf-8')})
56
print cjson.encode({'diff': diff_text})
70
57
except pysvn.ClientError, e:
75
62
# See subversion/include/svn_error_codes.h.
76
# 150000: ERR_ENTRY_NOT_FOUND
77
63
# 155007: WC_NOT_DIRECTORY.
78
64
# 160013: FS_NOT_FOUND
79
65
# 200005: UNVERSIONED_RESOURCE
80
if code in (150000, 155007, 160013, 200005):
66
if code in (155007, 160013, 200005):
83
69
error = '%s (code %d)' % (error, code)