Edgewall Software
Modify

Opened 14 months ago

Last modified 6 days ago

#13861 new enhancement

Improve diff display

Reported by: Dirk Stöcker Owned by:
Priority: normal Milestone:
Component: version control Version: 1.6
Severity: normal Keywords:
Cc: chealer@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Philippe Cloutier <chealer@…>)

The diff functionality in trac has a very simple method to show changes in a line. In JOSM wiki we use this diff a lot for translation and I wanted a better display. The attached patch improves trac/versioncontrol/diff.py to highlight differences more specifically.

Example

old:
old state
new:
new state

Attachments (4)

update.diff (3.5 KB ) - added by Dirk Stöcker 14 months ago.
The diff as file
alt.png (183.6 KB ) - added by Dirk Stöcker 14 months ago.
old state
neu.png (179.5 KB ) - added by Dirk Stöcker 14 months ago.
new state
ticket13861.patch (8.0 KB ) - added by Dirk Stöcker 12 months ago.
Added missing changes (tests, docs)

Download all attachments as: .zip

Change History (13)

by Dirk Stöcker, 14 months ago

Attachment: update.diff added

The diff as file

by Dirk Stöcker, 14 months ago

Attachment: alt.png added

old state

by Dirk Stöcker, 14 months ago

Attachment: neu.png added

new state

comment:1 by Dirk Stöcker, 14 months ago

Description: modified (diff)

comment:2 by Jun Omae, 14 months ago

That is the same of (or probably related) #6858. I'll try the patch.

comment:3 by Dirk Stöcker, 14 months ago

I found one other usage of the function get_change_extent (without "s") in (mimeview/patch.py) which needs to be adapted as the one in diff.py. Code can be copied 1:1 it seems.

Yes. This seems identical to #6858, only for current codebase.

Last edited 14 months ago by Dirk Stöcker (previous) (diff)

comment:4 by Dirk Stöcker, 14 months ago

NOTE: Reverse sort is necessary, so the inserts of \0 and \1 are at correct positions.

by Dirk Stöcker, 12 months ago

Attachment: ticket13861.patch added

Added missing changes (tests, docs)

comment:5 by Dirk Stöcker, 12 months ago

I extended to patch to cover all necessary changes

comment:6 by Dirk Stöcker, 10 months ago

Using this 4 months now in JOSM trac. No negative effects.

comment:7 by Dirk Stöcker, 8 months ago

Beep

comment:8 by Philippe Cloutier <chealer@…>, 6 days ago

Cc: chealer@… added
Description: modified (diff)

Thank you very much Dirk, that looks like quite an improvement (judging from the provided example alone). I wish all of this could be handled by a library, but I'm glad your version seems to offload more of the work.👏

Is this about the source code browser only, or also improving the wiki and other components?

If I may:

  1. The variable names (new, n, e) could be more descriptive.
  2. "typles" should read "tuples".

This comment is from Philippe "Chealer" Cloutier. All of my comments and contributions in this ticket are offered under the terms of CC0 1.0 (unless otherwise noted).

comment:9 by Jun Omae, 6 days ago

I think we should keep the naming of the get_change_extent method because it is listed in __all__ and public.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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