[PATCH RFC] hgweb: improve annotate flow

Patrick Mézard pmezard at gmail.com
Fri Nov 18 12:37:35 CST 2011


Le 18/11/11 19:12, Matt Mackall a écrit :
> On Fri, 2011-11-18 at 15:10 +0100, Patrick Mezard wrote:
>> # HG changeset patch
>> # User Patrick Mezard <pmezard at gmail.com>
>> # Date 1321625296 -3600
>> # Node ID 95285db262b74b0db54d73b71380ee7251407800
>> # Parent  68b0ecd8ad4d0baaae3dfa6c784c69c02f365023
>> hgweb: improve annotate flow
>>
>> The current hgweb annotate flow looks like:
>>
>>   1- open file
>>   2- annotate file
>>   3- click on annotate link to open a new annotation
>>   4- switch to changeset, select parent changeset, browse files, pick file
>>   5- goto [1]
>>
>> This patch turns it into:
>>
>>   1- open file
>>   2- annotate file
>>
>>   3- click on annotate link to open the changeset at the right location
>>   4- look at the hunk and click on the annotate link on the left
>>   5- goto [3]
>>
>> You can test it by opening (the host is slow, not this patch):
>>
>>   http://mezard.eu/hg/hg-does-it-look-good-for-you/rev/c8e2a5ea7062
>>
>> and trying to find when and why the:
>>
>>   wctx.undelete([name])
>>
>> line I removed in the changeset was introduced in the first place. Then compare
>> with a regular setup, like:
>>
>>   http://hg.intevation.org/mercurial/crew/rev/c8e2a5ea7062
> 
> Very interesting. I'm afraid I've encountered a bug though:
> 
> http://mezard.eu/hg/hg-does-it-look-good-for-you/annotate/5564a618f6c4/mercurial/cmdutil.py#l316
> 
> links to:
> 
> http://mezard.eu/hg/hg-does-it-look-good-for-you/rev/5868dd69fb03/#t1.372
> 
> which doesn't exist?

It actually exists but there is nothing to scroll so it gives the impression the anchor is not there. Just look for 'id="t1.372"' in the page source. That said, the anchor generation is a little ad-hoc and I would not be surprised to find bugs in this area with complicated patches mixing binaries and renames.

Also, Javascript could be used here to highlight the target line or the target hunk and avoid this no-scroll issue (or even CSS if the id passed as a parameter as well).

>> Note 1: I am not an HTML guy, the new grey "ann" link in the changeset view
>> should at least be blue like the regular annotate one, and there are probably
>> better way to represent it. And I feel there ought to be better ways to do what
>> I did with the templating system.
>>
>> Note 2: the annotate step [3] could be skipped completely by moving from diffs
>> to diffs. This is a little harder to implement though, as the changeset command
>> would need to compute the annotate output to generate the "ann" links.
> 
> Well.. it could be done indirectly. This is the sort of thing people use
> AJAX for.

Well, if we want to skip the annotate page but still display "pmezard at 7879" instead of "ann", AJAX won't bring much except deferred computations. If we can live with "ann" we can also make a dedicated command performing the annotate and returning a 302 to the correct changeset view (but probably lose the anchor).

--
Patrick Mézard



More information about the Mercurial-devel mailing list