Edgewall Software
Modify

Opened 20 years ago

Closed 20 years ago

#514 closed defect (fixed)

Trac's log view generates incorrect links in files that have been renamed

Reported by: mrowe@… 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 mrowe@…, 20 years ago

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):

comment:2 by anonymous, 20 years ago

Milestone: 0.8
Priority: normalhigh
Severity: normalmajor

comment:3 by Jonas Borgström, 20 years ago

Status: newassigned

comment:4 by Jonas Borgström, 20 years ago

Resolution: fixed
Status: assignedclosed

Thanks, seems to work just fine!

Applied in [785].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.