Modify ↓
Opened 21 years ago
Closed 21 years ago
#514 closed defect (fixed)
Trac's log view generates incorrect links in files that have been renamed
| Reported by: | Owned by: | Jonas Borgström | |
|---|---|---|---|
| Priority: | high | Milestone: | 0.8 |
| Component: | version control/log view | Version: | 0.7.1 |
| Severity: | major | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
The links to view previous revisions of a file may be incorrect if the file has previously been renamed. It appears that the code in source:/trunk/trac/Log.py#726 only takes into account the case where a single file or directory has been copied or renamed with history, as is the case when a new branch is created.
Attachments (0)
Change History (4)
comment:1 by , 21 years ago
comment:2 by , 21 years ago
| Milestone: | → 0.8 |
|---|---|
| Priority: | normal → high |
| Severity: | normal → major |
comment:3 by , 21 years ago
| Status: | new → assigned |
|---|
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Thanks, seems to work just fine!
Applied in [785].
Note:
See TracTickets
for help on using tickets.



As the Attach File button leads to an error page (Attachment not found) that prevents me from attaching a patch, here is a patch which fixes this ticket:
Index: trac/Log.py =================================================================== --- trac/Log.py (revision 726) +++ trac/Log.py (working copy) @@ -38,7 +38,7 @@ for newpath in changed_paths.keys(): change = changed_paths[newpath] if change.copyfrom_path: - self.branch_info[rev] = (change.copyfrom_path, newpath) + self.branch_info.setdefault(rev, []).append((change.copyfrom_path, newpath)) shortlog = shorten_line(log) t = util.svn_time_from_cstring(date, pool) / 1000000 @@ -68,10 +68,10 @@ for item in self.log_info: item['file_href'] = self.env.href.browser(path, item['rev']) if self.branch_info.has_key(item['rev']): - info = self.branch_info[item['rev']] - if path[:len(info[1])] == info[1]: - rel_path = path[len(info[1]):] - path = info[0]+rel_path + for info in self.branch_info[item['rev']]: + if path[:len(info[1])] == info[1]: + rel_path = path[len(info[1]):] + path = info[0]+rel_path return self.log_info def generate_path_links(self, rev, rev_specified):