* lib/viewvc.py
(DiffDescription.__init__): Don't set self.diff_options.
(DiffDescription.get_content_diff, DiffDescription.get_prop_diff):
Rename local variable 'options' to 'diff_options', and actually
populate *it* rather than the otherwise unused (and now removed)
'diff_options' class variable.
(DiffDescription._get_diff, DiffDescription._line_idiff_sidebyside,
DiffDescription._line_idiff_unified, DiffDescription._content_fp,
DiffDescription._prop_fp): Rename 'options' to 'diff_options'.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2818 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(DiffSource._get_row): Pass the "extra" line information through the
formatter code so that, at a minimum, it's HTML-escaped.
Patch by: Nicolás Alvarez <nicolas.alvarez{__AT__}gmail.com>
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2792 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(view_diff): Add 'cfg' convenience variable (to avoid a stack trace
caused by using such a thing a few lines later).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2790 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(view_log): Preserve the 'log_pagestart' query value when generating
the 'select for diff' links so that clicking the link returns you to
the same page (modulo repagination due to new commits in the race
window ... but let's not think about that). Also, preserve the
'r1' query parameter when generating the paging form.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2788 8cb11bc2-c004-0410-86c3-e597b4017df7
Add a new configuration option 'binary_mime_types' which accepts a
comma-delimited list of MIME content type patterns ('text/plain', or
'image/*', etc.) against which versioned file MIME types are
compared for the purposes of deciding whether to allow their display
in the 'markup', 'annotate', 'diff' and 'patch' views.
* conf/viewvc.conf.dist
(binary_mime_types): Describe new option.
* lib/config.py
(_force_multi_value): Add 'binary_file_types' to the list of
multi-value options.
(Config.set_defaults): Initialize cfg.options.binary_mime_types.
* lib/viewvc.py
(is_binary_file_mime_type): New function.
(get_file_view_info): Use is_binary_file_mime_type() to determine
whether to return links to content-ful views of the input file.
(markup_or_annotate, view_diff): Use is_binary_file_mime_type() to
deny display of so-deemed binary files.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2784 8cb11bc2-c004-0410-86c3-e597b4017df7
(LogFormatter.get): Fix a regression introduced in 1.1.14's handling
of log messages when not HTML-ifying them (for example, when serving
them up via RSS).
Patch by: Christoph Sommer <christoph.sommer{__AT__}uibk.ac.at>
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2771 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(markup_or_annotate): Don't forget to cross copies when requesting
the item's log.
* lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.itemlog): Treat 'svn_latest_log' option
specially, as in the svn_repos case. (Ugh.)
(RemoteSubversionRepository.annotate): Pass 'svn_show_all_dir_logs'
option to itemlog(). Also, upgrade to svn_client_blame2() API.
(RemoteSubversionRepository._get_last_history_rev): Now return both
the info-provided create_rev, and the more accurate
last_history_rev. Callers updated.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2770 8cb11bc2-c004-0410-86c3-e597b4017df7
viewer").
NOTE: There are some limitations here, most prominantly that commas
can't be used in the regular expressions which define replacements,
and that only match groupings 0-9 can be used in the replacement
format string.
* conf/viewvc.conf.dist
(custom_log_formatting): New configuration option.
* lib/config.py
(Config._force_multi_value, Config.set_defaults): Add handling of
new 'custom_log_formatting' option.
* lib/viewvc.py
(ViewVCHtmlFormatter.format_custom_url): New formatter callback.
(LogFormatter.get): Register the new formatter callback for rules
found in the 'custom_log_formatting' option value.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2746 8cb11bc2-c004-0410-86c3-e597b4017df7
for better performance").
* lib/viewvc.py
Replace uses of format_log() throughout with calls to LogFormatter()
(to get a formatter "lf") then lf.get() (to get the formatted log
string). Also...
(format_log): Remove as unused.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2741 8cb11bc2-c004-0410-86c3-e597b4017df7
better performance"), make the first step of two in trying to avoid
parsing log messages twice when once will suffice.
* lib/viewvc.py
(ViewVCHtmlFormatterTokens): New class for generating HTML-formatted
text from a set of provided ViewVCHtmlFormatter tokens.
(ViewVCHtmlFormatter.get_result): Track renamed function, and defer
the work of the text generation to the token object's get_result()
method.
(ViewVCHtmlFormatter.tokenize_text): Renamed from _tokenize_text(),
and now return a ViewVCHtmlFormatterTokens object.
(LogFormatter): New class for encapsulating the log formatting logic.
(format_log): Make a wrapper around LogFormatter for now.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2740 8cb11bc2-c004-0410-86c3-e597b4017df7
against the upstream version of this module.
* lib/common.py
(TemplateData): Moved here...
* lib/ezt.py
...from here.
* lib/query.py,
* lib/viewvc.py
Import 'TemplateData' from 'common' now, and update references to this
relocated class.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2711 8cb11bc2-c004-0410-86c3-e597b4017df7
(): Stop importing the pygments stuff at the module-global scope,
and go back to doing so...
(markup_stream): ...here.
(markup_or_annotate): No longer consider access to Pygments when
making the first pass at colorizing -- if we don't have it,
markup_stream() will fail quickly and we can take the second
(non-colorizing) pass.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2702 8cb11bc2-c004-0410-86c3-e597b4017df7
useful improvements to the syntax coloration and annotation codepaths.
First, settle on the file contents as fetched via repos.openfile() as
the canonical source of such. But also, allow any exceptions thrown
while colorizing those file contents to trigger a second attempt
without colorization enabled. This should allow for non-error-ful
display of binary files which lack both an extension and VC content
type hint (those are treated by default as text files).
* lib/viewvc.py
(markup_stream): Add docstring. Replace 'fp' parameter with
'file_lines' parameter. Add 'colorize' parameter. No longer try
to munge 'blame_data' -- expect that callers have done that. Lose
first_line tracking stuff, as fetching the first line of the file
is no longer destructive. Always use 'file_lines' as the source
of file contents; never the text attached to the 'blame-data'.
(markup_or_annotate): Rework this to do more of the cheap work of
annotating and markup up so that markup_stream() can be called
more than once if necessary -- once to attempt colorization, and
again without that feature if the first pass fails.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2698 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(): Try to import the pygments code at the global scope instead of...
(markup_stream_pygments): ...here. Add/move some comments, too.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2693 8cb11bc2-c004-0410-86c3-e597b4017df7
(markup_stream_pygments): Re-make the semantic changes from r2680,
which were (I believe) good ones, even if the lexer guessing stuff
hasn't yet work out entirely.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2686 8cb11bc2-c004-0410-86c3-e597b4017df7
For issue #501 ("Stack trace when trying to 'view' binary files"):
* lib/viewvc.py
(markup_stream_pygments): On second thought, allow guessing to
happen on non-None MIME types iff they appear to be text-y.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2681 8cb11bc2-c004-0410-86c3-e597b4017df7
For issue #501 ("Stack trace when trying to 'view' binary files"):
* lib/viewvc.py
(markup_stream_pygments): Rework the Pygments lexer-choosing logic a
bit. First, don't try any of it when syntax highlighting is
disabled. Secondly, don't guess at a lexer if we know the file's
MIME type and have already failed to get a matching lexer.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2680 8cb11bc2-c004-0410-86c3-e597b4017df7
(markup_or_annotate): Pass 'mime_type' to common_template_data() so
it can properly set the 'prefer_markup' bit. Otherwise, it will
guess without out svn:mime-type at its disposal.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2679 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(diff_side_item): Pass the option to repos.itemlog() which says to
include directory logs even for revisions in which the directory
itself was not explicitly modified (props changed).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2659 8cb11bc2-c004-0410-86c3-e597b4017df7
Finish issue #495 ("Syntax highlight/colorize scripts without
extensions").
* lib/viewvc.py
(markup_stream_pygments): Failing all else, use the Pygments
guess_lexer() function to guess a file's content type from the
first line of its text. (Most of this patch is compensation for
the first that if this heuristic codepath is traversed, we've eaten
a line of text from the file object that we don't expect to have
been eaten.
Patch by: Chris Mayo <cjmayo{__AT__}tigris.org>
(Tweaked by me.)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2657 8cb11bc2-c004-0410-86c3-e597b4017df7
(DiffSource): Do not switch to flush state. Such switch causes changes
to be displayed as removal and readdition.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2656 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(view_roots): Generate a log_href -- the revision log for the root
directory of the repository -- where it makes sense to do so.
* templates/classic/roots.ezt,
* templates/default/roots.ezt
Markup the last-modified-revision as a link to the log view where we can.
* docs/template-authoring-guide.html
Note the additional data dictionary item.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2653 8cb11bc2-c004-0410-86c3-e597b4017df7
* templates/classic/include/diff_display.ezt
* lib/viewvc.py
Rename 'display_as' to 'diff_block_format', as discussed on ML.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2650 8cb11bc2-c004-0410-86c3-e597b4017df7
dictionary item to 'diffs' for consistency with other multi-value
items. Yes, I know it makes the template usage itself weird
... "diffs.changes" instead of "diff.changes", but...
* lib/viewvc.py
(view_diff): Store the desc.changes in the 'diffs' data dictionary
item, not the 'diff' item.
* templates/diff.ezt
* templates/include/diff_display.ezt
Replace uses of 'diff' with 'diffs'. Selectively, of course.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2643 8cb11bc2-c004-0410-86c3-e597b4017df7
(Request.run_viewvc): Select diff view for directories if r1/r2 arguments
are provided.
(view_revision): Generate a link to diff view on directories if there was
a change in properties.
* log.ezt
(revision links): Generate 'diff to previous' and 'diff to selected' for
directories as well as files. Check for URL, not revision when determining
if 'diff to previous' link should be created (for consistency with 'diff
to selected')
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2626 8cb11bc2-c004-0410-86c3-e597b4017df7
(view_diff): Pass anchor locations to the diff template.
* diff_display.ezt
(top-level): Generate anchors.
* revision.ezt
(path links): Use anchors to point to content and property parts of the diff.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2625 8cb11bc2-c004-0410-86c3-e597b4017df7
(DiffDescription): Add support for property diffs.
(diff_side_item): Store properties hash in the side items.
(view_diff): Generate property diffs.
* diff_display.ezt
(headers): Indicate the property being diffed, if applicable.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2624 8cb11bc2-c004-0410-86c3-e597b4017df7
(DiffDescription): New class. Move the diff format selection and processing
to this new class. Split the processing into "preparation" and actual diff.
The ideas behind this new class are:
1. It will accumulate the diff "blocks". Currently, it will handle content and
properties. In the future, it can be easily reused to accumulate diffs for
recursive ("revision") diff.
2. It separates the diff method from the selection of content to be diffed.
We have two content inputs (content, properties), four formats (raw, traditional
side-by-side, intraline side-by-side, intraline unified). The former two expect
a stream (fp), the latter two expect array of lines. This class makes each of
these chunks separate from each other.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2622 8cb11bc2-c004-0410-86c3-e597b4017df7
(raw): Gracefully handle the case where there are no changes (output
"No changes" instead of not displaying anything).
* viewvc.py
(diff_parse_headers): Detect if there were no input from diff stream,
report RCSDIFF_NO_CHANGES in this case.
(view_diff): If binary/empty changes are detected, relay that information
to the template.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2621 8cb11bc2-c004-0410-86c3-e597b4017df7
(view_diff): In preparation for factoring out the "differ" code, make view_diff
always pass the differences as 'changes' array/stream. The format is now selected
via new 'display_as' argumnet.
* diff_display.ezt
(all formats): Accommodate changes in viewvc.py
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2619 8cb11bc2-c004-0410-86c3-e597b4017df7
(view_diff): Make diff an iterable (sequence); later property changes will be
added to the sequence. Pass hide_legend, left_rev, right_rev outside of the
diff[] array to untie diff.ezt from include/diff_display.ezt. Rename format
to diff_format for consistency with template name.
* diff.ezt
Same, plus small fixes in legend: capitalize first letter in 'changed',
refer to revision as such, not as 'v.XXX' - such references are not used
anywhere else.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2613 8cb11bc2-c004-0410-86c3-e597b4017df7
(view_diff): Factor out common code preparing left/right item information into a new
function, diff_side_item.
(diff_side_item): New function.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2607 8cb11bc2-c004-0410-86c3-e597b4017df7
(view_diff): Remove try-except block, exceptions are now handled in
setup_diff with more specific error messages. Merge the 'if fp'
block with the preceding conditional - which is the only way fp
is set to non-None.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2606 8cb11bc2-c004-0410-86c3-e597b4017df7
New file to house common definitions; _item and _RCSDIFF_*
for now. Remove local definitions in the rest of modules.
* idiff.py
(sidebyside, unified): Return _RCSDIFF_NO_CHANGES type if
the generator failed to yield anything else.
(sidebyside): Add type attribute to the returned tuple so
that template can check the type.
* diff_display.ezt
(top-level): Define messages to be used if diffs cannot be
displayed. Use the definitions in all non-raw displays.
(sidebyside,unified): Handle _RCSDIFF_IS_BINARY and
_RCSDIFF_NO_CHANGES; the former is not returned yet - will
be passed to the template once properties are diffed.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2605 8cb11bc2-c004-0410-86c3-e597b4017df7
(view_diff): Encapsulate into a single _item parts that would
be repeated when multiple "diffable" items will be passed to diff.ezt.
At that time, diff will be changed to a sequence.
* diff_display.ezt, diff.ezt
Prefix those repeatable parts with 'diff'.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2604 8cb11bc2-c004-0410-86c3-e597b4017df7