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

« back to all changes in this revision

Viewing changes to services/svnlogservice

  • Committer: William Grant
  • Date: 2010-02-23 08:48:09 UTC
  • mfrom: (1673 trunk)
  • mto: This revision was merged to the branch mainline in revision 1674.
  • Revision ID: grantw@unimelb.edu.au-20100223084809-du6dvsxrjhw15ytr
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import sys
29
29
import locale
30
30
 
31
 
try:
32
 
    import json
33
 
except ImportError:
34
 
    import simplejson as json
35
 
 
 
31
import cjson
36
32
import pysvn
37
33
 
38
 
import ivle.conf
39
34
import ivle.svn
40
35
 
41
36
# Set locale to UTF-8
42
37
locale.setlocale(locale.LC_CTYPE, "en_US.UTF-8")
43
38
 
44
39
try:
45
 
    client = ivle.svn.create_auth_svn_client(username=ivle.conf.login,
46
 
                                             password=ivle.conf.svn_pass)
 
40
    client = pysvn.Client()
47
41
    client.exception_style = 1
48
42
    logs = client.log(os.path.join('/home', sys.argv[1].decode('utf-8')),
49
43
                      discover_changed_paths=True)
50
 
    print json.dumps({'logs': [{'revno': log.revision.number,
51
 
                                'author': log.author.decode('utf-8'),
52
 
                                'message': log.message.decode('utf-8'),
53
 
                                'date': log.date,
54
 
                                'paths': [(p.path.decode('utf-8'), p.action)
55
 
                                          for p in log.changed_paths]}
56
 
                               for log in logs]})
 
44
    print cjson.encode({'logs': [{'revno': log.revision.number,
 
45
                                  'author': log.author.decode('utf-8'),
 
46
                                  'message': log.message.decode('utf-8'),
 
47
                                  'date': log.date,
 
48
                                  'paths': [(p.path.decode('utf-8'), p.action)
 
49
                                            for p in log.changed_paths]}
 
50
                                 for log in logs]})
57
51
except pysvn.ClientError, e:
58
52
    error = e[0]
59
53
 
72
66
    except IndexError:
73
67
        pass
74
68
 
75
 
    print json.dumps({'error': error})
 
69
    print cjson.encode({'error': error})