Commit Graph

75 Commits

Author SHA1 Message Date
Alexander Plavin
d89a2b2e2e paper: show current search mode name at search results 2013-09-06 13:30:56 +04:00
Alexander Plavin
fb413116b4 paper: call ajaxScrollInit in shortlog
This just calls ajaxScrollInit at the shortlog page template with all needed
agruments. So, infinite scrolling is working now there.
2013-09-06 13:30:57 +04:00
Alexander Plavin
e1392e4ce2 hgweb: add revset syntax support to search
This mode is used when all the conditions are met:
- 'reverse(%s)' % query string can be parsed to a revset tree
- this tree has depth more than two, i.e. the query has some part of
revset syntax used
- the repo can be actually matched against this tree, i.e. it has only existent
function/operators and revisions/tags/bookmarks specified are correct
- no revset regexes are used in the query (strings which start with 're:')
- only functions explicitly marked as safe in revset.py are used in the query

Add several new tests for different parsing conditions and exception handling.
2013-09-06 13:30:56 +04:00
Alexander Plavin
eac9cb37ca hgweb: always run search when a query is entered (bc)
This changes the behavior for queries which point at a revision directly,
now the output is consistent to other cases: it results in only this matched
revision shown, not the log starting with it.
A new test checks this behaviour and fails for the old one.
2013-07-19 02:09:13 +04:00
Danek Duvall
dd1467f6d7 solaris: test cases can't use grep -a
The -a option to GNU grep isn't available when using Solaris grep.  Replace
the one use of grep -a in the testsuite with some in-line Python that does
the equivalent, and add a check for grep -a in check-code.py.
2013-08-23 14:31:42 -07:00
Alexander Plavin
9e521b740d paper: remove unused occurence of changelogtag in views
This variably isn't passed to these views and it always renders to empty string
for this reason. Other themes don't have this issue.
2013-08-03 00:34:56 +04:00
Alexander Plavin
f8894d94ab hgweb: always start graph with the revision in url
It is the same fix for graph command, as was recently for log. This makes the
specified revision be always on top of the graph view.
Before the patch, for example with repo having revisions 0, 1, 2, 3 and revision
in url being '2', all revisions were shown and the specified one wasn't
the first.
2013-07-25 02:48:21 +04:00
Alexander Plavin
39b918d7ca hgweb: always start log with searched revision
This makes the specified revision be always on top of the list.
Before the patch, for example with repo having revisions 0, 1, 2, 3 and user
searching for '2', all revisions were shown and the specified one wasn't
the first.
2013-07-13 02:36:29 +04:00
Alexander Plavin
af42bd5158 hgweb: make stripes in diffstat with CSS 2013-07-13 18:06:57 +04:00
Alexander Plavin
b7eaff030b hgweb: make stripes in log and search with CSS 2013-07-13 17:59:00 +04:00
Alexander Plavin
f6368c5d37 hgweb: add line wrapping switch to file diff and changeset views 2013-07-13 00:57:56 +04:00
Alexander Plavin
a55c9084f3 hgweb: file diff and changesets views behave like file source view
This gives all the benefits introduced before for file source view, namely
code selection without line numbers and correct indents, highlighting line
which is linked to, long lines wrapping.

Implementation strategy is also the same as for file source view: all the
lines are put in a sigle pre tag with span's for each line. Correct line
numbering (same as before this patch) is achieved with nested CSS counters.
2013-07-13 00:57:10 +04:00
Alexander Plavin
0c3cdee1bd hgweb: introduce separate classes for stripey background
Introduce stripes2 and stripes4 classes to support different structure.
They will be useful to implement stripes with pure CSS everywhere instead
of current server-side implementation.
2013-07-12 23:47:56 +04:00
Alexander Plavin
6e640b5a19 hgweb: add line wrapping switch to file source view
This uses classList property, which is well-supported now: both Chromium 8.0+,
Firefox 3.6+ and Opera 11.5+ support it, as well as relatively modern versions
of other browsers.
2013-07-12 15:58:13 +04:00
Alexander Plavin
4b47b3338d hgweb: toggleDiffstat function instead of showDiffstat and hideDiffstat
This eliminates the need of two almost equal functions, makes the code cleaner.
2013-07-12 16:01:11 +04:00
Alexander Plavin
b84ced8343 hgweb: show current search query in the input field 2013-07-11 17:01:54 +04:00
Alexander Plavin
c6105565d1 hgweb: code selection without line numbers in file source view
All the source lines are put in a <pre> tag, which gives correct display and
copy&paste in both Chromium (WebKit) and FireFox: line numbers are not copied,
all the tabs and spaces are kept. This doesn't change the visual appearance
of the view compared to current hgweb version and doesn't use any JS code.
Also, stripes in this view are now generated clientside with CSS.

This implementation is chosen because other variants have important issues:

Strategy             FF              Chrome

current             D,LT,E,T,L        D,L
pre                 S,NW              S,NW
pre/div/nbsp        LT,E,T,TS,NW      TS,NW
pre/div/br          LT,E,T,NW         NW
ol/li/nbsp          LT,E,T,TS,AJ      TS,AJ
ol/li/br            LT,E,T,AJ         AJ
pre/span            LV                LV

Legend

Strategies:
- current: implemented in hgweb before this patch, i.e. divs for each line,
and line numbers links in the div too
- pre: the whole code in one pre tag with newlines, all line numbers
in another one with 'float: left'
- pre/div/{nbsp,br}: same as just 'pre', but separate divs for each line and
&nbsp; or <br> instead of empty lines (otherwise they are not copied at all)
- ol/li/{nbsp,br}: a single ol with li's and divs for each line,
&nbsp; or <br> same as in previous strategy
- pre/span: this patch

Problems:
D = (very minor) display problems, like wrong width of leading tabs
LT = loses leading/trailing whitespace
E = loses embedded whitespace
B = loses blank lines
T = loses tabs
L = selects line numbers
LV = (only) visually selects line numbers
LVE = (only) visually selects line numbers at empty lines
S = no stripes (and no ability to easily highlight
lines-which-are-linked-at in the future)
TS = space copied instead of empty line
AJ = get anchor links only with JS (they work even without)
NW = no linewrap easily possible (in future)

As for browser versions compatibility, the CSS tricks used are supported in
(according to caniuse.com):
a) line numbers generation with 'content:' property and CSS counters:
IE 8+, all other popular browsers (in pre-WebKit Opera numbers are being copied)
b) stripes ('nth-child' selector):
IE 8+, FF 3.5+, Safari 3.2+, Opera 9.5+, all other popular browsers
c) line numbers are not visually selected ('user-select:' property):
IE 10+, Opera 15.0+, all other popular browsers

This patch is based on a demo implementation by
Martin Geisler <martin@geisler.net>.
2013-07-04 14:18:44 +04:00
Pierre-Yves David
e23948d63d hgweb: handle filtered "0" rev in navigation
Before this changeset, navigation generation crashed if revision "0" was
filtered. We introduce a `_first` methods on revision navigation that return the
lowest unfiltered element and use it in two place were the "0" changeset was
explicitly referenced.

Test case are introduced.
2013-04-30 13:53:49 +02:00
Alexander Plavin
86ea67ee62 css: fixed font-family
There is no 'sans' font-family, replaced with 'sans-serif'
2013-04-20 22:09:17 +04:00
Kevin Bullock
eb96ccda75 hgweb: make 'summary' work with hidden changesets (issue3810)
Since the 'summary' view used by e.g. gitweb and monoblue shows both a
changelog and a bookmarks list, the same changes are needed here as were
made to the 'changelog' and 'bookmarks' web commands (2be8fa4eef83 and
70f6745775fa, respectively).
2013-02-05 11:31:43 -06:00
Mads Kiilerich
33daab8991 hgweb.cgi: fix internal WSGI emulation (issue3804)
The internal WSGI emulation in wsgicgi.py was not fully WSGI compliant and
assumed that all responses sent a body. With a9df76d7ca1f that caused a real
bug when using hgweb.cgi.

wsgicgi.py will now make sure headers always are sent, using the pattern from
PEP 333 and similar to how it is done in 38e07483cc16.
2013-02-04 23:25:25 +01:00
Pierre-Yves David
090c6ed52d hgweb: returns 404 for unknow revision instead of 500
I noticed that access to filtered revision returned HTTP 500 code (internal
server error). Investigation shown that it was the case for unknown revision
too. That wrong and we now properly return a 404 for revision not found.
2013-01-31 22:30:52 +01:00
Pierre-Yves David
6c0cbcf3ba hgweb: remove baseline info from paper template
The user interface introduced in 3ff83729b63f is not considered ready
for prime time yet. The internal code stays in place for custom template
usage. The feature is ultimately wanted and will be re-enabled soon. The
current issue is only related to the visual of the current interface.
2013-02-01 05:40:06 +01:00
Pierre-Yves David
efe098ab89 hgweb: prevent traceback during search when filtered (issue3783)
The search needs to iterate over the repo using changelog.revs like the rest of
the Mercurial code.
2013-01-29 16:44:51 +01:00
Kevin Bullock
c8bd540ea2 bookmarks: hide bookmarks on filtered revs from listkeys
Don't expose unserved changesets to remote repos. Thanks to Sean Farley
<sean.michael.farley@gmail.com> for tracking down the issue and
Pierre-Yves David <pierre-yves.david@ens-lyon.org> for the fix.
2013-01-27 15:13:53 -06:00
Kevin Bullock
1c8e2cbcbd tests: improve description of hgweb secret bookmarks test
Added in 70f6745775fa with only an issue number to describe it.
2013-01-27 11:39:51 -06:00
Kevin Bullock
dd5421b6fc hgweb: don't attempt to show hidden bookmarks (issue3774)
localrepository._bookmarks is unfiltered, but hgweb gets a filtered
repo. This fixes the resulting traceback on the 'bookmarks' page.
2013-01-25 11:43:54 -06:00
Mads Kiilerich
722f02dca0 hgweb: generate query strings with parameters sorted by key 2012-12-12 02:38:14 +01:00
Bryan O'Sullivan
a527962b71 tests: update hgweb tests to include breadcrumbs 2013-01-08 16:16:29 -08:00
Angel Ezquerra
4108217b64 hgweb: add (Atom) subscribe link to the main paper template pages
The subscribe link is found at the bottom of the navigation sidebar.
This uses a free icon from http://feedicons.com.
2012-12-04 00:41:29 +01:00
Weiwen
64b5450a1f hgweb: display diff for a changeset against any parents (issue2810)
During merge of branches, it is useful to compare merge results against
the two parents.  This change adds this support to hgweb.  To specify
which parent to compare to, use rev/12300:12345 where 12300 is a
parent changeset number.  Two links are added to changeset web page so
that one can choose which parent to compare to.
2012-11-12 14:05:39 -08:00
Siddharth Agarwal
a03ea859ec hgweb: make the escape filter remove null characters (issue2567) 2012-10-15 09:43:34 -07:00
Mads Kiilerich
f815002da3 run-tests: allow test output lines to be terminated with \r in addition to \n
str.splitlines could not be used in 2d839579ce70, but _now_ we would like to
have lines with other line endings than \n.

Some fine occurences of (esc) markup of \r is replaced with multiple lines
ending with '\r (no-eol) (esc)'.  That is no win but also no significant loss.

This change makes it possible to drop filtercr.py - _that_ is a win.
2012-09-26 00:56:27 +02:00
Patrick Mezard
cad875fb81 Merge with stable 2012-09-17 21:53:50 +02:00
Tim Delaney
0872da322b hgweb: fix incorrect graph padding calculation (issue3626)
hgweb has an incorrect padding calculation, causing the text to move further
away from the graph the more branches there are (issue3626). This patch fixes
all existing templates (gitweb, monoblue, paper and spartan).

Tests updated by Patrick Mezard <patrick@mezard.eu>
2012-09-17 21:33:16 +02:00
Mads Kiilerich
88105479b7 hgweb: avoid bad $$ processing in graph (issue3601)
JavaScript .replace always magically processed $$ $& $' $` in replacement
strings and thus displayed subject lines incorrectly in the graph view.

Instead of regexps and .replace we now just create the strings the right way in
the first place.
2012-08-29 02:09:43 +02:00
Patrick Mezard
7d8680da1f killdaemons: take file argument explicitely
It makes it easier to use as a generic replacement for kill utility,
mostly for Windows tests.
2012-08-20 22:36:51 +02:00
Patrick Mezard
5ddea72e60 hgweb: fix graph view paging
- Fix off-by-one error on displayed entries count in normal mode
- Fix incorrect paging when the top revision was lower than revcount
- Fix revcount not overriding web.maxshortchanges everywhere
2012-07-29 23:16:20 +02:00
Ross Lagerwall
7ec5d4f25c hgweb: fix "branches" links in gitweb template
Tests fixed by Patrick Mézard <patrick@mezard.eu>
2012-07-30 08:18:25 +02:00
wujek srujek
a8963fc179 hgweb: side-by-side comparison functionality
Adds new web command to the core, ``comparison``, which enables colorful
side-by-side change display, which for some might be much easier to work with
than the standard line diff output. The idea how to implement comes from the
SonicHq extension.
The web interface gets a new link to call the comparison functionality. It lets
users configure the amount of context lines around change blocks, or to show
full files - check help (also in this changeset) for details and defaults. The
setting in hgrc can be overridden by adding ``context=<value>`` to the request
query string. The comparison creates addressable lines, so as to enable sharing
links to specific lines, just as standard diff does.
Incorporates updates to all web related styles.

Known limitations:
* the column diff is done against the first parent, just as the standard diff
* this change allows examining diffs for single files only (as I am not sure if
  examining the whole changeset in this way would be helpful)
* syntax highlighting of the output changes is not performed (enabling the
  highlight extension has no influence on it)
2012-07-08 17:17:02 +02:00
Mads Kiilerich
1fda0b1af1 tests: prepare get-with-headers.py for MSYS
get-with-headers.py took the http GET parameter as a command line parameter
that had to start with '/'. MSYS on windows will mangle such paths.

Instead of applying a workaround everywhere (such as an extra '/') we let
get-with-headers.py add the mandatory '/'. That is consistent with the
url path handling in the Mercurial url class.

A few tests sent 'GET ?cmd=...' which is invalid. They will now send 'GET
/?cmd=...'.

This will not enable any tests for being run on windows - only remove one
reason they were disabled.
2012-06-21 03:05:02 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Paul Boddie
5b2a1dc5f5 hgweb: make graph data suitable for template usage
Previously, graph data has been encoded for processing done by
JavaScript code run in the browser, employing simple structures
with implicit member positions. This patch modifies the graph
command to also produce data employing a dictionary-based
structure suitable for use with the templating mechanism, thus
permitting other ways of presenting repository graphs using that
mechanism.

In order to test these changes, the raw theme has been modified
to include templates for graph nodes and edges. In a similar
fashion, themes could employ technologies such as SVG that lend
themselves to templating to produce the graph display. This patch
makes use of a much simpler output representation than SVG in
order to maintain clarity.
2012-05-21 00:20:05 +02:00
Matt Mackall
dbfb64e582 hgweb: fix filediff base calculation
Previously, we were finding the most recent version of a file in a
changeset and comparing it against its first file parent. This was
wrong on three counts:

- it would show a diff in revisions where there was no change to a file
- it would show a diff when only the exec bit changed
- it would potentially compare against a much older changeset, which
  could be very expensive if git-style rename detection was enabled

This compares the file in the current context with that context's
parent, which may result in an empty diff when looking at a file not
touched by the current changeset.
2012-05-14 12:56:43 +02:00
Benoit Allard
ed90b14694 protocol: Add the stream-preferred capability
This makes the client use the uncompressed protocol.
2012-04-04 00:00:47 +02:00
Patrick Mezard
9737893642 hgweb: refactor graph customization javascript
- Avoid flipping lineWidth state around the edge() call, pass it to the
  function instead.
- Pass the line width and color appended to the other parameters instead of in
  a dictionary. The javascript code is simpler, no need to check for all
  containers existence, and the JSON output is smaller.
- Reindent setColor() comments and fix code spacing.
2012-01-22 19:35:26 +07:00
Patrick Mezard
23fea18b90 templates: move Graph.edge() implementation in mercurial.js
All implementation in graph.tmpl are the same. It can still be overriden if
necessary. There is no clear reason to keep it separated from mercurial.js.
2012-02-17 16:49:43 +01:00
Constantine Linnick
73bdfc9ad9 graph: in hgrc specify line color for main branch
You can specify color to visually distinguish main branch (trunk)
on hgweb's graph page. If color specified, all branch heads will share
same color. Settings format is branch_name.color = value, where color
is six hexadecimal digits e.g.:
[graph]
default.color = FF0000
2012-01-22 19:47:03 +07:00
Constantine Linnick
c28ce344f6 graph: in hgrc specify line width for main branch
You can specify width to visually distinguish main branch (trunk)
on hgweb's graph page. Settings format is branch_name.width = value,
where width in px e.g.:
[graph]
default.width = 3
2012-01-22 19:35:26 +07:00
Matt Mackall
a968007692 merge with stable 2011-12-08 16:01:44 -06:00