Commit Graph

938 Commits (8916fe396952405f7fa9f837159fd6f14f6882f3)

Author SHA1 Message Date
cmpilato 8916fe3969 Forward-port tweak to forbiddenre support made in r1817 on the 1.0.x branch.
* 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
2008-02-25 21:07:06 +00:00
cmpilato 301281228b merge from 1.0.x -r1815, whose log message read thusly:
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
2008-02-25 19:32:21 +00:00
cmpilato af559e2665 Fix a buglet that, for some reason, only shows up when viewing CVSROOT
directories.

* lib/vclib/ccvs/bincvs.py
  (_get_logs): Initialize CVSDirEntry item's lockinfo member to None.

* lib/vclib/ccvs/ccvs.py
  (CCVSRepository.dirlogs): Initialize CVSDirEntry item's lockinfo
    member to None.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1808 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 21:59:45 +00:00
cmpilato 8dadbb3674 Honor hide_cvsroot more like the CVSROOT is forbidden than simply obscured.
* lib/viewvc.py
  (is_cvsroot_path): New helper function.
  (view_directory, generate_tarball, build_commit): Use is_cvsroot_path().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1806 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 21:41:17 +00:00
cmpilato 0e129c4c77 Forward-port the r1800 bugfixes made in the 1.0.x branch, whose log
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
2008-02-21 20:26:58 +00:00
cmpilato 08e86c9a45 Minor fixes required by new authz logic.
* 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
2008-02-15 20:50:22 +00:00
cmpilato 7cf7328238 * lib/vclib/svn/svn_repos.py
Tweak all uses of vclib.svn.core.* to be just core.*


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1794 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-13 21:34:31 +00:00
cmpilato 10fa46063c * lib/vclib/svn/svn_repos.py
(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
2008-02-13 17:39:12 +00:00
cmpilato 3cbf07551b Finish issue #57 with more support for showing locked status.
* 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
2008-02-12 21:06:40 +00:00
cmpilato d620498e9e Add support for display of locked status.
* 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
2008-02-12 19:41:19 +00:00
cmpilato 2a9584a0fb Finish issue #238 by not making HTML out of short log messages in RSS
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
2008-02-12 15:29:28 +00:00
cmpilato 34f764bc8f * lib/config.py
(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
2008-02-12 15:02:41 +00:00
cmpilato cedb97c3d4 Finish issue #305 by allowing "markup" to be the configured default
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
2008-02-11 22:16:00 +00:00
cmpilato e0dff2601a Mostly unify the markup and annotate view logic. This does *not*
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
2008-02-11 20:51:56 +00:00
cmpilato fcf52b5c5f * lib/vclib/svn/svn_repos.py
(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
2008-02-11 20:47:11 +00:00
cmpilato 8f0623abc0 This is a cleanup commit, mostly around making sure that Repository.revinfo()
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
2008-02-11 16:53:20 +00:00
cmpilato c3572f452c Fix a little buglet -- referencing a non-existant object.
* 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
2008-02-07 22:53:16 +00:00
cmpilato 057ab0fe25 Introduce a new authz module, like 'forbidden' but with support for
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
2008-02-06 21:16:51 +00:00
cmpilato 220792f72c Merge to trunk all the changes from the 'vcauth-reorg' branch as of
r1761, which see for logs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1762 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-06 19:22:53 +00:00
cmpilato c696f32d70 * lib/config.py
(Config.set_defaults): Clear the default admin address.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1758 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-06 17:48:45 +00:00
cmpilato 3a8717b11d Formatting and comment changes only.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1750 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-01-28 17:55:44 +00:00
cmpilato edaae720da * lib/viewvc.py
(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
2008-01-28 17:46:23 +00:00
cmpilato eb363507cb * INSTALL
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
2008-01-24 22:02:19 +00:00
cmpilato 44f0356312 Try to use Python's gzip module for the tarball generation view, thus
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
2008-01-24 19:40:37 +00:00
cmpilato d966338c1d Add an href to the root listing view to the common template data dictionary.
* 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
2008-01-10 19:21:26 +00:00
cmpilato aa6b9dcf8e Merge changes (r1735:1738) from the (misnamed) options-overhaul
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
2007-12-03 15:25:51 +00:00
mhagger 37373d8ab2 Change the way that rcsparse components are imported in run-tests.py.
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
2007-11-18 22:59:09 +00:00
mhagger 5ab76ea1cf Change the way that rcsparse.parse() is imported in parse_rcs_file.py.
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
2007-11-18 22:53:35 +00:00
mhagger 0e6c162246 Add method _Parser._read_until_semicolon(), and use it in other methods.
* 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
2007-11-18 21:15:27 +00:00
mhagger 1f2a3399ea Fix and simplify the handling of dates in _Parser._parse_rcs_tree_entry().
* 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
2007-11-18 21:13:53 +00:00
mhagger 53b48c9b4f Don't carry zeros along in date tuple.
* 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
2007-11-18 21:05:16 +00:00
mhagger e906090e8c Simplify _Parser._parse_rcs_tree_entry().
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
  Simplify logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1729 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 21:01:16 +00:00
mhagger af7956447b Extract method _Parser._parse_rcs_tree_entry().
* 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
2007-11-18 21:00:21 +00:00
mhagger 939c980e5b Simplify _Parser._parse_admin_access().
* 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
2007-11-18 20:59:01 +00:00
mhagger 7a8d3c0453 Rename some local variables to better describe their uses.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_access,
  _Parser._parse_admin_symbols, _Parser._parse_admin_locks): Rename
  local variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1726 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:58:00 +00:00
mhagger 7e0b5d2a9c Use match() to handle semicolons when possible.
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
2007-11-18 20:57:02 +00:00
mhagger d7c87b8b2f Change the token stream match() methods to raise RCSExpected exceptions.
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
2007-11-18 20:56:26 +00:00
mhagger 8087c0e643 Improve the error message for RCSExpected exceptions.
* 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
2007-11-18 20:53:40 +00:00
mhagger 4c04da27da Simplify the logic in texttools._mxTokenStream.match() (remove duplicate code).
* lib/vclib/ccvs/rcsparse/texttools.py (_mxTokenStream.match):
  Remove duplicate code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1722 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:52:39 +00:00
mhagger 34f76bdc87 Handle files with empty "delta" (a.k.a., "tree") part.
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
2007-11-18 20:51:40 +00:00
mhagger 57bf0cb554 Handle a "head" keyword with no revision number.
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
2007-11-18 20:49:38 +00:00
mhagger 9adcdfae2f Remove dead code.
* 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
2007-11-18 20:47:29 +00:00
mhagger 075b580fdb Rewrite _Parser.parse_rcs_admin() to use a token lookup table.
* 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
2007-11-18 20:46:46 +00:00
mhagger ae57f73e2f Separate handling of the "strict" keyword into a separate "if" branch.
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
2007-11-18 20:46:03 +00:00
mhagger a70372d2ed Reorder definitions in the approximate order that they will be called.
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
2007-11-18 20:45:09 +00:00
cmpilato e2b783a403 * lib/vclib/ccvs/rcsparse/parse_rcs_file.py
Set svn:executable property for this file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1713 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-16 09:44:12 +00:00
cmpilato db6fbcdf1f Add a very primitive testing infrastructure for rcsparse, and the first test.
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
2007-11-16 09:42:56 +00:00
cmpilato fcf688c20c Add a new test/demonstration script.
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
2007-11-16 09:39:14 +00:00
cmpilato 525523e465 Prevent Exception when generating tarballs for remote Subversion
repositories.

* lib/vclib/svn_ra/__init__.py
  (SelfCleanFP.read): Add default parameter value for 'len' argument.

Patch by: Ceri Storey <cez@necrofish.org.uk>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1706 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-09-14 13:02:21 +00:00
cmpilato 3d6f1cc7d1 Finish issue #309: add links from diff view to revision views.
* 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
2007-07-26 20:56:10 +00:00