Commit Graph

365 Commits

Author SHA1 Message Date
Denis Laxalde
aaf9382123 templates: add "changeset.obsolete" label in command line style
Following respective change in cmdutil.changeset_printer.
2017-03-25 10:40:29 +01:00
Denis Laxalde
f5bac903ae templates: shorten definition of changeset labels in command-line style
We'll add more labels and the line is already quite long, so let's define a
variable to hold all evolution "troubles" labels.
2017-03-28 22:38:45 +02:00
Denis Laxalde
3a0bd7f34e templates: use separate() to build changeset labels in command-line style 2017-03-28 22:36:22 +02:00
Denis Laxalde
996bd4af95 hgweb: handle a "linerange" request parameter in filelog command
We now handle a "linerange" URL query parameter to filter filelog using
a logic similar to followlines() revset.
The URL syntax is: log/<rev>/<file>?linerange=<fromline>:<toline>
As a result, filelog entries only consists of revision changing specified
line range.

The linerange information is propagated to "more"/"less" navigation links but
not to numeric navigation links as this would apparently require a dedicated
"revnav" class.

Only update the "paper" template in this patch.
2017-01-19 17:41:00 +01:00
Denis Laxalde
6b9779860f hgweb: add a "patch" query parameter to filelog command
Add support for a "patch" query parameter in filelog web command similar to
--patch option of `hg log` to display the diff of each changeset in the table
of revisions. The diff text is displayed in a dedicated row of the table that
follows the existing one for each entry and spans over all columns. Only
update "paper" template in this patch.
2017-03-13 10:41:13 +01:00
Gregory Szorc
ee826b7708 gitweb: use monospace font for commit messages
Commit messages often contain vertically aligned text. The default
paper style already uses monospace fonts for rendering commit messages.
And, AFAICT, a number of Git servers also render commit messages
with monospace. It seems like the reasonable thing to do.

This commit converts all instances of the full commit message
in the gitweb style to render with monospace.
2017-03-24 19:52:43 -07:00
Denis Laxalde
61ec8393d3 gitweb: add "more" and "less" navigation links in filelog template 2017-02-22 12:09:17 +01:00
Gregory Szorc
9849c580fb hgweb: support Content Security Policy
Content-Security-Policy (CSP) is a web security feature that allows
servers to declare what loaded content is allowed to do. For example,
a policy can prevent loading of images, JavaScript, CSS, etc unless
the source of that content is whitelisted (by hostname, URI scheme,
hashes of content, etc). It's a nifty security feature that provides
extra mitigation against some attacks, notably XSS.

Mitigation against these attacks is important for Mercurial because
hgweb renders repository data, which is commonly untrusted. While we
make attempts to escape things, etc, there's the possibility that
malicious data could be injected into the site content. If this happens
today, the full power of the web browser is available to that
malicious content. A restrictive CSP policy (defined by the server
operator and sent in an HTTP header which is outside the control of
malicious content), could restrict browser capabilities and mitigate
security problems posed by malicious data.

CSP works by emitting an HTTP header declaring the policy that browsers
should apply. Ideally, this header would be emitted by a layer above
Mercurial (likely the HTTP server doing the WSGI "proxying"). This
works for some CSP policies, but not all.

For example, policies to allow inline JavaScript may require setting
a "nonce" attribute on <script>. This attribute value must be unique
and non-guessable. And, the value must be present in the HTTP header
and the HTML body. This means that coordinating the value between
Mercurial and another HTTP server could be difficult: it is much
easier to generate and emit the nonce in a central location.

This commit introduces support for emitting a
Content-Security-Policy header from hgweb. A config option defines
the header value. If present, the header is emitted. A special
"%nonce%" syntax in the value triggers generation of a nonce and
inclusion in <script> elements in templates. The inclusion of a
nonce does not occur unless "%nonce%" is present. This makes this
commit completely backwards compatible and the feature opt-in.

The nonce is a type 4 UUID, which is the flavor that is randomly
generated. It has 122 random bits, which should be plenty to satisfy
the guarantees of a nonce.
2017-01-10 23:37:08 -08:00
Gregory Szorc
49f189afa0 hgweb: call process_dates() via DOM event listener
All the hgweb templates include mercurial.js in their header. All
the hgweb templates have the same <script> boilerplate to run
process_dates(). This patch factors that function call into
mercurial.js as part of a DOMContentLoaded event listener.
2017-01-10 20:47:48 -08:00
Denis Laxalde
ea885ed1d6 log: drop unnecessary ui.note label from "trouble: " line
Follow-up on 38b8a4a2230c and 3f2425cfd46f.
2017-01-07 12:07:56 +01:00
Denis Laxalde
b2aed04403 templates: display evolution "troubles" in command line style 2017-01-06 13:50:52 +01:00
Gregory Szorc
05ec82c913 hgweb: link to raw-file on annotation page (BC)
Every other template has the "raw" link load "raw-file." However,
fileannotate.tmpl's "raw" link loads "raw-annotate." This feels
inconsistent and wrong.

As far as I can tell, linking to the "raw annotate" view has occurred
since 2006.
2016-12-28 15:48:17 -07:00
Augie Fackler
067ebafd12 merge with stable 2017-01-04 14:52:59 -05:00
Denis Laxalde
d53254ecde templates-default: factor out definition of changeset labels
This is redundant for normal and debug mode and prepares extension of this
list that should effect both modes.
2017-01-03 13:25:29 +01:00
Anton Shestakov
dc9f869036 hgweb: add missing slash to file log url in rss style 2016-12-08 23:59:36 +08:00
Tooru Fujisawa
2c9ec77e6d hgweb: avoid line wrap between revision and annotate-info (issue5398)
Add white-space: nowrap to td.annotate to avoid wrapping div.annotate-info
into next line if there is revision number in the same cell, as it is hard to
mouse over div.annotate-info if it's wrapped into next line.
2016-10-08 19:32:54 +09:00
Anton Shestakov
9edbb61202 hgweb: make anchor name actually match its href on help index page 2016-09-26 16:12:40 +08:00
Anton Shestakov
ee2bc172f1 spartan: remove unused templates 2016-09-22 13:20:06 +08:00
Anton Shestakov
536b1ffbbb monoblue: remove unused templates 2016-09-22 13:19:44 +08:00
Anton Shestakov
81da141ef1 gitweb: remove unused templates 2016-09-22 13:19:25 +08:00
Anton Shestakov
c918f4c276 paper: remove unused templates 2016-09-22 13:18:59 +08:00
Anton Shestakov
a36ad7e757 paper: remove unused template "changelogchild" 2016-09-21 20:43:41 +08:00
Anton Shestakov
4592f62848 monoblue: remove unused template "changelogchild" 2016-09-21 20:43:10 +08:00
Anton Shestakov
db13f6eccd gitweb: remove unused template "changelogchild" 2016-09-21 20:35:46 +08:00
Anton Shestakov
e22c46613e monoblue: tweak branch table's last row's cell colspan on summary page
This table only has 3 columns, so max sensible colspan is 3.
2016-09-21 20:19:35 +08:00
Anton Shestakov
b13a9ea1f9 gitweb: tweak branch table's last row's cell colspan on summary page
This table only has 3 columns, so max sensible colspan is 3.
2016-09-21 19:52:48 +08:00
Matt Mackall
f6bd7a4c39 coal: use inheritance to derive from paper
This illustrates how much simpler this approach is, in particular the
effect of map-relative paths.
2016-08-17 13:43:13 -05:00
Anton Shestakov
a8830a1b95 spartan: make annotate popup use theme colors 2016-07-25 12:59:52 +08:00
Anton Shestakov
d6219ea1aa monoblue: make annotate popup use theme colors 2016-07-25 12:37:58 +08:00
Anton Shestakov
fbb5b06e2e gitweb: make annotate popup use theme colors 2016-07-25 12:33:18 +08:00
Anton Shestakov
bc4fdc78c0 paper: make annotate popup use theme colors 2016-07-25 12:22:17 +08:00
Anton Shestakov
b9d84939fc spartan: make different blocks of annotated lines have different colors 2016-07-16 15:06:19 +08:00
Anton Shestakov
1fd02e8fa3 monoblue: make different blocks of annotated lines have different colors 2016-07-16 15:06:04 +08:00
Anton Shestakov
5c14c79488 gitweb: make different blocks of annotated lines have different colors 2016-07-16 15:00:36 +08:00
Anton Shestakov
72f684f821 paper: make different blocks of annotated lines have different colors 2016-07-16 14:49:07 +08:00
Denis Laxalde
349c6778aa hgweb: add a link on node id in annotate hover-box
The link pointing the annotate view at this revision, just like the one in the
left-column but accessible from anywhere.
2016-07-12 15:09:07 +02:00
Denis Laxalde
0986e60532 hgweb: move author information from left-column to hover-box in annotate view
And display the full author information since there is enough space there.
2016-07-12 15:07:37 +02:00
Denis Laxalde
81b6a5375a hgweb: add links to diff and changeset in hover-box on annotate view 2016-06-14 11:01:30 +02:00
Denis Laxalde
07a35f6357 hgweb: add link to parents of annotated revision in annotate view
The link is embedded into a div with class="annotate-info" that only shows up
upon hover of the annotate column. To avoid duplicate hover-overs (this new
one and the one coming from link's title), drop "title" attribute from a
element and put it in the annotate-info element.
2016-06-28 11:42:42 +02:00
Gregory Szorc
5255c3f24b hgweb: expose list of per-repo labels to templates
hgweb currently offers limited functionality for "classifying"
repositories. This patch aims to change that.

The web.labels config option list is introduced. Its values
are exposed to the "index" and "summary" templates. Custom
templates can use template features like ifcontains() to e.g.
look for the presence of a specific label and engage specific
behavior. For example, a site operator may wish to assign a
"defunct" label to a repository so the repository is prominently
marked as dead in repository indexes.
2016-06-30 18:59:53 -07:00
Anton Shestakov
f13dffc250 hgweb: add absolute urls for archives in json-summary 2016-07-01 13:54:35 +08:00
Anton Shestakov
230d011cdc hgweb: reindent atom/changelogentry.tmpl
It was mixing tabs and spaces, and not in a good way.

Indent style of other atom entries seems to be 1 space per level, so let's
apply it here as well.
2016-06-29 22:48:32 +08:00
Anton Shestakov
e5788a6e8c hgweb: remove unused/nonexistent filelogentry from atom/map
filelog in atom style uses changelogentry to show commits, and
atom/filelogentry.tmpl doesn't even exist.
2016-06-29 21:07:59 +08:00
Anton Shestakov
385d153e4e hgweb: remove unnecessary CDATA markup in atom/branchentry.tmpl
Since content is of type "text" (and is already escaped), using a CDATA section
is not required.

Looks like this was just an artifact of copying things from rss style in
529b23a26574, because other entries in atom style don't use CDATA in such
places.
2016-06-29 20:58:09 +08:00
Anton Shestakov
b11305ab3e hgweb: reindent rss/changelogentry.tmpl
It was mixing tabs and spaces, and not in a good way.

Indent style of other rss entries seems to be 4 spaces per level, so let's
apply it here as well.
2016-06-29 20:19:04 +08:00
Anton Shestakov
71ef725f83 hgweb: remove a couple of superfluous spaces in rss style 2016-06-29 19:40:04 +08:00
Denis Laxalde
2acd032eb6 hgweb: display blamed revision once per block in annotate view
I.e. when a revision blames a block of source lines, only display the
revision link on the first line of the block (this is identified by the
"blockhead" key in annotate context).

This addresses item "Visual grouping of changesets" of the blame improvements
plan (https://www.mercurial-scm.org/wiki/BlamePlan) which states: "Typically
there are block of lines all attributed to the same revision. Instead of
rendering the revision/changeset for every line, we could only render it once
per block."
2016-06-07 12:10:01 +02:00
Denis Laxalde
c4ddd5ce73 hgweb: highlight data of the current revision in annotate view
* Distinguish the /annotate/<revision>/<file>#<linenumber> link when it would
  lead to the current page (i.e. <revision> is the current revision) (style it
  gray and undecorated). This indicates more clearly that this is a "dead-end"
  in blame navigation.

* Display lines changed in current revision in green.
2016-06-02 16:26:50 +02:00
Laura Médioni
077969174b templates: add support for search webcommand in json style 2016-06-10 10:31:42 +02:00
Laura Médioni
d95b4f5e78 templates: add support for summary webcommand in json style
Change summary webcommand to yield each element of the shortlog instead of the
entire list.

This makes generated json more readable since each entry can be formatted
separately, instead of returning all the shortlog content in a single string.
2016-06-06 15:14:11 +02:00