~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to services/diffservice

  • Committer: William Grant
  • Date: 2009-12-07 04:01:30 UTC
  • Revision ID: grantw@unimelb.edu.au-20091207040130-g86nvbxnm7xdaye7
Move the year decision responsibility to each pulldown module, not the pulldown framework.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import os
28
28
import sys
29
 
import locale
30
29
 
31
30
import cjson
32
31
import pysvn
33
32
 
34
 
import ivle.conf
35
33
import ivle.svn
36
34
 
37
 
# Set locale to UTF-8
38
 
locale.setlocale(locale.LC_CTYPE, "en_US.UTF-8")
39
35
 
40
36
# Default revisions
41
37
revs = [pysvn.Revision(x) for x in [pysvn.opt_revision_kind.base,
49
45
 
50
46
# Attempt to get the diff for these revisons
51
47
try:
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
56
 
 
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):
60
 
        tmp_path = '/tmp'
61
 
    else:
62
 
        tmp_path = '/tmp/svndiff'
63
 
 
64
 
    diff_text = diff(tmp_path,
 
51
    diff_text = diff( '/tmp/svndiff',
65
52
        os.path.join('/home', sys.argv[1]),
66
53
        revision1=revs[0],
67
54
        revision2=revs[1]
68
55
    )
69
 
    print cjson.encode({'diff': diff_text.decode('utf-8')})
 
56
    print cjson.encode({'diff': diff_text})
70
57
except pysvn.ClientError, e:
71
58
    error = e[0]
72
59