#1672 RFE - Add patch viewing to Issues
Merged by pingou. Opened by mreynolds.
mreynolds/pagure issue1382  into  master

Download 1672.patch

There are two issues here:

    [1] The current diff produced by html_diff() is lacking some important details.  Tabs and trailing white spaces are not correctly highlighted.  This commit creates a new pygment Style that is based off the current style "tango" and modifies it to use background color for changed lines for the html formatter which allows for the highlighting of trailing spaces.  Then a filter is added to the diff lexer that shows tabs, and allows trailing white spaces to be identified by the html formatter.
    [2] When opening an attachment in an "issue" check the file extension to see if its a patch/diff file.  If it is then render the file in html to get our nice "diff" output.  This makes reviewing patches that are attached to Issues much easier to evaluate.

1 new commit added

  • Issue 1382 - Add the new pygment style

Pretty sure that file wasn't there in 2014 :)

Could we undo this change here? I find it more readable as it was, sorry :(

I would leave the lines underneath as this doesn't document the coming method but tries to announce a new section in the code

Same here, I liked the previous way better, readability wise :(

here as well

Maybe use .partition() here to be safe?

You can drop the + at the end since you are between ()

Same as above :)

Few style changes and maybe one tweak in the python code the rest is looking good to me, thanks for this feature! :)

Yeah no problem. Sorry this patch is quite old (which why I want to get it wrapped up)

New commit pushed!

1 new commit added

  • Issue 1382 - Applying suggestions

Hm, with the change to setup.py, it looks like we can't run pagure outside a venv anymore, is that correct?
Which command is required? python setup.py develop?

Hm, with the change to setup.py, it looks like we can't run pagure outside a venv anymore, is that correct?
Which command is required? python setup.py develop?

Just these lines to pick up the new pygment style:

  • [pygments.styles]
  • diffstyle = pagure.ui.diff_style:DiffStyle

I'm not sure what command is needed. This patch is so old I don't recall if I did anything or not. I'll see if the pygment Style docs say anything....

The pygment docs don't say too much, except to add an entry point for the Style in setup.py/setuptools:

http://pygments.org/docs/plugins/

Sorry I'm not sure why this is breaking things

Ok, I had to fiddle a little but I could test it and it works nicely :)

Thanks!

rebased

Pull-Request has been merged by pingou

Metadata