Commit Graph

28 Commits

Author SHA1 Message Date
Thomas Keller
2e0995abac Fixed rendering in Firefox which did, unlike Chrome, not expand the last
row's height to fit the up-popping horizontal scrollbar, but all rows
just a little, so the heights did not match. I've reworked this to not
used the ill-advised rowspan any longer, but two separate tables whose
heights match each other now in both browsers.

Also I fixed a bug in the whitespace detection code - utf8 characters
where broken into single bytes, so apparently the [:print:] character
class does not accout for them, even in //u mode, so we're selecting
the characters that we want to make visible on our own (basically
control characters lower than space, I might add more).
2011-10-09 00:13:34 +02:00
Thomas Keller
b413b7ee89 Improve the calculation part and reuse the values we have from the diff hunks. 2011-10-06 02:31:36 +02:00
Thomas Keller
f19f07ec59 Change the unidiff rendering by letting the actual content be rendered
into a separate container that can overflow and side-scroll for long lines.

This effectively removes the need for all kinds of line-breaking hacks
that have been applied before and only worked when the browser was
actually able to break a word group apart somewhere.

Lines are now always rendered as-is; as a nice side effect the line numbers
are always visible, independently how far one scrolled into one direction,
so the context is always clear. If the rendering area is made smaller, the
table rendering also degrades gracefully and provides horizontal scrolling
for views that did not need them before.

The size that is occupied by the number display is now also automatically
determined by the size that is needed to render the biggest line number
in a column. Empty columns are rendered with a zero size.

Currently all this works nicely with a recent version of Chrome, Firefox
still needs some fine tuning for the vertical positioning. Other browsers
are untested as of now.
2011-10-06 02:06:51 +02:00
Thomas Keller
d0e2977746 Add support for line ending detection in our diff parser.
Line endings are now preserved during the diff parsing. When the diff
is then rendered later on, we replace non-printable characters by their
ordinal counterparts, so a user can easily grasp changes when a hunk
comes with edits that might be invisible at first.

The expected format for the diff test suite has changed from serialized
PHP to var_export, which is easier readable, editable and understandable,
while still keeping parsable as well.

Support for old Macintosh line endings could not be added, mainly because
modern SCMs do not support single \r in their unified diff output either
and working around and parsing these "lines" would have been a major
headache with not much outcome (given the fact that all Macs that have been
sold since 2001 or 2002 have been BSD-based and as such used Unix line
endings by default).

This commit fixes issue 636.
2011-10-05 02:44:04 +02:00
Thomas Keller
20c3f14cc8 git and hg diff views did not show empty context lines, a regression
from the commit(s) from issue 633. The diff parser assumed a properly
formatted diff that denotes empty context lines with a single space in
the first column. This single space however was missing, because the
hg and git backends got the diff through PHP's exec() function and
this returns already line-splitted output, but - and this is the actual
problem - removes trailing whitespace at the end of each line, essentially
making " \n" only "\n". When splitting this string now again with
PREG_SPLIT_NO_EMPTY the empty line was completely lost in the diff output.

To make it clear that an empty line does not mark a context line now, but
should stop the diff parsing, the Diff parser now also defaults to 'false'
as line type.

This commit fixes issue 688.
2011-06-02 00:48:38 +02:00
William MARTIN
5ea4b02205 Update copyrigt 2011-04-02 21:37:07 +02:00
Thomas Keller
5a7bf49cbb Well, I forgot the important stuff in the last commit, sigh. Fixes issue 633 for real now. 2011-03-18 01:05:25 +01:00
Thomas Keller
19b35565a2 Fix a notice about variable pass by reference 2011-03-17 01:10:59 +01:00
Patrick Georgi
baa88412b9 Rewrite the diff parser and reduce the memory footprint.
The diff parser code was rewritten for clarity and speed and now handles
a couple of ugly cornercases, like SVN's property change output and single
change chunks, much better. Since the path parsing was unified as well,
the SCM interface gained a new method `getPathStripLevel()` which determines
how many path components need to be shoven off a file name for the SCM
to form a valid path in the workspace (similar to patch(1)'s --strip option).
Fixes issue 627. Automated tests follow.
2011-03-16 23:50:41 +01:00
Patrick Georgi
336faa4503 Monotone's diff parsing conflicts with Subversion's - make sure we
do not let mtn recognize svn's underline that marks a new patch.
2011-01-30 00:14:35 +01:00
Thomas Keller
dffeb1f9d5 * move common file-specific functionality out of IDF_Views_Source into new
IDF_FileUtil and change all occurrences accordingly
* cache /etc/mime.types (or whatever is configured) per request in a static
variable in IDF_FileUtil
* always link directly to the download of attached files in the issues view
and place an additional "view" link only for those attachments which we
recognize as text with our weak criteria (closes issue 575)
2010-12-02 01:50:01 +01:00
Thomas Keller
4951498c0b Ignore pseudo diff stanzas which mention binary files. 2010-10-06 21:37:53 +00:00
Thomas Keller
7303e9dd58 return the correct file name for dropped files from monotone's diff output 2010-06-23 15:58:07 +02:00
Thomas Keller
15a2bd90b3 Add support for monotone's diff header 2010-05-01 00:56:48 +02:00
Loic d'Anterroches
838645463d Remove the PHP 5.3 deprecated split function. 2009-09-24 20:40:22 +02:00
Loic d'Anterroches
f028682900 Fixed issue 160, diff viewer in code reviews does not indent correctly. 2009-03-26 15:21:16 +01:00
Loic d'Anterroches
47f84bcb55 Fixed in a dirty way, should be improved. 2009-02-02 21:47:50 +01:00
Loic d'Anterroches
b7d1afb01e Fixed bug in the diff display when a single empty line was removed. 2009-02-02 21:42:31 +01:00
Loic d'Anterroches
d594b3412a Fixed issue 129, code review crashes on git diff files.
The diff parser tries now to skip the header and possible footer.
2009-02-02 20:55:45 +01:00
Julien Issler
c33b271519 Fixed issue 96, errors when parsing a Mercurial diff. 2008-12-30 18:21:04 +01:00
Loic d'Anterroches
f690968b11 Started ticket 39, add code review.
We now have a limited support of the code review. Still some work to be
done to allow the submission of new patches on a given review and update
the status. For the moment, only pre-commit review is supported.
2008-11-30 10:26:05 +01:00
Loic d'Anterroches
7ca43e0ec2 Updated the pretty print not to need extra <pre></pre>. 2008-11-15 21:23:29 +01:00
Nicolas Lassalle
5c32145e13 Added diff pretty print in the commit. 2008-11-15 21:10:37 +01:00
Loic d'Anterroches
9ac6e38e81 Added inline visualization of text files from the repository. 2008-11-11 22:32:01 +01:00
Nicolas LASSALLE
ccc41c86b0 Added support of subversion. 2008-08-29 19:50:10 +02:00
Loic d'Anterroches
4c5bd8d2be Fixed bug when looking at a commit which is a merge.
When you merge you do not get always a diff of files. This fix correct
that for the case of commit 9a2b8e249a.
2008-08-02 09:38:06 +02:00
Loic d'Anterroches
7d80632557 Added code indentation. 2008-08-01 00:50:44 +02:00
Loic d'Anterroches
80ce87009e Added a better commit diff. 2008-08-01 00:38:29 +02:00