[PATCH] Add line anchors to annotate, changeset, diff, file views for hgweb

Edward Lee edilee at mozilla.com
Wed Sep 5 04:39:06 UTC 2007


This patch makes the line numbers into anchor tags with an id to link
to itself. The default and gitweb templates are updated to have
clickable line numbers for annotate, changeset, diff, and file views.

hgweb's ability to show the whole repository for any given changeset
is really useful, but it would be nice if we could refer to a
particular line of a file or changeset (such as for a bug report or
discussing a patch). This patch adds a couple new template-vars such
as lineid and linenumber.

-- Patch comments --

Refactored the |yield self.t()| do save on duplicate calls with the
same arguments.
http://74.136.196.179:8080/rev/5447b7e5ba45#l1.25

For changesets (and single file diffs), it'll only use the
"block.line" notation for the second block on. This makes single file
diffs nicer while keeping changeset views clean.
http://74.136.196.179:8080/rev/5447b7e5ba45#l1.21

I renamed the l variable to lineno to keep it consistent with the
other code blocks.
http://74.136.196.179:8080/rev/5447b7e5ba45#l1.48

Both the default and gitweb templates are edited in the patch, but
they can be easily removed if we want to leave it to the end user to
decide if they want linkable line numbers for diffs/changesets and
annotate. I would recommend it on by default for file views though.
http://74.136.196.179:8080/rev/5447b7e5ba45#l3.1
http://74.136.196.179:8080/rev/5447b7e5ba45#l2.1

Ed


More information about the Mercurial-devel mailing list