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

« back to all changes in this revision

Viewing changes to services/svnlogservice

  • Committer: William Grant
  • Date: 2009-04-29 04:58:42 UTC
  • Revision ID: grantw@unimelb.edu.au-20090429045842-upijb1ybcbz1zg6u
Kill --nosvnrevno from setup.install - we don't use Subversion now.

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