/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/controllers/annotate_ui.py

  • Committer: Martin Albisetti
  • Date: 2008-11-17 18:12:14 UTC
  • mfrom: (241.1.1 abs_urls_tweak)
  • Revision ID: argentina@gmail.com-20081117181214-3ptqv5prg3dm9xzk
Use head in the download URL when viewing HEAD of BRANCH

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
    template_path = 'loggerhead.templates.annotate'
39
39
 
40
 
    def get_values(self, h, revid, path, kwargs, headers):
 
40
    def get_values(self, history, revid, path, kwargs, headers):
41
41
 
42
 
        revid = h.fix_revid(revid)
 
42
        revid = history.fix_revid(revid)
43
43
        file_id = kwargs.get('file_id', None)
44
44
        if (file_id is None) and (path is None):
45
45
            raise HTTPBadRequest('No file_id or filename '
46
46
                                 'provided to annotate')
47
47
 
48
48
        if file_id is None:
49
 
            file_id = h.get_file_id(revid, path)
 
49
            file_id = history.get_file_id(revid, path)
50
50
 
51
51
        # no navbar for revisions
52
52
        navigation = util.Container()
55
55
            path = h.get_path(revid, file_id)
56
56
        filename = os.path.basename(path)
57
57
 
 
58
        change = history.get_changes([ revid ])[0]
 
59
        # If we're looking at the tip, use head: in the URL instead
 
60
        if revid == history.last_revid:
 
61
            revno_url = 'head:'
 
62
        else:
 
63
            revno_url = history.get_revno(revid)
 
64
 
58
65
        # Directory Breadcrumbs
59
66
        directory_breadcrumbs = (
60
67
            util.directory_breadcrumbs(
64
71
 
65
72
        # Create breadcrumb trail for the path within the branch
66
73
        try:
67
 
            inv = h.get_inventory(revid)
 
74
            inv = history.get_inventory(revid)
68
75
        except:
69
76
            self.log.exception('Exception fetching changes')
70
77
            raise HTTPServerError('Could not fetch changes')
72
79
 
73
80
        return {
74
81
            'revid': revid,
 
82
            'revno_url': revno_url,
75
83
            'file_id': file_id,
76
84
            'path': path,
77
85
            'filename': filename,
78
86
            'navigation': navigation,
79
 
            'change': h.get_changes([revid])[0],
80
 
            'contents': list(h.annotate_file(file_id, revid)),
 
87
            'change': change,
 
88
            'contents': list(history.annotate_file(file_id, revid)),
81
89
            'fileview_active': True,
82
90
            'directory_breadcrumbs': directory_breadcrumbs,
83
91
            'branch_breadcrumbs': branch_breadcrumbs,