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

« back to all changes in this revision

Viewing changes to services/diffservice

  • Committer: David Coles
  • Date: 2009-07-21 02:19:56 UTC
  • mto: (1281.1.8 aufsless)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: coles.david@gmail.com-20090721021956-c1jiwu7fhi2dna1g
Updated to work on bind mounts

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
35
 
39
36
# Default revisions
40
37
revs = [pysvn.Revision(x) for x in [pysvn.opt_revision_kind.base,
51
48
    svnclient = pysvn.Client()
52
49
    svnclient.exception_style = 1
53
50
    diff = svnclient.diff
54
 
 
55
 
    # pysvn's diff tempfile behaviour changes with Subversion 1.6.x.
56
 
    # < 1.6 wants a filename, >= 1.6 wants a directory.
57
 
    if pysvn.svn_version > (1, 6):
58
 
        tmp_path = '/tmp'
59
 
    else:
60
 
        tmp_path = '/tmp/svndiff'
61
 
 
62
 
    diff_text = diff(tmp_path,
 
51
    diff_text = diff( '/tmp/svndiff',
63
52
        os.path.join('/home', sys.argv[1]),
64
53
        revision1=revs[0],
65
54
        revision2=revs[1]
66
55
    )
67
 
    print cjson.encode({'diff': diff_text.decode('utf-8')})
 
56
    print cjson.encode({'diff': diff_text})
68
57
except pysvn.ClientError, e:
69
58
    error = e[0]
70
59
 
71
60
    try:
72
61
        code = e[1][0][1]
73
62
        # See subversion/include/svn_error_codes.h.
74
 
        # 150000: ERR_ENTRY_NOT_FOUND
75
63
        # 155007: WC_NOT_DIRECTORY.
76
64
        # 160013: FS_NOT_FOUND
77
65
        # 200005: UNVERSIONED_RESOURCE
78
 
        if code in (150000, 155007, 160013, 200005):
 
66
        if code in (155007, 160013, 200005):
79
67
            error = 'notfound'
80
68
        else:
81
69
            error = '%s (code %d)' % (error, code)