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

« back to all changes in this revision

Viewing changes to services/diffservice

  • Committer: William Grant
  • Date: 2009-12-08 03:50:24 UTC
  • mfrom: (1294.2.143 ui-the-third)
  • Revision ID: grantw@unimelb.edu.au-20091208035024-wjx8zp54gth15ph8
Merge ui-the-third. This is another UI revamp.

The header is now thin! Thin! The yellow bar is gone. The tabs are gone.
Breadcrumbs are here. Routes is replaced (with an object publishing
mechanism). Views are less repetitive. etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
# Override revisions from argv.
41
41
for ri in range(len(sys.argv[2:4])):
42
 
    r = ivle.svn.revision_from_string(sys.argv[ri])
 
42
    r = ivle.svn.revision_from_string(sys.argv[2 + ri])
43
43
    if r is not None:
44
44
        revs[ri] = r
45
45
 
46
46
# Attempt to get the diff for these revisons
47
47
try:
48
48
    svnclient = pysvn.Client()
 
49
    svnclient.exception_style = 1
49
50
    diff = svnclient.diff
50
51
    diff_text = diff( '/tmp/svndiff',
51
52
        os.path.join('/home', sys.argv[1]),
53
54
        revision2=revs[1]
54
55
    )
55
56
    print cjson.encode({'diff': diff_text})
56
 
except pysvn._pysvn_2_5.ClientError, e:
57
 
    print cjson.encode({'error': str(e)})
 
57
except pysvn.ClientError, e:
 
58
    error = e[0]
 
59
 
 
60
    try:
 
61
        code = e[1][0][1]
 
62
        # See subversion/include/svn_error_codes.h.
 
63
        # 150000: ERR_ENTRY_NOT_FOUND
 
64
        # 155007: WC_NOT_DIRECTORY.
 
65
        # 160013: FS_NOT_FOUND
 
66
        # 200005: UNVERSIONED_RESOURCE
 
67
        if code in (150000, 155007, 160013, 200005):
 
68
            error = 'notfound'
 
69
        else:
 
70
            error = '%s (code %d)' % (error, code) 
 
71
    except IndexError:
 
72
        pass
 
73
 
 
74
    print cjson.encode({'error': error})