[PATCH 1 of 1 default] hgweb: column / side-by-side diff functionality

Patrick Mézard patrick at mezard.eu
Mon Jun 11 07:36:17 CDT 2012


Le 11/06/12 12:09, Laurens Holst a écrit :
> Op 10-06-12 21:20, Patrick Mézard schreef:
>>> I am not really convinced by the partial mode. Does it bring any
>>>> information compared to a regular diff, besides a different formatting? For
>>>> me, this file comparison view is really useful when diff does not give
>>>> enough context to understand the change, in which case I prefer to have the
>>>> full file.
>>>>
>>>> Compare:
>>>>
>>>> http://mezard.eu/hg/hg-does-it-look-good-for-you/diff/e1aa1ed30030/mercurial/revset.py
>>>>
>>>> http://mezard.eu/hg/hg-does-it-look-good-for-you/coldiff/e1aa1ed30030/mercurial/revset.py
>>>>
>>>> http://mezard.eu/hg/hg-does-it-look-good-for-you/coldiff/e1aa1ed30030/mercurial/revset.py?fullcoldiff=1
>>>>
>>>> I agree the last one would be better with a mean to navigate between
>>>> groups.
>>> It brings no additional information, I think, but it is just much easier to
>>> read than regular diff, and much more concise than full side-by-side diff,
>>> when the changes are scarce and at the end of a long file, for instance. In
>>> your example link, one needs to scroll a long way to find the changes.
>>> That's also because there is no UI to click to go to the next change, like
>>> IDEs do, but I am not sure if I can do it without processing the whole diff
>>> first, so that I can put such link at the top of a page (it is currently
>>> streamed with generators). I think that's what you mean 'navigate between
>>> groups'? Unless someone has another idea.
>>> In my company, when I introduced mercurial, one of the pain-points was that
>>> people said that they don't understand the regular diff (we use Jenkins CI
>>> and we can see what scm changes triggered the build, and people often check
>>> what others checked in), and showed me their old viewvc side-by-side diff.
>>> (That's actually the reason I decided to try and implement it.) That tool
>>> allows one to pick the full or partial mode, and since it isn't really a
>>> big deal to have it as well in hgweb, here it is. But it can be dropped
>>> easily ;d
>> Fine, I am not really surprised by the reasons behind it. I am not suggesting to drop it, but if you can read diffs, it is useless, so I question making it the default. Maybe the full version without navigation help is useless though. I would like to hear what people think, you can leave it as it is for now.
> 
> I like the short column diff.
> 
> The full one is not what I would use normally, but I would switch to it if I need more context than the short diff provides. Links to the next block would be good, I’m sure something simple can be made just by giving blocks a sequential ID and linking to the previous and next number. If the next link in the last block doesn’t have any effect, not a really big issue I think.
> 
> Actually ideally you would be able to variably specify the amount of context with an URL parameter. context=3 (default), context=5 (more), context=full (complete).

Sounds good to me.

Wujek, what do you think about replacing `fullcoldiff` with `fullcolcontext` or `comparisoncontext`, where a negative value would mean everything and a positive or nul one would be the maximum number of context lines surrounding the blocks? (SequenceMatcher.get_grouped_opcodes(n) supports this since 2.3, should not be too hard to change).

--
Patrick Mézard



More information about the Mercurial-devel mailing list