* lib/vcauth/forbiddenre/__init__.py
(ViewVCAuthorizer._check_root_path_access): Lose 'rootname' and
'path_parts' parameters and logic to combine them; just accept the
combined form as a new 'root_path' parameter.
(ViewVCAuthorizer.check_root_access): Update call to
_check_root_path_access().
(ViewVCAuthorizer.check_path_access): Do root and path combination
here, and Update call to _check_root_path_access().
* viewvc.conf.dist
(forbiddenre.forbidden): Update documentation and examples.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1818 8cb11bc2-c004-0410-86c3-e597b4017df7
Fix the plus/minus line change counting in query results to ignore
values from unreadable files.
* lib/viewvc.py
(build_commit): Calculate total plus/minus line change count for a
given commit item (based on the sums of those values in
non-forbidden file commits associated with it).
(view_query): Update plus/minus line change count totals only
*after* trimming unauthorized files
* docs/template-authoring-guide.html
(query_results): Note new commits.plus and commits.minus items; fix
description of the plus_count and minus_count items.
While here, also:
* lib/viewvc.py
(build_commit): Fix the authz check to use vclib.check_path_access,
and feel vindicated by the fact that I actually found a use for
that function.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1816 8cb11bc2-c004-0410-86c3-e597b4017df7
message read thusly:
On the 1.0.x branch:
Fix buglets (and minor security leak) related to the files attached
to commit items in the query view and query.cgi script results. These
views still returned commit objects with all attached metadata even
when all the files associated with that commit were blocked due to
configured forbiddenness. The generic query.ezt template masked this
bug (because it was keyed on the files more so than on the commit
items), but query_results.ezt revealed it. Also, we were doing change
limiting at the wrong time, so you'd get results that showed 2 files
but read "Only first 5 files shown...".
* lib/viewvc.py
(build_commit): Trade the 'limited_files' parameter for a
'max_files' parameter, and change the way file counting and
filtering happens so we get accurate file counts and the maximum
number of allowed files when limiting changes. Now returns None
if the would-be-returned commit item has no associated allowed
files, and defers building of the commit item until necessary.
(view_query): Don't do file limiting here, defer it to
build_commit(). Also, watch for (and ignore) None returns from
build_commit(), too.
* lib/query.py
(run_query): Strip out commits which have no associated files.
Since commits in the query view are file-driven, the only way we
could have a commit that has no files is if the files were
stripped by forbiddenness checks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1804 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(_strip_suffix): If no path_parts are provided, return None.
(Request.run_viewvc): Tweak the 404 error to, among other things,
always have a leading slash on the path (so the empty path doesn't
look so odd).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1799 8cb11bc2-c004-0410-86c3-e597b4017df7
(LocalSubversionRepository.dirlogs): Oops! Fix a buglet caused by
looking at the wrong revision-holding variable.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1791 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/__init__.py
(Repository.dirlogs): Update comment.
(Revision.__init__): Add 'lockinfo' parameter, used to populate
similarly named class member.
* lib/vclib/svn/svn_repos.py
(Revision.__init__): Add 'lockinfo' parameter, and update call to
vclib.Revision().
(_log_helper): Update call to Revision(), and lose custom lockinfo handling.
(LocalSubversionRepository.dirlogs): Populate entry lockinfo with a
call to svn_fs_get_lock() for each entry.
* lib/vclib/svn/svn_ra.py
(LogCollector.__init__): Add 'lockinfo' parameter, used to populate
similarly named class member.
(LogCollector.add_log): Pass self.lockinfo to updated call to Revision().
(RemoteSubversionRepository.itemlog): Pass lock info to
LogCollector(), and lose custom lockinfo handling.
(RemoteSubversionRepository.itemtype, RemoteSubversionRepository.listdir):
Update expected return value from _get_dirents().
(RemoteSubversionRepository.dirlogs): Populate entry lockinfo from
updated return value from _get_dirents().
(RemoteSubversionRepository._get_dirents): Rework to trade in
dirents and locks instead of only dirents.
* lib/vclib/ccvs/bincvs.py
(Revision.__init__): Update call to vclib.Revision().
(_get_logs): Add 'lockinfo' member to DirEntry() items.
* lib/vclib/ccvs/ccvs.py
(InfoSink.__init__): Init lockinfo dictionary.
(InfoSink.set_locker): New.
(InfoSink.define_revision): Set lockinfo on Revision item.
(InfoSink.set_revision_info): Populate DirEntry lockinfo from
Revision lockinfo data.
* lib/viewvc.py
(view_directory): Populate entry lockinfo.
(common_template_data): Populate the 'lockinfo' data dictionary item.
* templates/directory.ezt,
* templates/dir_new.ezt
* templates/annotate.ezt,
* templates/markup.ezt
Tweak to show lock status.
* docs/template-authoring-guide.html
Note new data dictionary items.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1787 8cb11bc2-c004-0410-86c3-e597b4017df7
* docs/template-authoring-guide.html
Document the new appearances of the lockinfo data.
* templates/log.ezt,
* templates/log_table.ezt
Show lock status information.
* templates/docroot/images/lock.png
New icon.
* lib/viewvc.py
(view_log): Populate the log revision entry's new "lockinfo" member.
* lib/vclib/svn/svn_repos.py
(_log_helper): Accept 'lockinfo' parameter, used to populate the
similarly named member of the Revision() object.
(_fetch_log): Query the lock status of the input path, and update
calls to _log_helper().
* lib/vclib/ccvs/ccvs.py
(CCVSRepository.itemlog): Update call to _file_log(), passing lockinfo.
(TreeSink.__init__): Init new lockinfo dictionary.
(TreeSink.set_locker): New.
* lib/vclib/ccvs/bincvs.py
(_parse_log_header): Now parse and return lock information, too.
(_file_log): Add 'lockinfo' parameter, used to populate the
similarly named Revision() object members.
(BinCVSRepository._get_tip_revision, BinCVSRepository.itemlog):
Expect lockinfo back from _parse_log_header(), and pass to updated
calls to _file_log().
(_get_logs): Expect lockinfo back from _parse_log_header().
* lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.itemlog): Use svn_client_ls3() to fetch
lock information.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1783 8cb11bc2-c004-0410-86c3-e597b4017df7
format mode.
* lib/viewvc.py
(format_log): Now accept optional 'htmlize' parameter.
(build_commit): Accept 'format' parameter, and use it to determine
what value to pass for the 'htmlize' parameter of an updated call
to format_log().
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1779 8cb11bc2-c004-0410-86c3-e597b4017df7
(Config.get_authorizer_params): Rework this to avoid Python 2.4-ism
(dict.update() able to accept an iterable key/value sequence) and
to favor root-specific parameters over general ones.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1777 8cb11bc2-c004-0410-86c3-e597b4017df7
file view. This causes less-than-perfectly-compact URL generation in
some cases, but frankly, we'd have fewer URL-compatibility issues if
we hadn't been trying to discard information in the first place.
* lib/viewvc.py
(Request.run_viewvc, Request.get_link): Honor "markup" as a valid value for
default_file_view.
* viewvc.conf.dist
(default_file_view): Note that "markup" is now a valid option here.
* CHANGES
Record this change.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1775 8cb11bc2-c004-0410-86c3-e597b4017df7
unify the views themselves; just the code that generates them.
* lib/viewvc.py
(markup_or_annotate): New, carved from the guts of ...
(view_markup, view_annotate): ... these, which are now just thin
wrappers around markup_or_annotate().
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1772 8cb11bc2-c004-0410-86c3-e597b4017df7
(BlameSource._blame_cb): Increment the line number by 1;
Subversion's annotate APIs are 0-based.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1771 8cb11bc2-c004-0410-86c3-e597b4017df7
consistently returns a date, *not* a date string.
* lib/viewvc.py
(_get_diff_path_parts): Fix the call to _path_parts to, you know,
not reference bogus variables and actually use the value returned.
* lib/vclib/svn/svn_ra.py
(LastHistoryCollector.add_history): Convert the date string to a real date.
(temp_checkout): Keep a handle on the name of the temporary file
created, since that's what is returned by this function.
(rawdiff): Look for Subversion exceptions in the proper namespace.
* lib/vclib/svn/svn_repos.py
(_date_from_rev): Make this an inner function of rawdiff(), its only
consumer.
(_log_helper, LocalSubversionRepository.dirlogs): Don't convert the
returned date.
(LocalSubversionRepository._revinfo_raw): Return a date, not a date string.
(BlameSource.__init__): Expect exceptions in the right namespace.
(LocalSubversionRepository.rawdiff): Update call to _date_from_rev;
expect exceptions in the right namespace.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1770 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.open): Use self.ctx.*, not just ctx.*
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1769 8cb11bc2-c004-0410-86c3-e597b4017df7
checking all roots and paths against regular expressions.
* viewvc.conf.dist
(forbidden): New authz-forbiddenre section.
* lib/vcauth/forbiddenre,
* lib/vcauth/forbiddenre/__init__.py
New authorizer based on simple regular expressions.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1763 8cb11bc2-c004-0410-86c3-e597b4017df7
(Request.__init__): Stop calculating and storing the 'may_compress'
and 'no_file_links' values -- we don't use them anywhere!
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1749 8cb11bc2-c004-0410-86c3-e597b4017df7
Note that we now expect source-highlight 2.6.
* templates/docroot/styles
Add style definitions to match the style names used by
source-highlight.
* lib/viewvc.py
(MarkupSourceHighlight.__init__): Use the 'xhtml-css' output format,
and pass the --quiet option to suppress any noise that would
wind up on stderr.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1748 8cb11bc2-c004-0410-86c3-e597b4017df7
reducing the list of binary dependencies by one for users of ... well,
any Python version that I could find as of at least 1.5.2.
TODO: Are there any versions of Python supported by ViewVC in general
that don't provide the 'gzip' module? Should we just rip out the use
of the external binary altogether?
(This was tracked in issue #319.)
* lib/viewvc.py
(download_tarball): Use Python's gzip module if available, only
falling back to a pipe through the gzip binary if it isn't.
* viewvc.conf.dist
(cfg.utilities.gzip): Note that this setting is optional if Python
provides the 'gzip' module.
Patch by: Gabriel Genellina <ggenellina@tigris.org>
(Tweaked by me.)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1747 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(common_template_data): Calculate and add 'roots_href' to the dictionary.
* templates/include/header.ezt
Use new 'roots_href' data dictionary item.
* docs/template-authoring-guide.html
Note this new dictionary member.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1746 8cb11bc2-c004-0410-86c3-e597b4017df7
branch. This reduces the number of vclib plugins to two -- one for
each of CVS and Subversion.
* lib/viewvc.py
(): Update callers of vclib.svn.created_rev(), vclib.svn.get_location(),
vclib.svn.get_youngest_revision(), and vclib.svn.last_rev() to use
request.repos.* instead.
(Request.run_viewvc): For CVS, invoke only
vclib.ccvs.CVSRepository(), but pass the use_rcsparse setting to
it. For Subversion, invoke only vclib.svn.SubversionRepository().
* lib/vclib/ccvs/ccvs.py
Renamed from lib/vclib/ccvs/__init__.py, and tweaked to look for
stuff common to the bincvs implementation in the sibling 'bincvs'
module.
* lib/vclib/ccvs/__init__.py
New, a replacement by a new stub file with a factory function
that selects which CVS implementation to use.
* lib/vclib/ccvs/bincvs.py
Moved from lib/vclib/bincvs/__init__.py.
* lib/vclib/bincvs
Removed (it's now empty).
* lib/vclib/svn/svn_repos.py
Renamed from lib/vclib/svn/__init__.py.
(LocalSubversionRepository.created_rev,
LocalSubversionRepository.get_location,
LocalSubversionRepository.get_youngest_revision,
LocalSubversionRepository.last_rev): Moved into the class from outside.
* lib/vclib/svn/svn_ra.py
Moved from lib/vclib/svn_ra/__init__.py.
(RemoteSubversionRepository.created_rev,
RemoteSubversionRepository.get_location,
RemoteSubversionRepository.get_youngest_revision,
RemoteSubversionRepository.last_rev): Moved into the class from outside.
* lib/vclib/svn/__init__.py
New, replacing previous incarnation with a file that contains only a
single factory function.
* lib/vclib/svn_ra/
Removed (it's now empty).
* bin/loginfo-handler
(ProcessLoginfo): Now use vclib.ccvs.CVSRepository(), disabling use_rcsparse.
* bin/cvsdbadmin
(__main__): Now use vclib.ccvs.CVSRepository(), disabling use_rcsparse.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1739 8cb11bc2-c004-0410-86c3-e597b4017df7
The new method will work even if the contents of the "rcsparse"
directory are stored to a directory with a different name (as is the
case, for example, in cvs2svn).
* lib/vclib/ccvs/rcsparse/run-tests.py: Change how rcsparse.parse()
and parse_rcs_file.LoggingSink are imported.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1734 8cb11bc2-c004-0410-86c3-e597b4017df7
The new method will work even if the contents of the "rcsparse"
directory are stored to a directory with a different name (as is the
case, for example, in cvs2svn).
* lib/vclib/ccvs/rcsparse/parse_rcs_file.py: Change how
rcsparse.parse() is imported.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1733 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser._read_until_semicolon):
New method.
(_Parser._parse_admin_access, _Parser._parse_rcs_tree_entry): Use
the new method.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1732 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
Adjust the handling of dates to conform more strictly to
rcsparse(5), and simplify logic a bit.
* lib/vclib/ccvs/rcsparse/test-data/default,v,
lib/vclib/ccvs/rcsparse/test-data/default.out: Change test case to
include dates before the year 2000.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1731 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
Append zeros to the end of the date tuple only when they are needed.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1730 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
New method, extracted from parse_rcs_tree().
(_Parser.parse_rcs_tree): Use new method.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1728 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_access):
Simplify logic and use list.append(x) instead of "list = list +
[x]".
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1727 8cb11bc2-c004-0410-86c3-e597b4017df7
This simplifies the code without a measureable performance cost.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_head,
_Parser._parse_admin_branch, _Parser._parse_admin_comment,
_Parser._parse_admin_expand): Use the token scanner's match() method
to handle semicolons.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1725 8cb11bc2-c004-0410-86c3-e597b4017df7
Previously, they raised a naked RuntimeError. This change should be
harmless because nobody seems to catch these exceptions specifically.
* lib/vclib/ccvs/rcsparse/default.py (_TokenStream.match): Raise
RCSExpected exception in the case of a mismatch.
* lib/vclib/ccvs/rcsparse/texttools.py (_mxTokenStream.match): Raise
RCSExpected exception in the case of a mismatch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1724 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (RCSExpected.__init__): Improve
the error message passed to the base class constructor. Also
improve spacing around the exception class definitions.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1723 8cb11bc2-c004-0410-86c3-e597b4017df7
According to rcsfile(5), there don't have to be any deltas in an RCS
file. File without deltas can be created using "rcs -i -t- foofile".
This change allows rcsparse to handle such files.
This change might help fix cvs2svn Issue #80:
http://cvs2svn.tigris.org/issues/show_bug.cgi?id=80
* lib/vclib/ccvs/rcsparse/common.py (_Parser.admin_token_map): Add an
entry for "desc" (because if the tree is empty, the next thing
encountered after the administrative information is "desc").
(_Parser.parse_rcs_admin): Terminate loop if "desc" is seen.
* lib/vclib/ccvs/rcsparse/test-data/empty-file,v,
lib/vclib/ccvs/rcsparse/test-data/empty-file.out: Add a test RCS
file with no contents to test data, and the results expected when
parsing the file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1721 8cb11bc2-c004-0410-86c3-e597b4017df7
According to rcsfile(5), this is allowed. In this situation, don't
invoke the set_head_revision() callback at all.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_head): Handle
the case that the "head" keyword doesn't list a revision.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1720 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser.parse_rcs_admin): Remove
dead code (the only way to escape from the loop is via "return").
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1719 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_head,
_Parser._parse_admin_branch, _Parser._parse_admin_access,
_Parser._parse_admin_symbols, _Parser._parse_admin_locks,
_Parser._parse_admin_strict, _Parser._parse_admin_comment,
_Parser._parse_admin_expand): New methods (one for each keyword that
can appear in the admin section).
(_Parser.admin_token_map): A map from keyword name to the method
used to handle that keyword.
(_Parser.parse_rcs_admin): Look up the keyword tokens in the map
instead of using a big "if" statement.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1718 8cb11bc2-c004-0410-86c3-e597b4017df7
This makes the keyword handling more uniform.
* lib/vclib/ccvs/rcsparse/common.py (_Parser.parse_rcs_admin):
Separate handling of the "strict" keyword into a separate "if"
branch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1717 8cb11bc2-c004-0410-86c3-e597b4017df7
Order the callbacks in Sink and the "if" branched in parse_rcs_admin()
in the approximate order that they will be encountered.
* lib/vclib/ccvs/rcsparse/common.py (Sink): Reorder method definitions.
(_Parser.parse_rcs_admin): Reorder "if" statement branches.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1716 8cb11bc2-c004-0410-86c3-e597b4017df7
Submitted by: Michael Haggerty <mhagger@alum.mit.edu>
* lib/vclib/ccvs/rcsparse/run-tests.py: New file.
* lib/vclib/ccvs/rcsparse/test-data/default,v,
* lib/vclib/ccvs/rcsparse/test-data/default.out
Test data for a simple test.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1712 8cb11bc2-c004-0410-86c3-e597b4017df7
Submitted by: Michael Haggerty <mhagger@alum.mit.edu>
This script was taken from the cvs2svn project, http://cvs2svn.tigris.org.
* lib/vclib/ccvs/rcsparse/parse_rcs_file.py: New demonstration script;
illustrates the use of the rcsparse API.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1711 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/viewvc.py
(view_diff): Rework the data dictionary: provide 'left' and 'right'
container objects with members for stuff related to the files on
the left and right side of the diff. Also, add the usual
per-file-revision view links to those containers, too.
* templates/diff.ezt
Track the data dictionary changes, and add links to the preferred
file views for each revision.
* docs/template-authoring-guide.html,
* docs/upgrading-howto.html
Note template changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1701 8cb11bc2-c004-0410-86c3-e597b4017df7