~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/diff_ui.py

  • Committer: Michael Hudson-Doyle
  • Date: 2012-01-23 21:10:07 UTC
  • mfrom: (461.2.1 bug-321325)
  • Revision ID: michael.hudson@linaro.org-20120123211007-ah835d7bc2s320l3
show exe bit changes on the revision page

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008  Canonical Ltd.
 
1
# Copyright (C) 2008-2011 Canonical Ltd.
2
2
#                     (Authored by Martin Albisetti <argentina@gmail.com>)
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
17
17
#
18
18
 
19
19
from cStringIO import StringIO
20
 
import logging
21
20
import time
22
21
 
23
22
from paste.request import path_info_pop
24
23
 
25
24
from bzrlib.diff import show_diff_trees
 
25
from bzrlib.revision import NULL_REVISION
26
26
 
27
27
from loggerhead.controllers import TemplatedBranchView
28
28
 
29
 
log = logging.getLogger("loggerhead.controllers")
30
 
 
31
29
 
32
30
class DiffUI(TemplatedBranchView):
33
31
    """Class to output a diff for a single file or revisions."""
49
47
        revid_from = self._history.fix_revid(revid_from)
50
48
        change = self._history.get_changes([revid_from])[0]
51
49
 
52
 
        if len(args) is 2:
 
50
        if len(args) == 2:
53
51
            revid_to = self._history.fix_revid(args[1])
 
52
        elif len(change.parents) == 0:
 
53
            revid_to = NULL_REVISION
54
54
        else:
55
55
            revid_to = change.parents[0].revid
56
56
 
72
72
        filename = '%s_%s.diff' % (revno1, revno2)
73
73
        headers = [
74
74
            ('Content-Type', 'application/octet-stream'),
75
 
            ('Content-Length', len(content)),
 
75
            ('Content-Length', str(len(content))),
76
76
            ('Content-Disposition', 'attachment; filename=%s' % (filename,)),
77
77
            ]
78
78
        start_response('200 OK', headers)