Feature #4232
open[ce, ee, pr, compare] redo diffs, support side by side diffs, html diffs
0%
Description
One of the most requested features is side by side diffs for multiple files at the same time (eg. pull request & compare pages).
Currently we have side by side diffs implemented for a single files only using the javascript library mergely. This doesn't include inline comments and uses different syntax highlighting to the rest of Rhodecode. Copy paste of code also works differently between the pr page and the side/side view.
There is another javascript diff library: https://diff2html.xyz/demo, which gives very good results, however integrating inline comments and context loading into this proved to be a lot of trouble, also the syntax highlighting doesn't support partial code blocks very well, eg:
51 this is the end of a doc string
52 """
53 return True
will mark the return True
part as a string.
Therefore the things we need in diffs are:
- Syntax highlighting based on the entire file, rather than the partial diff
- Inline comments + all relevant functionality
- Ajax file context loading (eg. click to load more lines of a file before/after the changed lines)
- In the browser conversion between raw/unified/side diffs - using JS
This will be exposed as a reusuable widget that can be used anywhere in Rhodecode, taking a diff reference as a sole argument.
The steps to create the diff are:
- Generate the diff chunks for each file
- Get the old and new versions of the files, highlight using pygments
- Use custom pygments renderer to generate the diff context:
- Using the original highlighted file lines which will have proper syntax highlighting colors
- Support both unified/sideside without modification
- Use a table that is copypaste friendly
- Add inline comments + functionality
- Expose load more file lines context functionality markers
- Render this in the template
- Apply javascript events lazily to avoid the overheads of adding events to every single element
This will also require an endpoint to get the partial N-M lines context of a file @ revision via ajax
Updated by Redmine Integration almost 8 years ago
Commit 158ce501aebc by Daniel Dourvaris daniel@rhodecode.com on default branch references this issue. https://internal-code.rhodecode.com/rhodecode-enterprise-ce/changeset/158ce501aebc2e78f486a7311633d189b754cfe9
Updated by Redmine Integration almost 8 years ago
pullrequest merged by marcink (status: approved). https://internal-code.rhodecode.com/rhodecode-enterprise-ce/pull-request/2804