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

« back to all changes in this revision

Viewing changes to services/svnlogservice

  • Committer: Matt Giuca
  • Date: 2010-03-22 06:05:32 UTC
  • Revision ID: matt.giuca@gmail.com-20100322060532-5365361xrx9mh32v
Changed database.py get_svn_url to take a req; include the req.user.login in the Subversion URL. This allows you to check out repositories without separately supplying the IVLE URL (as Subversion won't ask for a username by default). Also removed --username= from the lecturer project view, as it's redundant now. This fixes Launchpad bug #543936.

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