~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/revision_ui.py

  • Committer: Danilo Segan
  • Date: 2011-09-02 10:22:52 UTC
  • mfrom: (455.1.2 bug-839395)
  • Revision ID: danilo@canonical.com-20110902102252-phc11upmjw8tz1mg
[r=jam][bug=839395] Do not crash when someone asks to look at per-revision changes for a file when file is not changed in a certain revision.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
        link_data = {}
119
119
        path_to_id = {}
120
120
        if path:
121
 
            item = [x for x in file_changes.text_changes if x.filename == path][0]
122
 
            diff_chunks = diff_chunks_for_file(
123
 
                self._history._branch.repository, item.file_id,
124
 
                item.old_revision, item.new_revision)
 
121
            items = [x for x in file_changes.text_changes if x.filename == path]
 
122
            if len(items) > 0:
 
123
                item = items[0]
 
124
                diff_chunks = diff_chunks_for_file(
 
125
                    self._history._branch.repository, item.file_id,
 
126
                    item.old_revision, item.new_revision)
 
127
            else:
 
128
                diff_chunks = None
125
129
        else:
126
130
            diff_chunks = None
127
131
            for i, item in enumerate(file_changes.text_changes):