Commit Graph

34 Commits

Author SHA1 Message Date
Anton Shestakov
403857c028 highlight: produce correct markup when there's a blank line just before EOF
Due to how the colorized output from pygments was stripped of <pre> elements,
when there was an empty line at the end of a file, highlight extension produced
an incorrect markup (no closing tags from the fileline/annotateline template).
It wasn't usually noticeable, because browsers were smart enough to see where
the missing tags should've been, but in monoblue style it resulted in the last
line having twice the normal height.

Instead of awkwardly trying to strip outer <pre></pre> tags, let's make the
formatter with nowrap=True, which should do what we need in pygments since at
least 0.5 (2006-10-30).

Example from monoblue style:

Before:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a>
    </div>

Now:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a> </pre>
</div>
    </div>

(Notice the missing </pre></div> now in place)
2015-07-22 10:19:17 +08:00
Anton Shestakov
d76c5b8c5a hgweb: link to revision by node hash in paper & coal
Unlike other styles, paper and coal had only one link to current revision: in
the sidebar. Since those links now use symbolic revisions after 4b263b99440b,
it's nice to have a link that allows going from /rev/tip to /rev/<tip hash>,
for instance. Let's make the node hash in the page header that new link.
2015-06-18 17:06:18 +08:00
Anton Shestakov
eb4bfc238e hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Let's make paper (and coal, since it borrows so much from paper) templates use
symbolic revision in navigation links.

The majority of links (log, filelog, annotate, etc) still use node hashes.

Some pages don't have permanent links to current node hash (so it's not very
easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
patches.
2015-06-16 16:07:39 +08:00
Matt Mackall
b709208c37 tests: drop DAEMON_PIDS from killdaemons calls 2015-06-08 14:55:40 -05:00
Matt Mackall
3ad28905f6 tests: drop explicit $TESTDIR from executables
$TESTDIR is added to the path, so this is superfluous. Also,
inconsistent use of quotes means we might have broken on tests with
paths containing spaces.
2015-06-08 14:44:30 -05:00
Anton Shestakov
4451d363dd paper: show branch/tags/bookmarks when blaming (issue3559) 2015-05-15 20:04:24 +08:00
Anton Shestakov
c6733e1dd2 paper: show branch/tags/bookmarks when viewing (issue3559) 2015-05-15 20:00:47 +08:00
Anton Shestakov
48ec2b2e8f hgweb: replace implicit <tbody> with explicit <thead> where appropriate
Some templates in paper style use <tbody> elements inside <table> to assign a
class to "body" part of that table (in this case, to make rows striped). The
problem is that the <tbody> is preceded by <tr> element, which browsers
understand as an implicit start of table body, so the following exlicit <tbody>
will actually be "nested", which is not valid.

Since that first <tr> contains table headers, wrapping it in <thead> is both
semantically correct and follows the advertised XHTML 1.1 doctype.
2015-02-06 15:52:55 +08:00
Augie Fackler
a5ddb1dcfe tests: use $PYTHON instead of hardcoding python
This makes running the testsuite with pypy possible.
2014-10-15 15:35:59 -04:00
Matt Mackall
11be5cc27c tests: replace exit 80 with #require 2014-08-06 11:43:59 -05:00
FUJIWARA Katsunori
98201640e7 hgweb: fix lack of "bookmarks" link in "/file" page of "paper" style
This patch also fixes same problem of "coal" style, because it re-uses
"filerevision.tmpl" of "paper" style.

"gitweb" and "monoblue" styles don't have such problems.

"spartan" style doesn't have "bookmarks" page definition itself.
2014-04-17 09:36:08 +09:00
Danek Duvall
4a6ebc20e6 solaris: diff -u emits "No differences encountered"
Solaris diff -u isn't silent when two files are identical, and tests that
don't account for that will fail.  Fix those tests, and introduce a check
that prevents reintroduction.
2014-02-19 13:46:49 -08:00
Alexander Plavin
8495f525a8 paper: edit search hint to include new feature description 2013-09-06 13:30:57 +04:00
Alexander Plavin
e94f8da7af paper: define searchhint message in map file and use it in other templates 2013-07-25 01:12:25 +04: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
793ff2d3f8 hgweb: highlight line which is linked to at annotate view 2013-07-14 05:35:04 +04:00
Alexander Plavin
fe02157bda hgweb: make stripes in file annotate view with CSS 2013-07-13 17:43:45 +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
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
Matt Mackall
fe3bd5fa6c tests: fix up test-highlight for breadcrumb changes 2013-01-09 19:10:44 -06: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
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
Martin Geisler
da730824fe paper, monoblue: link correctly to lines in annotate view
The links were to "foo#123" instead of "foo#l123". The gitweb and
spartan templates were already producing the correct links.
2012-05-04 12:04:07 +02:00
Mads Kiilerich
8415df7277 tests: use 'hghave serve' to guard tests that requires serve daemon management 2011-11-07 03:24:53 +01:00
Brodie Rao
aabbd72d18 hgweb: fix dynamic date calculation not working under Safari
While Chrome, Firefox, and IE 6+ support the current date format being
passed to Date(), Safari doesn't:

> new Date('Mon Oct 24 13:58:01 2011 +0200')
  Invalid Date

However, the rfc822date format--officially supported by
ECMAScript[1]--does work:

> new Date('Mon, 24 Oct 2011 13:58:01 +0200')
  Mon Oct 24 2011 04:58:01 GMT-0700 (PDT)

This change replaces all instances of {date|date} in HTML with
{date|rfc822date}. For elements that only have the "age" class,
there's no outward change for users with JavaScript enabled. For
elements with both the "age" and "date" classes, the full date
displayed uses the new format.

Tested in IE 6, Safari 5.1.1, Google Chrome 15, and Firefox 7.0.1.

[1]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse
2011-10-27 11:57:08 -07:00
Mads Kiilerich
6260903881 tests: cleanup of echo statements left over from test conversion 2011-10-13 04:27:49 +02:00
Benoit Boissinot
a266b51663 fix broken tests
test-debugcomplete.t broken by 7f2d537fe9fa
test-highlight.t broken by 064b658181dd
2011-04-30 11:16:52 +02:00
Patrick Mezard
3fe2303b35 test-highlight: fix test output (introduced by c1aafe72f67b) 2011-03-13 15:10:01 +01:00
Mads Kiilerich
8e085520f4 tests: use (esc) instead of other kinds of string escaping 2010-11-08 01:41:42 +01:00
Augie Fackler
954949fd67 hgweb: add help link to templates missed in 333983876439 2010-10-09 17:58:48 -05:00
Matt Mackall
48ba08be0f tests: unify test-highlight 2010-09-26 13:41:32 -05:00