~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:55:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1674.
  • Revision ID: grantw@unimelb.edu.au-20100223085542-r8xw14bxxoraza51
Permit underscores in all names.

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
29
30
 
30
31
import cjson
31
32
import pysvn
32
33
 
33
34
import ivle.svn
34
35
 
 
36
# Set locale to UTF-8
 
37
locale.setlocale(locale.LC_CTYPE, "en_US.UTF-8")
 
38
 
35
39
try:
36
40
    client = pysvn.Client()
37
41
    client.exception_style = 1
38
 
    logs = client.log(os.path.join('/home', sys.argv[1]),
 
42
    logs = client.log(os.path.join('/home', sys.argv[1].decode('utf-8')),
39
43
                      discover_changed_paths=True)
40
44
    print cjson.encode({'logs': [{'revno': log.revision.number,
41
 
                                  'author': log.author,
42
 
                                  'message': log.message,
 
45
                                  'author': log.author.decode('utf-8'),
 
46
                                  'message': log.message.decode('utf-8'),
43
47
                                  'date': log.date,
44
 
                                  'paths': [(p.path, p.action)
 
48
                                  'paths': [(p.path.decode('utf-8'), p.action)
45
49
                                            for p in log.changed_paths]}
46
50
                                 for log in logs]})
47
51
except pysvn.ClientError, e:
50
54
    try:
51
55
        code = e[1][0][1]
52
56
        # See subversion/include/svn_error_codes.h.
 
57
        # 150000: ERR_ENTRY_NOT_FOUND
53
58
        # 155007: WC_NOT_DIRECTORY.
 
59
        # 160006: FS_NO_SUCH_REVISION
54
60
        # 160013: FS_NOT_FOUND
55
61
        # 200005: UNVERSIONED_RESOURCE
56
 
        if code in (155007, 160013, 200005):
 
62
        if code in (150000, 155007, 160006, 160013, 200005):
57
63
            error = 'notfound'
58
64
        else:
59
 
            error = '%s (code %d)' % (error, code) 
 
65
            error = '%s (code %d)' % (error, code)
60
66
    except IndexError:
61
67
        pass
62
68