1
0
mirror of https://github.com/vitalif/viewvc-4intranet synced 2019-04-16 04:14:59 +03:00

Compare commits

...

980 Commits
V0_9 ... 1.0.6

Author SHA1 Message Date
cmpilato
d79ea850af Retroactively "peg" the svn:externals property on these tags which
pulls in the 'templates-contrib' area.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/tags/1.0.6@2451 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-08 16:51:21 +00:00
cmpilato
b123b9b5e0 Tag the 1.0.6 final release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/tags/1.0.6@2005 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-16 17:49:03 +00:00
cmpilato
a234ea1105 Set release date.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@2004 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-16 17:47:58 +00:00
cmpilato
fd3db29ade Add missing module import statement.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1995 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 19:05:44 +00:00
cmpilato
2e684b109f Fix the import cycle problem with the mod_python stuffs (issue #369).
* bin/mod_python/viewvc.py,
* bin/mod_python/query.py
  Use the 'imp' module and its offerings to load the right 'viewvc'
  and 'query' modules (from the ViewVC lib directory, not from the
  mod_python directory).

* CHANGES
  Note this change.

Patch by: Eygene Ryabinkin <konvpalto {at} tigris.org>,
          me


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1993 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 17:44:29 +00:00
cmpilato
39c10d903b * lib/viewvc.py,
* lib/vclib/ccvs/rcsparse/common.py,
* lib/vclib/ccvs/rcsparse/default.py,
* lib/vclib/ccvs/rcsparse/texttools.py,
* lib/blame.py,
* lib/popen.py
  Purge tab characters from code save for in comments where the tabs
  are to be interpreted literally.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1985 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-13 17:48:17 +00:00
cmpilato
25a30fb45f Note recent change.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1984 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-13 17:46:29 +00:00
cmpilato
2f1008737a Fix some indentation-based syntax exceptions caused by stray tab
characters.

* lib/blame.py
  (make_html): Do import of vclib.ccvs.blame here, the only place it's
    needed.

* lib/vclib/ccvs/blame.py
  (CVSParser.parse_cvs_file): Replace some stray tab characters with
    spaces.

Found by: Matt Benson <mbenson {at} apache.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1983 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-13 17:33:57 +00:00
cmpilato
e800659377 Update the URL reference in light of r1978 and r1979.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1981 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-07-28 19:26:42 +00:00
cmpilato
f75096b6c6 Backport from trunk r1978:
Finish issue #354: Lose ability to set Content-type via CGI params.
   
   For security purposes (because spoofing Content-type headers can have
   undesirable side effects), no longer recognize 'content-type' CGI
   parameters whose values aren't one of the magic MIME types ViewVC uses
   for its own (non-MIME-type-setting) purposes.
   
   * lib/viewvc.py
     (Request.run_viewvc): Ignore content-type CGI parameters whose
       values aren't one of the magic ViewVC MIME types used to indicate
       that folks want the markup view.
     (view_checkout): No longer consult the query parameters for a MIME type.

Also:

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1979 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-07-28 18:58:46 +00:00
cmpilato
8f28ea0798 Backport from trunk r1896, and note the fix in CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1897 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-22 17:51:25 +00:00
cmpilato
2a6c68b575 Backport r1888 from trunk:
Fix issue #348 by making the 'co' parser more resilient to multiple
   "special" lines of output.
   
   Previously, output like the following would choke because the code was
   able to deal with the first "special" line (the warning about unknown
   phrases), but then wasn't able to handle the second "special" line
   (about no side branches).
   
      $ co -pTAG_NAME /cvs/repos/some-file,v
      /cvs/repos/some-file,v  -->  standard output
      co: /cvs/repos/some-file,v: warning: Unknown phrases like `commitid ...;' are present.
      co: /cvs/repos/some-file,v: no side branches present for 1.1
   
   If either of these lines had been the only special ones, stuff worked
   fine.  But in concert, it all fell apart.
   
   * lib/vclib/ccvs/bincvs.py
     (_parse_co_header): Use a line-reading loop instead of trying to
       expect certain output on specific lines.
   
   Verified by: Ross Becker <ross {at} trapezenetworks.com>

Also:

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1889 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-14 17:11:30 +00:00
cmpilato
b1becd4c33 Add CHANGES item for recent bugfix.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1885 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-12 18:56:17 +00:00
cmpilato
e3514e6a3d Merge from trunk r1882 and r1883, fixing issue #346 on the 1.0.x line
(though perhaps not entirely, if use_rcsparse is set).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1884 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-12 18:52:13 +00:00
cmpilato
2337c9be23 Ahh ... begin the cycle anew ...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1826 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-28 15:39:54 +00:00
cmpilato
d803878191 Update to use new name of the license file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1824 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-28 15:19:35 +00:00
cmpilato
269f2087b4 Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1823 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-28 15:18:12 +00:00
cmpilato
220af43401 * lib/viewvc.py
(_get_svn_location): Doh!  Return the parts we calculated.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1822 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-27 01:49:57 +00:00
cmpilato
de7782a53a Avoid errors caused by invoking the Subversion command-line client by
a userid that a) has no ~/.subversion area and b) can't create one
(due to lack of permissions).

* lib/vclib/svn/__init__.py
  (BlameSource.__init__): Use a read-only temporary directory for
    Subversion's runtime configuration directory.
  (BlameSource.__del__): New (deletes the temporary directory).

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1821 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-27 01:06:58 +00:00
cmpilato
d177c057b0 Security fixes for remote Subversion repositories.
* lib/vclib/svn_ra/__init__.py
  (LogCollector.add_log): Record copyfrom info.

* lib/viewvc.py
  (view_log): Implement a cache of path-forbiddenness check results,
    and combine a pair of similarly conditioned blocks.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1820 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-25 21:48:27 +00:00
cmpilato
65a68936e7 Type fix.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1819 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-25 21:24:16 +00:00
cmpilato
1c613a947f Make 'forbiddenre' significantly more powerful by allowing folks to
distinguish between file and directory paths.

* viewvc.conf.dist
  (forbiddenre): Update documentation to note that directory paths
    will contains trailing slashes, and provide a related example.

* lib/config.py
  (is_forbidden): If using the 'forbiddenre' option, test directory
    paths only after appending a trailing forward slash.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1817 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-25 20:47:24 +00:00
cmpilato
da5b54e95d 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.

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1815 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-25 19:21:08 +00:00
cmpilato
4e27b4f06b Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1814 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-22 15:11:30 +00:00
cmpilato
88c95433f2 Security fix: block access to forbidden paths via the p1 and p2 diff
view parameters.

* lib/viewvc.py
  (_get_svn_location): New, abstracted -- and tweaked to do
    forbiddenness checks -- from _get_diff_path_parts().
  (_get_diff_path_parts): Now use _get_svn_location().

* CHANGES
  Record these changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1811 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-22 13:01:25 +00:00
cmpilato
4db1ef6d19 * templates/error.ezt
Bring up-to-date with trunk's version, only showing tracebacks when no
  human-friendly message is provided in the error, and restoring the
  workaround for older IE versions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1810 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-22 13:01:11 +00:00
cmpilato
2af50a5f27 Security fixes: strip forbidden changed paths in the Subversion
revision view, and don't traverse log history into forbidden locations.

* lib/viewvc.py
  (view_revision): Filter out changes whose paths are forbidden, and
    make copies from unreadable sources look like regular adds (without
    history).

* lib/viewvc.py
  (view_log): When traversing log history on Subversion objects, if
    the object was copied from a forbidden location, make it appear to
    be a regular add (without history) and stop traversing history.

* CHANGES
  Record these changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1809 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-22 02:01:09 +00:00
cmpilato
f4f3459c8e Merge from trunk r1806, whose log message read thusly:
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().

Also:

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1807 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 21:49:34 +00:00
cmpilato
ec081f5d8e Backport (sorta) the "forbiddenre" support from trunk.
* lib/config.py
  (Config._force_multi_value): Add 'forbiddenre' to the list.
  (Config.is_forbidden): Now accept 'root_and_path' instead of just a
    module name.  Also, accept 'pathkind'.  Finally, support the new
    'forbiddenre' as a superceding configuration decision over
    'forbidden' (the support for which has been tweaked to deal with
    the new function input).

* lib/viewvc.py
  (Request.run_viewvc, view_directory, generate_tarball, build_commit): 
    Update calls to cfg.is_forbidden(), now calling for files and
    directories (of all depths).

* lib/query.py
  (build_commit): Update calls to cfg.is_forbidden(), now calling for
    files and directories (of all depths).

* viewvc.conf.dist
  Document the new 'forbiddenre' configuration parameter.

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1802 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 20:05:57 +00:00
cmpilato
e0eb1f6331 Note recent changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1801 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 19:24:47 +00:00
cmpilato
94ba398034 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/branches/1.0.x@1800 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 19:08:34 +00:00
cmpilato
7e250b8f24 Record recent changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1782 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 15:41:47 +00:00
cmpilato
64eb245377 Entity-escape RSS descriptions, and wrap them in <pre> tags.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1781 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 15:40:26 +00:00
cmpilato
d3092409b2 Merge r1779 from trunk, whose log message read thusly:
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/branches/1.0.x@1780 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 15:37:30 +00:00
cmpilato
652dc5b571 Backport trunk's r1765, in which we recommend adding ViewVC to robots.txt.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1766 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-07 02:21:46 +00:00
cmpilato
d04cdeca8c Backport from trunk r1706:
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>

Also:

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1707 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-09-14 13:05:57 +00:00
cmpilato
480eb1a1f7 Merge from trunk to the 1.0.x release branch r1695, whose log message
read thusly:

   Finish issue #306 - RSS content type should be more specific.
   
   * lib/viewvc.py
     (view_query): Use "application/rss+xml" instead "text/xml" for 
       the RSS feed output stream's content type.  Suggested by 
       Phil Ringnalda <philringnalda@tigris.org>.

Also:

* CHANGES
  Note the change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1696 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-09 18:20:20 +00:00
cmpilato
e477c03157 * viewvc-install
(TREE_LIST): Install the contributed templates, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1645 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-03 18:03:36 +00:00
cmpilato
b4d5c1d9d6 * CHANGES
Note the fix from r1628.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1629 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-26 19:39:10 +00:00
cmpilato
8e1eb9be9a * bin/loginfo-handler
(Cvs1Dot12ArgParse): Handle the imported sources case, too.  Thanks to
    Mark Keisler <mark@mitsein.net> for pointing this out in IRC today.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1628 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-26 19:38:35 +00:00
cmpilato
cb1bf2a45b Add an externals definition which pulls in contributed template sets
for ViewVC 1.0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1622 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-25 19:43:27 +00:00
cmpilato
60ae172120 Backport from trunk r1605, whose log message read thusly:
Finish issue #287 by ensuring that in a clash of root names, the
   first-listed, cvs_roots-found, CVS repository wins.
   
   * lib/query.py
     (run_query): Ensure that in a rootname clash situation, the CVS
       repository wins.
   
   * lib/viewvc.py
     (list_roots): Ensure that in a rootname clash situation, the CVS
       repository wins.

Also:

* CHANGES
  Note this fix.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1606 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-13 09:16:46 +00:00
cmpilato
f029071eae Merge from trunk r1596-1599, which is bunch of license-related juggling.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1601 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 18:39:52 +00:00
cmpilato
fa95ce8b08 Delete the svn:mergeinfo property.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1600 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 18:33:06 +00:00
cmpilato
3a415a308e Update make-release script with latest from trunk.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1596 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:45:21 +00:00
cmpilato
627e506a76 Copy notes directory from trunk.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1595 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:44:58 +00:00
cmpilato
267ea727a0 Update license-1.html file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1594 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:43:07 +00:00
cmpilato
965e1cfaff Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1593 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:38:34 +00:00
cmpilato
3ffe822b0c Do some documentation and website reorg and purging.
* docs
  New.

* www
* viewcvs.sourceforge.net
  Removed.

* viewvc.org/url-reference.html
* viewvc.org/upgrading.html
* viewvc.org/template-authoring-guide.html
  Move these...

* docs/url-reference.html
* docs/upgrading-howto.html
* docs/template-authoring-guide.html
  ...to here.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1587 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 07:20:02 +00:00
cmpilato
e6de1376bc Begin a new release cycle.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1583 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 06:49:34 +00:00
cmpilato
3f09d2e039 Nail down a release date for 1.0.4.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1581 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 06:14:58 +00:00
cmpilato
ef501bd217 Backport from trunk r1579, whose log message read thusly:
(Hopefully) really finish issue #262 by enabling auto-commit in CVSdb SQL.
   
   * lib/cvsdb.py
     (CheckinDatabase.Connect): Issue "SET AUTOCOMMIT=1" so that InnoDB
       databases automatically commit changes made to the database.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1580 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 06:02:20 +00:00
cmpilato
e0342ff46e Backport from trunk r1486, whose lead message read thusly:
Prep PyFontify.py for Python 2.6 readiness, and make it stop giving
   the following warning in Python 2.5:
   
      Warning: 'with' will become a reserved keyword in Python 2.6
   
   Reported by: Philip M. Gollucci <pgollucci@p6m7g8.com>
   
   * lib/PyFontify.py
     (replace): Removed.  Callers now use string.replace().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1578 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 05:13:04 +00:00
cmpilato
d3210a1fec * templates/include/diff_form.ezt,
* templates/include/pathrev_form.ezt
  Fix various XHTML validation errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1576 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 05:01:22 +00:00
cmpilato
2ba682c141 * viewvc.conf.dist
(allow_tar): Move this to be closer to other allowed-view options.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1575 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-09 14:04:48 +00:00
cmpilato
6f67d8874a Backport from trunk r1573, whose log message read thusly:
Finish issue #180 - Query results cache staleness under mod_python

   Remove the code which attempts to cache database connection wrapper
   objects.  That was useful long ago when the ViewVC code was sloppier,
   but now the database handles get passed around in the call stack, so
   there's a 1-to-1 mapping of ViewVC process to database connection.
   The cache is, therefore, entirely unnecessary (and is causing
   problems, in fact, for mod_python users).
   
   * lib/cvsdb.py
     (gCheckinDatabase, gCheckinDatabaseReadOnly): Remove.
     (ConnectDatabase): Add 'readonly' optional parameter.  Don't try to
       play the connection caching game any more -- nobody cares.
     (ConnectDatabaseReadOnly): Reimplement as a wrapper around 
       ConnectDatabase().

Also:

* CHANGES
  Note this fix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1574 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-09 13:50:54 +00:00
cmpilato
88ef87c6af Backport to 1.0.x r1568 from trunk, which fixes some XHTML validation bugs.
* templates/include/footer.ezt,
* templates/include/header.ezt
  Fix the bugs ...

* CHANGES
  ... and note the fixes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1571 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-06 16:53:06 +00:00
cmpilato
dae7542569 Backport to 1.0.x r1569 from trunk, whose log message read thusly:
Finish issue #296 - Query links for SVN deletions produce bad links.

   * lib/viewvc.py
     (build_commit): Rework the view URLs so that, for Subversion, URLs
       related to deleted paths point to the previous revision.  And don't
       bother generating diff URLs for adds and removes -- only changes.

Also:

* CHANGES
  Note this fix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1570 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-06 16:48:25 +00:00
cmpilato
ea28160e45 * lib/viewvc.py
(redirect_pathrev): Automagically transform bogus input into,
    essentially, "HEAD".

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1567 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-04 03:07:46 +00:00
cmpilato
384d0dc1a6 * viewvc-install
(install_file): Use os.sep instead of '/' as the trailing slash in the
    "created" stdout line.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1565 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 19:37:07 +00:00
cmpilato
95927627b2 Backport from trunk r1561, which fixes bugs in viewvc-install's
ability to handle existing directories (and other filesystem errors)
on Windows.

* viewvc-install
  (install_file): Test e.errno instead of e[0], because on Windows, a
    Windows-specific subclass of OSError (WindowsError) is raised, and the
    first item of its tuple representation is the Windows-specific
    error code.  But e.errno seems always to hold the OS-independent
    error value.

* CHANGES
  Note this fix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1562 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 16:35:03 +00:00
cmpilato
d95ceab8a3 * lib/viewvc.py
Backport bugfix from trunk@r1559.

* CHANGES
  Note the change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1560 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 13:28:38 +00:00
cmpilato
1aff68d647 On the 1.0.x branch: backport from trunk r1557, which updates the URL
for the Python for Windows Extensions, and appends exception string
information which suggests they might be missing when failing to
import them.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1558 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 12:43:08 +00:00
cmpilato
4a3e55dac7 * INSTALL
(SECURITY INFORMATION): New section (copied from trunk).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1555 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-29 02:08:15 +00:00
cmpilato
171fadee27 * lib/viewvc.py
(view_markup): Raise an exception if the markup view is disable via
    runtime configuration

* CHANGES
  Note this fix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1548 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 20:29:46 +00:00
cmpilato
bef839ab4e Backport to the 1.0.x branch r1344, which fixes a logic error that
broke EZT substitution pattern handling.

* lib/ezt.py
  (_write_value): Fix indentation / logic error.

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1541 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-16 05:06:58 +00:00
cmpilato
6647de80c3 Backport applicable portions of r1539 from trunk to the 1.0.x branch.
* lib/viewvc.py
  (_orig_path, view_directory, view_revision, setup_diff): Catch
    vclib.InvalidRevision exceptions from repos._getrev(), and
    re-throw them as ViewVCExceptions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1540 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-12 15:10:25 +00:00
cmpilato
99e1a51e20 Update the INSTALL file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1522 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-26 17:25:02 +00:00
cmpilato
c25dd8c213 * bin/loginfo-handler
Backport to the viewvc-1.0.x branch trunk revisions r1517 and r1518, which
  fix a buglet in the CVS 1.12 argument parsing and stdin consumption.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1519 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 19:54:33 +00:00
cmpilato
6cc6bde99f Backport to the viewvc-1.0.x branch the fix for issue #12, committed
in r1507 with the following log message:

   Finish issue #12 -- Long paths in tarballs get truncated.
   
   Use a GNU tar extension when path names longer than 100 characters are
   being packaged in our tarball output.  
   
   Patch by: Klaus Rennecke <marion@users.sourceforge.net>
   
   I tested this on a Solaris box that had both the native tar program
   and GNU tar.  Without the patch, but the native and GNU tar programs
   created files with truncated filenames.  With the patch, GNU tar worked as
   expected; the native tar program created a '././@LongLink' file
   whose contents were the long path, and additionally created the
   file with the truncated path.
   
   * lib/viewvc.py
     (generate_tarball_header): For paths longer than 100 characters, use
       a GNU tar extension which allows arbitrary path links.  Also, fix
       the "version" header item to be '00', not \0.
       
   * templates/include/dir_footer.ezt
     Change the "download tarball" link text to indicate that we are
     now generating GNU tarballs.

Additionally:

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1508 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 15:40:08 +00:00
cmpilato
d4c351e01f Backport to 1.0.x the fix for issue #262 (svndbadmin doesn't commit
data to MySQL InnoDB tables), committed to trunk in r1500.

* lib/cvsdb.py
  (CheckinDatabase.AddCommit): Set plus_count and minus_count
    explicitly to '0', which seems to be required for some folks'
    MySQL installations.

* bin/make-database
  Explicitly declare that we want tables of type "MyISAM".

Also:

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1501 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-05 23:10:03 +00:00
cmpilato
7a5a7cfb69 Backport to viewvc-1.0.x the latest and greatest viewvc-install, which
brings the ability to be run from an arbitrary location, and vastly
improves the output.

* viewvc-install
  Bring into sync with trunk as of r1488.

* CHANGES
  Note these changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1489 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-20 18:14:51 +00:00
cmpilato
38b429220e Backport to the 1.0.x branch from trunk revisions 1345 and 1463:1465,
which fix issues 151 and 257, respectively.

Also:

* CHANGES
  Note these changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1466 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-02 04:00:47 +00:00
cmpilato
f42e157e88 Backport to 1.0.x r1456, whose log message ran thusly:
Finish issue #266 -- Query result shows file names with @ as email
   addresses.
   
   The ultimate problem here was that email address recognition banks on
   the final component of addresses "server" only have 2-4 characters in
   it.  But the query code was doing a little more here than necessary
   anyway, mistakenly using htmlify() instead of its subset, server.escape().
   
   * lib/viewvc.py
     (view_query, english_query, build_commit): Use
       request.server.escape() instead of its superset, htmlify(), to
       format stuff that needs to be HTML-escaped, but doesn't
       necessarily need to try to recognize URLs and email addresses.

Additionally:

 * CHANGES
   Add a change item to reflect this fix.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1457 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-18 01:18:14 +00:00
cmpilato
4312ecd3fa * CHANGES
Finalize 1.0.3 changes list.  Begin a new section for 1.0.4.

* lib/viewvc.py
  (__version__): Bump to 1.0.4-dev.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1448 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 20:31:49 +00:00
cmpilato
504ca48e0f Dictate UTF-8 as the output character set for all ViewVC template-driven
views.  

NOTE: This is a security-related fix.

* lib/sapi.py
  (CgiServer.header, ModPythonServer.header): Add "; charset=UTF-8" to
    the Content-type header in ViewVC output.
  (AspServer.header): If no content type is specified, set the content
    type to 'text/html; charset=UTF-8'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1446 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 20:18:34 +00:00
cmpilato
0c0ec82ca2 Merge r1443 and r1444 from trunk, which were follow-ups to the issue
#265 fix backported to the 1.0.x branch in r1441.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1445 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 20:01:02 +00:00
cmpilato
58a237b14c Backport to the 1.0.x branch r1440, whose log message read thusly:
Finish issue #265 - ViewVC shows wrong path for items deleted from a
                       parent dir copied in the same revision
   
   * lib/vclib/svn/__init__.py
     (ChangedPathSet): Remove.
     (get_revision_info): Stop using the streamy callback reporting form
       of repos.ChangeCollector(), because its got some ... deficiencies.

Additionally:

* CHANGES
  Create a new 1.0.3 section, and note the above change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1441 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 16:25:48 +00:00
cmpilato
24d1a691dc Update some branch files post-release.
* lib/viewvc.py
  (__version__): Bump for next release cycle.

* CHANGES
  Commit finalized date.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1435 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-29 16:56:51 +00:00
cmpilato
51011abec8 Backport to the 1.0.x branch r1428 from trunk, whose log message read
thusly:

   Update the PHP CGI hack and add a comment to the config file pointing
   out the CLI/CGI distinction. Thanks to Mark <mark@mitsein.net> and
   Brian G. Peterson <brian@braverock.com> for bringing this issue up
   on the users' list.
   
   * lib/viewvc.py
     (markup_stream_php): update the cgi hack
   
   * viewvc.conf.dist
     (utilities.php): add comment

Additionally:

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1429 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-28 01:13:36 +00:00
cmpilato
0bbe7f5751 Port r1422 to the 1.0.x branch.
* lib/viewvc.py
  (view_markup): Correct the syntax highlighter choosing logic.

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1423 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-16 16:32:09 +00:00
cmpilato
1df169ab24 Backport r1416 to the 1.0.x branch.
* lib/vclib/svn/__init__.py
  (BlameSource.__init__):  Pass the --non-interactive flag to 'svn blame'
    so it doesn't wedge when cache authstuffs aren't available or sufficient.

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1419 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-01 18:17:39 +00:00
cmpilato
98e7612420 Backport fix for issue #245 (r1417) to the 1.0.x branch.
* lib/viewvc.py
  (build_commit): If the environment variable HTTPS is set to "on", then
    construct the rss_url data dictionary item with an "https" method instead
    of an "http" one.

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1418 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-01 18:15:32 +00:00
cmpilato
70b0076d88 Backport fix for issue #208 (r1414) to the 1.0.x branch.
* lib/blame.py
  (link_includes): Calculate include paths in such a way that '.' is
    dropped and '..' is normalized.  This should prevent us from
    sending paths through Subversion's APIs that aren't legal (and
    cause assertions to fire).

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1415 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-01 16:48:48 +00:00
cmpilato
e23b88d389 * CHANGES
Update with recent fixes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1398 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 09:51:27 +00:00
cmpilato
336ee6b95d Backport to the 1.0.x branch r1396, whose log message readly thusly:
Fix issue #18 (Annotate not working in windows for subversion).
   Thanks to Hernán Martínez Foffani <hernan.martinez@ecc.es> for testing
   this patch on Windows.
   
   * lib/vclib/svn/__init__.py
     (BlameSource.__init__): Patch up the URLs passed to 'svn blame' on
       systems that don't use forward-slashes for path separators.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1397 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 09:51:13 +00:00
cmpilato
642130cf93 Merge the corrections to the INSTALL file made in r1386 to the 1.0.x branch.
Wish I'd remembered to do this *before* rolling 1.0.1...

* INSTALL
  Tweaky, tweaky...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1395 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 09:40:36 +00:00
cmpilato
1e3c57f2e0 * lib/viewvc.py
(__version__): Bump to 1.0.2-dev.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1393 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 01:04:12 +00:00
cmpilato
9693f2b981 * CHANGES
Note recent change that uses real modification times for Subversion
  directories in generated tarballs.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1387 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-20 22:08:53 +00:00
cmpilato
69ab22922f Backport fix for issue #250 (r1384) to the 1.0.x branch.
* lib/viewvc.py
  (generate_tarball): Add new (optional) dir_mtime parameter, used to specify
    the modification time of the current directory while generating tarball
    data.  Now, allow empty directories in Subversion tarballs (while
    preserving the "pruning" behavior for CVS tarballs).

* CHANGES
  Note the change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1385 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 20:06:34 +00:00
cmpilato
d422c3abc9 Backport fix for issue #249 (r1382) to the 1.0.x branch.
* lib/query.py
  (main): Add 'rss_href' to the data dictionary so the template
    doesn't freak out.

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1383 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 18:35:29 +00:00
cmpilato
ded0015f5c Backport fix for issue #241 (r1377) to the 1.0.x branch.
* lib/viewvc.py
  (get_file_view_info): Fix an oops which caused some whack URL
    generation for download-as-text links on files whose path has changed
    over time.

* CHANGES
  Update to reflect this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1378 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 15:53:09 +00:00
cmpilato
6232555f79 Backport fix for issue #237 (r1375) to the 1.0.x branch.
* lib/vclib/bincvs/__init__.py
  (_tag_tuple): Return () instead of raising a ValueError for
    single-slot revisions.

* CHANGES
  Update to reflect this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1376 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 15:31:44 +00:00
cmpilato
81fa4ce6fd Syncronize the 1.0.x CHANGES file with recent formatting fixes from trunk.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1369 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-26 15:49:25 +00:00
cmpilato
98378e7560 Backport the patch from r1367 (from issue #239), and not the change in
the CHANGES file.
   
* templates/include/footer.ezt
  Fix an XHTML validation error caused by not closing an <A> tag.

* CHANGES
  Note the bugfix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1368 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-26 15:48:00 +00:00
cmpilato
8da2897df2 Backport r1357 to the 1.0.x release branch. That log message read:
Fix exception on log page when use_pagesize is enabled. Patch from
   Jay Rossiter / Signe <signe@cothlamadh.net> on users' list.
   
   * lib/viewvc.py
     (view_log): call paging() with right arguments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1361 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-18 17:31:55 +00:00
cmpilato
45bca25fbc * CHANGES
Add change for r1357's bugfix.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1359 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-18 17:27:57 +00:00
cmpilato
a54b3bcbbe * lib/viewvc.py
(__version__): Bump to 1.0.1-dev.

* CHANGES
  Give a date for the 1.0.0 release.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1352 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-01 21:20:24 +00:00
cmpilato
2612b3bd0a Merge r1339 from trunk into the 1.0.x branch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1340 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-20 06:55:11 +00:00
rey4
588f19cb0b Merge trunk revision 1333 into 1.0 branch
* branches/1.0.x


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1336 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-14 14:33:45 +00:00
rey4
6d540deba2 Merge trunk doc updates from 1330 and 1331 onto 1.0 branch
* CHANGES
* INSTALL
* viewvc.org/index.html
* viewvc.org/upgrading.html
* windows/README
* www/index.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1332 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-09 16:09:09 +00:00
cmpilato
9f612d3b29 Branch for 1.0.0 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1327 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 19:53:43 +00:00
cmpilato
d438a4b113 * viewvc.org/contributing.html
(Release Management): Update instructions to match new tag/branch naming
    scheme.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1326 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 19:27:42 +00:00
rey4
10a237f380 Change make-release script to generate ZIPs with CRLF line endings.
Also, no longer include the elemx, tests, tools, tparse, and www
directories in releases.

* tools/make-release


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1313 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 17:22:39 +00:00
rey4
a5c7a1279f Remove Codewarrior project file for aspfool. It's a good compiler,
but the bloated binary project file format sucks and nobody uses it.

* aspfool/aspfool.mcp
* aspfool/README


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1312 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 16:52:38 +00:00
rey4
c195eb1e46 Restore ViewCVS 0.9.x behavior when "checkout_magic" option is disabled
so disabling it doesn't break compatibility with old log URLs.

Add new "default_file_view" option so people who won't miss the old log
URLs can view static HTML sites in ViewVC without using checkout_magic.

Also, deprecate the "checkout_magic" option and make it disabled by
default. Don't want that last part to get lost, so I'll repeat:

  =================================================================
   WARNING: This commit changes the default "checkout_magic" value
  =================================================================

Reasons for disabling "checkout_magic" by default include the security
hole it leaves for people trying to do URL authorization and its general
ugliness. People who actually use "checkout_magic" for the static HTML
browsing should prefer the "default_file_view" syntax now that it
is available. And people who really need "checkout_magic" for the
compatibility with ViewCVS 0.9.x log URLs can easily enable it.

* lib/viewvc.py
  (Request.run_viewvc, Request.get_link):
     handle "checkout_magic" and "default_file_view" options

* lib/config.py
* viewvc.conf.dist
    add "default_file_view" option and disable "checkout_magic" by default

* CHANGES
* viewvc.org/upgrading.html
* viewvc.org/url-reference.html
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1311 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-04 03:11:02 +00:00
rey4
93e802daf4 Make various improvements to URL reference document. In particular,
go back and add required/optional/depends columns to the tables in the
URL syntax section.

Now the document does seem ok, so can we pretty please have a release?

* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1310 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 23:54:34 +00:00
cmpilato
253c4bd625 Finish issue #226 - RSS feed title name always reads "CVS"
* templates/rss.ezt
  Make the RSS feed use "REPOSNAME commits[ (in DIRECTORY)]" for its title, 
  and "VC-SYSTEM commits to the[ DIRECTORY directory of the] REPOSNAME
  repository" for its description (where the all-caps words are replaced
  with the relevant data).



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1309 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 18:25:33 +00:00
cmpilato
a889e3280a * lib/viewvc.py
(Request.run_viewvc): Don't overwrite good parameters 'pathrev' and
    'revision' with old 'rev' values.  And revert a little change from r1299
    which caused some of the redirect logic to be skipped in we're already
    done the 'rev'-to-something-else translation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1308 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 14:50:32 +00:00
rey4
c3382c842f Basically finish up URL reference, filling out section on Backwards
compatibility and filling in some other gaps.

* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1307 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 04:37:49 +00:00
rey4
e14ed404f8 * viewvc.org/url-reference.html
replace more occurrences of "rev" with "revision"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1306 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 02:26:13 +00:00
rey4
55287d6f16 Break up "url fragment" tables in URL reference document into separate
"path components" and "query parameters" tables as discussed on commit
list.

Turns out most of the "path components" tables only have a single row,
which kind of defeats the purpose of having a separate tables, but 
no reason to worry about that now...

* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1305 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 02:18:31 +00:00
rey4
a30f7b5dc8 Remove summary tables and brackets from URL document
* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1304 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 01:50:51 +00:00
rey4
9d9092cb08 Fix ambiguities in URL handling for tarballs. These ambiguites didn't
lead to problems that anyone was likely to encounter, but should be fixed
now that we're trying to come up with a solid URL specification.

Problem #1 is that the .tar.gz suffix was not always being stripped from
the URL path, instead it was only stripped when the path did not exist in
the repository. This meant that a tarball URL like 
"/viewvc.cgi/my/path.tar.gz?view=tarball" would stop working if a
real file or directory called "my/path.tar.gz" were ever added to the
repository. The new code just strips the ".tar.gz" suffix unconditionally.

Problem #2 is a little hairier. It is the topic of issue 210 that was
partially addressed in r1256. The issue after that change was that a URL
like "/viewvc.cgi/REPOS-root.tar.gz?view=tarball&root=REPOS" would stop
working correctly if a directory called "REPOS-root" was ever added to
to repository. Before the directory was added, the URL would download a tarball
of the whole repository. After, the tarball would contain the only the
directory. When "root_as_path_component" mode is enabled, the fix for this
is simple, we just change the syntax for a whole-repository tarball to look
like "/viewvc.cgi/REPOS.tar.gz", which leaves no ambiguity. When
root_as_path_component is disabled, the ambiguity has to be resolved in an
ugly way, by having ViewVC tack on an extra parameter ("parent=1") to root
tarball URLs to distinguish them from directory tarball URLs.

Old tarball URLs that worked before this change should continue to work,
though some of them will redirect to URLs using the "parent" parameter
and other newness.

* lib/viewvc.py
  (Request.run_viewcvs):
     add tarball suffix handling that doesn't depend on what paths exist in
     the repository. Keep the old tarball suffix code around, but only for
     the sake of handling old-style URLs and issuing redirects

  (Request.get_link):
     change the preferred links to root tarballs

  (_legal_params): add "parent" parameter

* viewvc.org/url-reference.html
    mention new "parent" parameter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1303 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-02 20:43:11 +00:00
rey4
95ad462037 * lib/viewvc.py
(view_log): don't add unused parameter to "select for diff" links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1302 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-02 18:39:40 +00:00
rey4
7572555e01 Add information about compatibility with old versions of Highlight
* windows/README
    put it here because there doesn't seem to be any other place in the
    documentation where we talk about known issues with 3rd party software.
    I don't want to reorganize the documentation right now but I don't want
    to lose this information either.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1301 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-02 18:21:53 +00:00
cmpilato
11127db6f6 * lib/viewvc.py
(_orig_path): Update comment which include 'rev=' examples.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1300 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-31 00:16:16 +00:00
cmpilato
da94713852 * lib/viewvc.py
(Request.run_viewvc): Move the 'rev' param auto-translation up a bit,
    and don't perform pathtype checks if we're already in need-to-redirect
    mode.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1299 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-31 00:05:45 +00:00
cmpilato
db3e7c3e00 Rename the 'rev' CGI parameter to 'revision' so that ViewVC can detect
URLs that predate the new 'pathrev' stuff, and graciously upgrade
those to the new format.  

NOTE: URLs created between the introduction of 'pathrev' and now might
break, but this was deemed an acceptable cost.

Suggested by:  Russell Yanofsky

* lib/viewvc.py
  (_legal_params): Add 'revision' as a copy of 'rev'.
  (Request.run_viewvc): Redirect URLs that have an old-style 'rev'
    parameter.  (For Subversion, those become 'pathrev' params; for
    CVS they become 'revision' params.)
  (): Generate URLs using the new 'revision' param instead of 'rev'.

* viewvc.org/url-reference.html
  Track the new URL syntax.  I did *not* do the work of documenting the
  old syntax and how it maps to the new.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1298 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-30 23:48:12 +00:00
cmpilato
92af4035f3 At Garrett Rooney's suggestion, use a fast-becoming-a-standard RSS
icon instead of my fast-whip-out-an-icon custom one.  Thanks to Paul
Cuerna for the URL (http://www.feedicons.com/).

* templates/include/footer.ezt
  Reference new RSS icon.

* templates/docroot/images/rss.jpg
  Remove, in favor of...

* templates/docroot/images/feed-icon-16x16.jpg
  ... this beauty.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1297 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-30 23:01:12 +00:00
cmpilato
e51335b5fe Advertise RSS capabilities even to browsers that don't have built-in
support for RSS.

* templates/docroot/images/rss.jpg
  New image.

* templates/include/footer.ezt
  Tweak bottom matter of ViewVC pages to include new RSS image (where
  available).  



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1296 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-30 21:59:34 +00:00
cmpilato
5d0109e325 * viewvc.org/url-reference.html
Make the stylesheet more like that of the template authoring guide.

* viewvc.org/template-authoring-guide.html
  Collapse some style definitions, and add a little intro paragraph.

* viewvc.org/contributing.html
  Hook the template authoring guide and URL reference into this document.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1295 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-27 19:31:35 +00:00
rey4
f586a5ebed Add URL reference document, currently rough and incomplete. Idea from
C. Michael Pilato in dev-list discussion.

I wanted to knock this out this weekend, but didn't get too far. One
more weekend should be enough though, and I welcome any feedback, especially
ideas on how to organize it better.

* viewvc.org/url-reference.html
    new


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1294 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-27 14:36:58 +00:00
maxb
6b98e0a8ec Improve viewvc-install's response to invalid arguments.
* viewvc-install: Move introductory info printing after argument passing, so
    that it is not shown if there is an argument parsing error.
  Catch GetoptError, and report nicely.
  Do not pass None to getopt where it wants a string.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1293 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-26 20:23:14 +00:00
rey4
fe995627d3 Get rid of Highlight line number workaround. Highlight 2.4.5 came out
yesterday and fixes all the issues we had with line numbering. This change
also allows ViewVC to work with old versions of Highlight all the way back
to 2.2.10.

Also, remove "highlight_style" configuration option as suggested by
Andreas Amann (aamann) in issue 126.

* INSTALL
    document new version requirements
    
* lib/viewvc.py
  (MarkupHighlight.__init__):
    stop passing --style and --line-number-start options to highlight

* lib/config.py
* viewvc.conf.dist
* viewvc.org/upgrading.html
    remove "highlight_style" option


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1292 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-21 22:47:11 +00:00
rey4
176ede2fef Get rid of the "derived from cvsweb" notice at the top of viewvc.py
as Greg Stein suggested in issue 167.

* lib/viewvc.py


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1291 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-20 03:39:54 +00:00
rey4
72459917f7 Restore copyright statements for Curt Hagenlocher accidentally
deleted in r1288

* lib/blame.py
* lib/vclib/ccvs/blame.py


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1290 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-20 03:27:02 +00:00
rey4
95db9e7f64 * viewcvs-install
* viewvc-install
    rename one more file



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1289 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 02:08:47 +00:00
rey4
3efd3fa040 Clean for file headers and copyright notices for issue 167
* bin/asp/query.asp
* bin/asp/viewvc.asp
* bin/cgi/query.cgi
* bin/cgi/viewvc.cgi
* bin/cvsdbadmin
* bin/loginfo-handler
* bin/make-database
* bin/mod_python/handler.py
* bin/mod_python/query.py
* bin/mod_python/viewvc.py
* bin/standalone.py
* bin/svndbadmin
* lib/accept.py
* lib/blame.py
* lib/compat.py
* lib/config.py
* lib/cvsdb.py
* lib/dbi.py
* lib/debug.py
* lib/idiff.py
* lib/popen.py
* lib/query.py
* lib/sapi.py
* lib/vclib/__init__.py
* lib/vclib/bincvs/__init__.py
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
* lib/vclib/ccvs/rcsparse/__init__.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
* lib/viewvc.py
* lib/win32popen.py
* tools/make-release
* tparse/tparse.cpp
* tparse/tparse.h
* tparse/tparsemodule.cpp
* tparse/tparsemodule.h
* viewcvs-install


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1288 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 02:07:36 +00:00
rey4
f74711446f Finish issue 168, the project rename. Change is mostly based on the patch
from Gerard Gerritsen (sigcafe), with some other stuff thrown in.

* bin/asp/viewcvs.asp
* bin/asp/viewvc.asp
* bin/cgi/viewcvs-strace.sh
* bin/cgi/viewvc-strace.sh
* bin/cgi/viewcvs.cgi
* bin/cgi/viewvc.cgi
* bin/mod_python/viewcvs.py
* bin/mod_python/viewvc.py
* lib/viewcvs.py
* lib/viewvc.py
* viewcvs.conf.dist
* viewvc.conf.dist
    the file renames

* bin/cvsdbadmin
* bin/loginfo-handler
* bin/svndbadmin
* bin/asp/query.asp
* bin/cgi/query.cgi
* bin/mod_python/query.py
* bin/make-database
* bin/standalone.py
* lib/debug.py
* lib/compat.py
* lib/blame.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/bincvs/__init__.py
* lib/query.py
* lib/config.py
* lib/dbi.py
* lib/sapi.py
* INSTALL
* TODO
* cvsgraph.conf.dist
* tests/timelog.py
* tools/make-release
* tparse/tparsemodule.h
* tparse/Setup.py
* tparse/INSTALL
* tparse/tparsemodule.cpp
* tparse/tparse.h
* tparse/tparse.cpp
* windows/README
* viewcvs-install
* viewvc.org/index.html
* viewvc.org/contributing.html
* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
* viewvc.org/license-1.html
    the other changes



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1287 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 00:33:54 +00:00
rey4
41296bf318 Avoid potential problem with pipe_cmds
* lib/popen.py
  (_pipe.close): use os.waitpid instead of os.wait to avoid messing with
    processes that dont belong us


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1286 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-17 20:25:34 +00:00
rey4
19fbe15fe9 Make cvsdbadmin script work correctly when it is used to update
individual modules or directories underneath a cvs root. It will
now crawl up the directory path looking for a CVSROOT directory
so it can use the right path for the "repositories" table and
allow results to show up in queries

* bin/cvsdbadmin
  (RootPath): new
  (__main__ section): use RootPath to find correct cvs roots


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1285 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-17 16:47:57 +00:00
rey4
49d332a996 Fix error messages when a path string is passed to vclib.ItemNotFound
instead of a list of path parts. We seem to do that a few places in
the svn module.

* vclib/__init__.py
  (ItemNotFound.__init__): accept path strings as arguments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1284 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-17 16:39:17 +00:00
cmpilato
66923a4982 * lib/viewcvs.py
(MarkupEnscript.__init__): Revert a change made in r1255 which
    tweaked the sed expression.  The goal was to try to also strip out
    the <PRE> and </PRE> tags from the output, but the expression I
    used also had the undesired effect of dropping the whole last line
    of a non-newline-terminated file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1283 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-16 04:13:19 +00:00
cmpilato
34d32b394e Some improvements to the py2html integration. Thanks (I think...) to
David Martínez Moreno (Ender) for sending me down this path.

* lib/py2html.py
  Update to version 0.8.  Patch by David Martínez Moreno <ender@debian.org>.

* lib/viewcvs.py
  (markup_stream_python):  Call PrettyPrint.set_mode_rawhtml_color().

* lib/PyFontify.py
  Rework this file to use spaces instead of tabs.  Use the 're' module
  instead of 'regex'.  Fix a bug which caused "raise" to not be
  noticed as a keyword (though "rais" would be).  Add "assert" and
  "exec" to the keywords list.

* templates/docroot/styles.css
  Reformat the highlight styles, and made the .kwd style have a little color.
  Also, add the styles that py2html uses.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1282 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-13 19:56:31 +00:00
cmpilato
342ec95573 * TODO
* bin/cvsdbadmin
  Minor spelling and whitespace fixes.  Patch by David Martínez 
  Moreno <ender@debian.org>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1281 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-13 15:41:44 +00:00
cmpilato
5912f400e6 Make py2html.py executable (it has a shell script mode).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1280 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-13 15:31:48 +00:00
cmpilato
73f5b59865 * bin/svndbadmin
(handle_revision):  Add 'verbose' parameter, and use it.
  (main):  Add 'verbose' parameter, and pass it off to handle_revision().
  (usage):  Update the usage message (and make it a little more ... useful).
  (__main__):  Look for the -v (verbose) flag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1279 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-10 15:26:58 +00:00
cmpilato
a2db8718cf Make some fixes to the pipe handling code to avoid zombie processes.
Patch by Paul Sokolovsky <psokolovsky@vasoftware.com>.

* lib/popen.py
  (pipe_cmds): Instead of storing only the process ID of the last
    child process in a multi-process pipe, keep them all, and wait on
    them all to finish.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1278 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-07 14:57:27 +00:00
cmpilato
71cf9e54ca Um. Character entities in comments are somewhat pointless. Replace the ones
I added in r1276 with double-semicolons.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1277 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 20:01:11 +00:00
cmpilato
3b592577a1 With Greg Stein's blessing, drop his name from the template comments.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1276 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 19:58:46 +00:00
cmpilato
e8a49a088c Remove SourceForge migration checklist, and lose implementation details of
features.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1275 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 18:55:38 +00:00
cmpilato
8977d400de Consistify capitalization.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1274 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 18:54:27 +00:00
cmpilato
16d80cb070 Add viewvc.org to the left-nav bar.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1273 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 18:53:41 +00:00
rey4
c2e18ca589 Make vhost configuration work under mod_python. Patch by
Robert Spier <rspier@pobox.com> from the dev list.

* bin/mod_python/viewcvs.py 
  (index): load_config needs a sapi object to properly handle vhosts


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1272 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-01 12:28:09 +00:00
cmpilato
0049b7fed9 * templates/markup.ezt
Check for existence of date, ago, and author before displaying them or their
  surrounding text.  This is a follow-up to r1270.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1271 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-28 18:08:23 +00:00
cmpilato
7aaf4dc8b7 Finish issue #215.
* lib/viewcvs.py
  (view_markup): Ensure initialization of variables when show_log_in_markup
    is disabled.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1270 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-27 14:07:07 +00:00
rey4
44131b424d Revert unintended change from r1267. Garrett Rooney
<rooneg@electricjellyfish.net> pointed it out on the
dev list.

* bin/mod_python/viewcvs.py


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1269 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-26 23:45:50 +00:00
rey4
4c51a8faf6 Fix windows install issues #213 and #214.
Yahor Sinkevich (_tom) made me do it.

* viewcvs-install
  (install_tree): dont copy "_svn" directories

* windows/README
    say up front that binary subversion bindings may tie you to a
    specific version of python. also make it clear that ViewVC
    doesn't need CVSNT to browse Subversion repositories


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1268 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-25 17:17:29 +00:00
rey4
10ff60245b Fix bug from r1266 in integrated query view reported by
Larry Silverman <cerulean47@gmail.com> on the users
list.

* lib/viewcvs.py
  (build_commit): handle the case where dir_strip is ""


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1267 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-25 16:52:24 +00:00
rey4
d8224da3c4 Make the integrated query page work when the repository directory
entered in cvs_roots is a subdirectory of a cvs root rather than a
top-level root directory.

Also, raise an exception when a repository being queried doesn't
exist in the database instead of returning 0 matches.

* lib/cvsdb.py
  (FindRepository): new
  (CleanRepository): add docstring

* lib/viewcvs.py
  (build_commit): strip off top-level directory paths from query results
    when the configured root is a subdirectory of the database root
  (view_query): call cvsdb.FindRepository and use information returned
    to convert paths relative to configured root to database paths



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1266 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-22 04:26:54 +00:00
rey4
f062872f9a Fix crippling bug in query.cgi reported by John L. Villalovos
<john@linux.intel.com> on the users list.

* lib/query.py
  (build_commit): set 'commits.log' template var instead of 'commits.desc'


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1265 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-18 15:38:28 +00:00
rey4
757e115829 Restore highlight "line-number-start" option. Quoth Andreas Amann
(aamann) in issue 126:

  "the --line-number-start is needed as of 2.4.2 (latest is 2.4.3)
  otherwise line numbers will start at 0 instead of 1"

* lib/viewcvs.py
  (MarkupHighlight.__init__):
    update highlight command line


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1264 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-16 18:24:11 +00:00
cmpilato
0b1a9fde95 Fix a bug which caused 404's for revision views of the default
repository when root_as_url_component is disabled.

* bin/standalone.py
  (StandaloneServer.is_viewcvs): Allow '?' as a path terminating
    character (just like '/') when checking to see if the input path is
    under ViewVC's control.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1263 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-15 19:06:23 +00:00
cmpilato
f93fb6d68a * viewcvs-install
(InstallFile): Whitespace tweak.
  (install_tree): Tweak text of installer prompts to assist folks with
    the somewhat obscure idea of DESTDIR.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1262 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-15 15:09:57 +00:00
cmpilato
0525532ef7 Use <em> instead of <i>, <strong> instead of <b>.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1261 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 22:18:33 +00:00
cmpilato
9803cd5958 Finish issue #178 -- remove references to symbolic revisions in
instructions for Subversion diffs.

* lib/viewcvs.py
  (setup_diff): Call repos._getrev() on the diff input revisions so
    'HEAD' gets resolved to a number.

* templates/include/diff_form.ezt
  Use tag-existence-aware instructions on the diff-form.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1260 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 22:09:54 +00:00
cmpilato
0aad71271f Re-order COMMITTERS based on first commit of each username.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1259 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 21:51:17 +00:00
cmpilato
ccab4b33ae Add a COMMITTERS file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1258 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 21:41:47 +00:00
cmpilato
2134d1f657 Finish issue #174 -- markup view of HEAD shows HEAD metadata, but
uses last-changed-rev for other display markings.

* lib/viewcvs.py
  (view_markup): Use the resolved revision instead of the input
    revision when fetching metadata.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1257 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 21:28:34 +00:00
cmpilato
c2434be105 Finish issue #210. Patch by Gerard Gerritsen <sigcafe@tigris.org>,
tweaked by me.

* lib/viewcvs.py
  (Request.run_viewcvs): Handle requests for [rootname]-root.tar.gz
    specially as tarball download views of the root of the repository.
  (Request.get_link): If we are prepping a URL for tarball generation
    on the root of a repository, use the filename [rootname]-root.tar.gz
    instead of just root.tar.gz.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1256 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 20:39:15 +00:00
cmpilato
59d97089e1 Finish issue #212 -- XHTMLify the highlight integration.
* lib/viewcvs.py
  (MarkupEnscript.__init__): Have sed strip the <PRE> wrappers around
    enscript output, too.
  (MarkupHighlight.__init__): Drop the --line-number-start and
    --include-style options to highlight; add --xhtml and --fragment.
    Lose the 'sed' invocation too, as it is no longer necessary.
  (view_markup): No longer pass '<pre>' and '</pre>' to the
    MarkupPipeWrapper() call -- the template will handle that.

* templates/markup.ezt
  Add <pre>...</pre> wrappers around the markup stream.  Also, name
  that whole <div> "vc_markup".

* template/docroot/styles.css
  Embed the highlight stylesheet.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1255 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 20:13:00 +00:00
cmpilato
e12dce81e1 Fixup <br> tags (to <br />).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1254 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 19:47:41 +00:00
cmpilato
09bddb189a Require Subversion 1.2.0 or better for the 'svn' module.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1253 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-13 22:26:39 +00:00
rey4
1f416a919f Fix EZT callback implementation so along with being able to write raw data
to the output, callbacks can also write formatted output (controlled by
[format] directives.) EZT now passes Context object arguments to callbacks
instead of file pointers, so more functionality can be exposed to Callbacks
in the future without loss of backwards compatibility.

Also make improvements to implementation of [format] so directives will
take effect in files included through variable references ([include path])
just like files included through string constants ([include "path"]).
And make it possible to specify custom format types (beyond "raw" "html"
"xml") with callbacks and without the need to modify ezt.py.

* lib/ezt.py
  (__doc__): update documentation
  (Template._printers, Template._cmd_print_html, Template._cmd_print_xml):
    remove
  (Template._parse, Template._cmd_format, Template._cmd_end_format, 
   _raw_printer, _html_printer, _printers): update [format] implementation
  (Template.parse): update call to _parse
  (Template.execute): update call to _execute
  (Template.generate, Template._execute, Template._cmd_print,
   Template._cmd_format, Template._cmd_include, Template._cmd_if_any,
   Template._cmd_if_index, Template._cmd_is, Template._do_if,
   Template._cmd_for, Template._cmd_define):
    move file pointer into Context object
  (_write_value): handle callbacks as printers and callbacks that use printers
  (_context, Context): rename _context class to Context and fill out methods
    since object is now exposed outside EZT as an interface for accessing EZT
    functionality from callback functions

* lib/viewcvs.py
  (MarkupPipeWrapper.__call__, MarkupShell.__call__):
    update for new (futureproofed) callback implementation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1252 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-10 04:24:12 +00:00
cmpilato
4a85813c24 * viewvc/lib/vclib/svn/__init__.py
(BlameSourceKludge): Remove.
  (SubversionRepository.annotate): Go back to using BlameSource --
    Russell fixed it in r1236.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1251 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-09 18:41:34 +00:00
cmpilato
fd1afe5fdb * viewvc/templates/diff.ezt
Avoid creating references to undefined "vc_idiff_" class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1250 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-06 18:36:46 +00:00
cmpilato
d28ec94d3c * viewvc/lib/idiff.py
(_item.__init__): Call update() with the proper argument.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1249 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-06 18:30:10 +00:00
rey4
40a2cdda10 Fix issue #205 "Illegal id tags in tempates" reported by
Andreas Amann (aamann) using patch he provided.

* templates/diff.ezt
* templates/annotate.ezt
    put a letter in front of id tags that begin with numbers


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1248 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-05 18:37:37 +00:00
rey4
a6391ce319 Fix HTML escaping in new unified diff view
* lib/idiff.py (_differ_split)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1247 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-05 18:26:46 +00:00
rey4
1700dcd3c8 Implement trac-style unified diffs (with line numbers along the side
and intraline changes highlighted). This feature requires Python 2.2
and is disabled by default.

* templates/diff.ezt
    add table for highlighted unified diffs

* lib/idiff.py
  (unified, _trim_context, _differ_split): new

* lib/viewcvs.py
  (view_diffs): set new "unified" template var on diff page


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1246 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-05 17:32:44 +00:00
rey4
ffe781b297 Check in some files that were supposed to be included in r1244
* templates/docroot/styles.css
* templates/diff.ezt
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1245 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 22:51:55 +00:00
rey4
52b8b89883 Add rudimentary support for intraline diffs. Implementation is pretty
clean, but it doesn't provide all the bells and whistles of our normal
diff interface. It's disabled by default and requires python 2.4 to
run.

* templates/docroot/styles.css: 
    add new styles

* templates/diff.ezt:
    add table for intraline diffs

* lib/config.py:
* viewcvs.conf.dist
    add new "hr_intraline" option

* lib/vclib/svn/__init__.py
  (FileContentsPipe.readline): prevent from returning "" before eof and
    from stripping out newlines
  (FileContentsPipe.readlines): new
  
* lib/idiff.py
    new

* lib/viewcvs.py
  (view_diff): set new "sidebyside" template variable



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1244 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 22:48:00 +00:00
rey4
ddaebb0f26 Make EZT library support python iterators so you can pass in things like
like generator functions. This patch was attached to issue 201. I am the
author, but credit goes to Greg Stein for valuable feedback which allowed
me to simplify the initial implementation.

* lib/ezt.py
  (Template.generate, Template._cmd_if_index, Template._cmd_for,
   _get_value): replace ctx.for_index member with ctx.for_iterators
  (_Iterator, OldIterator, _iter): new


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1243 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 22:21:47 +00:00
rey4
f24f6e5119 Fix issue 204, 'Invalid "Repository Listing" location' reported by
Erik C. Thauvin (ethauvin)

* lib/viewcvs.py
  (Request.get_link):
    return "/" instead of "" when generating top level links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1242 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 19:54:34 +00:00
rey4
c4edb250aa Rename ndiff.py and difflib.py modules, which are only provided for
python 1.5 compatibility.

* lib/difflib.py
* lib/ndiff.py
* lib/compat_ndiff.py
* lib/compat_difflib.py
    rename 

* viewcvs-install
    update ndiff invocation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1241 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-03 05:16:29 +00:00
rey4
0000ed88bb Rename the "Project Root" drop down box to "Repository" in the
default templates. We already say "CVS Repositories" and
"SVN Repositories" inside the drop down box, so we might as well
use same term outside. Also, "Root" has a specific meaning in CVS
(a top level directory containing a CVSROOT folder, a bunch of
modules, and no files) and CVS repositories in the drop down box
are not necessarily CVS roots.

* templates/include/header.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1240 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-01 00:40:33 +00:00
rey4
68673daba3 Allow CVS roots to be specified as root_parent directories, that way
ViewVC can list CVS modules alongside Subversion repositories.

* lib/viewcvs.py
  (load_config): include modules in CVS root_parent directories (not just
    roots) in repository list


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1239 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-01 00:34:24 +00:00
rey4
8afaca5f75 Fix mismatch between config.py and config file
* lib/config.py
  (Config.set_defaults): set "php_exe_path" instead of "php_path"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1238 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-31 19:15:52 +00:00
cmpilato
ef93e8eed3 * viewvc.org/download.html,
* viewvc.org/contributing.html
  Update the downloading and Subversion checkout instructions.  Also, provide
  a link to the nightly builds.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1237 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-27 14:53:14 +00:00
rey4
42b55eb5f9 Improve error reporting when svn blame fails. Also fix some bugs in
BlameSource. Maybe now we don't need BlameSourceKludge anymore...

* lib/vclib/svn/__init__.py
  (BlameSource.__init__): add missing first_rev parameter
  (BlameSource.__getitem__): remove check for fp.eof() which may
    return true when the process has finished executing but data
    can still be read from the pipe
  (BlameSource.__getitem__, BlameSourceKludge.__getitem__):
    use regex to parse blame info so we can show a detailed error
    message instead of just an exception when split() or int() fail

* lib/popen.py
  (_pipe.eof): add note about implementation problem


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1236 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-22 17:01:02 +00:00
cmpilato
f88451caaa Finish issue #34 by making annotation lines bookmarkable, and linking
to them from the diff page.

* viewvc/templates/annotate.ezt
  Make each row bookmarkable.

* viewvc/templates/diff.ezt
  Make line numbers into links to the annotate page.

* viewvc/lib/viewcvs.py
  (view_diff): Add an annotate_href to the data dictionary.

* viewvc/viewvc.org/template-authoring-guide.html
  (variables-diff): Document new annotate_href and changes.line_number
    variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1235 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 13:08:54 +00:00
cmpilato
695dd93b47 Implement support for line numbers in the diff view.
* viewvc/lib/viewcvs.py
  (DiffSource.__init__): Initialize a new line_number member.
  (DiffSource._get_row, DiffSource._flush_row): Calculate line number
    information from the diff output.

* viewvc/templates/diff.ezt
  Show line numbers with the diff, and make those line numbers
  bookmarkable (for sub-page granularity).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1234 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 12:44:34 +00:00
cmpilato
d3358ad705 Really finish issue #177. Fix a little bug with the bugfix done in r1232.
* viewvc/lib/vclib/svn/__init__.py
  (SubversionRepository.annotate): Always cross copies when looking
    for the first and last revisions in the file's history.  Duh.  



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1233 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 09:26:19 +00:00
cmpilato
d1d1b73cde Finish issue #177.
Fix a bug with Subversion annotate views which allowed the first
revision of a file's life to be a link to a diff against a
non-existent path/rev location.

NOTE: This doesn't fix the problem for remote repositories (accessed
      via the svn_ra module).

* viewvc/lib/vclib/svn/__init__.py
  (_get_history):  Make 'options' optional.
  (BlameSource.__init__, BlameSourceKludge.__init__):  Accept new
    first_rev parameter which is the first revision in the history of
    the file.
  (BlameSource.__getitem__, BlameSourceKludge.__getitem__):  Don't
    store a 'prev' revision that's older than the first revision of
    the file.
  (SubversionRepository.annotate): Instead of using _get_last_history_rev(), 
    call_get_history() to find both the first and the last revision in
    the file's history.  Update call to BlameSourceKludge().



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1232 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 06:54:04 +00:00
cmpilato
e93648496d * www/index.html
Override a few more styles to hide the "Description" box.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1231 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-19 02:06:08 +00:00
cmpilato
4510863e42 Try a different hack (the same one I used on subversion.tigris.org) for
hiding the project info box on the webpage which doesn't also have the
unfortunate side effect of losing the links for project editing, 
requesting membership, and other such useful things.

* index.html
  Lose a JavaScript redirect hack for a style override hack.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1230 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-19 01:46:47 +00:00
rey4
11174518d5 Fix mod_python issue, #188 reported by Andreas Amann (aamann).
* lib/viewcvs.py
  (generate_page): pass file object associated with current request
   to EZT instead of sys.stdout, which under mod_python is a proxy
   that tries to figure out the current request based on the current
   thread id. It can't be used in worker threads spawned by
   popen.pipe_cmds


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1229 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-18 01:34:11 +00:00
cmpilato
1f40fe9094 * viewvc/viewcvs.conf.dist (enscript_path),
* viewvc/lib/config.py (Config.set_defaults)
  Set use_highlight to 0 by default, so that the default configuration
  has a mildly higher chance of not being broken out of the box.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1228 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-17 01:43:12 +00:00
cmpilato
95fd278332 Add a new --script-alias option to standalone.py, to allow folks to
dynamically fake a non-root location for a running ViewVC process.
Reasoning?  It offends me that "viewcvs" was hardcoded in ... just
seems wrong.

* bin/standalone.py
  (Options): Populate a new script_alias member.
  (StandaloneServer.do_POST, StandaloneServer.is_viewcvs,
   StandaloneServer.redirect, StandaloneServer.run_viewcvs): Use
    options.script_alias instead of a hardcoded "viewcvs".
  (cli): Parse new --script-alias/-s option for dynamically defining
    the ScriptAlias.  Rework the usage message for my own pleasure.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1227 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-05 19:24:13 +00:00
cmpilato
993b156089 Finish issue #189 -- stale URLs for enscript in INSTALL file and website.
* INSTALL
* viewvc.org/index.html
  Update URLs for enscript to http://www.codento.com/people/mtr/genscript,
  as suggested by Eric Garrido <eric@tigris.org>.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1226 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-04 20:25:38 +00:00
rey4
ed6a269934 Resolve issue 147 "patch for aix co." Patch by sourceforge user
coshx.

* lib/vclib/bincvs/__init__.py
  (_re_co_filename): broaden regex


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1225 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-30 07:30:45 +00:00
rey4
0a889562f3 Use built in enscript file detection. This is an updated implementation
of an patch from Andreas Amann (sf user ahndee) in issue 156.

* lib/viewcvs.py
  (MarkupShell.__call__): make input file pointer optional
  (MarkupEnscript.__init__, MarkupEnscript.__call__): write input to
    temporary file so enscript can decide what kind of highlighting to do
    based on the file name
  (enscript_extensions, enscript_filenames): removed
  (view_markup): update call to MarkupEnscript

* lib/compat.py
  (mkdtemp): new function

* lib/config.py
* viewcvs.conf.dist
* viewvc.org/upgrading.html
    remove "disable_enscript_lang" option


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1224 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-30 07:29:22 +00:00
rey4
4e4e961b2d * windows/README
minor updates


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1223 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 17:13:41 +00:00
rey4
95d99a5826 Fix issue 187, "viewcvs.conf.dist contains outdated references." Patch
and bug report by Gerard Gerritsen (sigcafe).

* viewcvs.conf.dist
    fix typos and old reference to dir_alternate in comments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1222 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 15:17:31 +00:00
rey4
0467a8e1d1 Fix exception in tarball view for CVS repositories when
use_rcsparse is enabled.

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs): set DirEntry.path member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1221 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 15:08:27 +00:00
rey4
360c5d9e66 Make popen.pipe_cmds() accept an "out" argument that controls where
output from last command goes. For now only the unix implementation
respects it, windows implementation always writes to standard output
as before.

* lib/popen.py
  (pipe_cmds): add "out" argument

* lib/viewcvs.py
  (MarkupShell.__call__): update call to pipe_cmds()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1220 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 14:49:42 +00:00
rey4
03070a2320 Attempt to make directory log page a little less confusing.
* templates/include/file_header.ezt
    link to current directory listing instead of parent directory

* templates/include/log_header.ezt
    don't display "Links to HEAD:" stuff for directories. With
    change above it's redundant

* templates/log.ezt
* templates/log_table.ezt
    label directory links as "Directory Listing" instead of "(view)"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1219 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-23 16:03:14 +00:00
rey4
2d808ae415 Add limit_changes configuration option to limit the number of changed
paths shown in the subversion revision view and in query results.

* lib/config.py
* viewcvs.conf.dist
    add "limit_changes" option

* lib/cvsdb.py
  (LazyCommit): new class
  (CheckinDatabase.LazyCommit): return LazyCommit objects instead of
    fetching all properties of all commits

* lib/viewcvs.py
  (_sticky_vars, _legal_params): add "limit_changes" query parameter
  (view_revision): handle "limit_changes" and add links to manipulate it
  (view_queryform, build_commit, view_query): same

* templates/query_form.ezt
    add field to set "limit_changes"

* templates/query_results.ezt
    wherever changed files are being hidden, add link to show all files

* templates/revision.ezt
    same, and if that link is clicked, show another link to restore
    the default limit_changes so you can toggle back and forth

* viewvc.org/template-authoring-guide.html
* upgrading.html
    document new template variables and configuration option
  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1218 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-23 13:24:26 +00:00
rey4
6ae579587e Line wrap windows README file. I had been using a little python script
to do this for windows releases, but it's better just to pre-wrap it
and keep the release process simple.

* windows/README


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1217 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-23 05:56:23 +00:00
rey4
7bb6cac37e Add precompiled aspfool.dll. It's needed to run ViewCVS under
ASP and it's not very big. File is from "ViewCVS for Windows"
page at http://russ.hn.org/viewcvs/ which I'm about to take
down.

* windows/aspfool/aspfool.dll
    new


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1216 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 19:50:11 +00:00
rey4
1c87fc7fa7 Fix issue 104 "ViewCVS Broken on WinNT" with patch provided by
sourceforge user "tomy"

* lib/win32popen.py
    don't import win32security, not needed and doesn't work on NT4


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1215 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 17:04:44 +00:00
rey4
5e595215ec Documentation updates & template cleanups for recent changes.
* lib/viewcvs.py
  (common_template_date):
    only set "rss_href" when it will be valid URL

  (build_commit):
    only set commits.rev for subversion queries

    rename some of the new RSS template variables
      commits.title -> commits.short_log
      commits.url -> commits.rss_url
      commits.date -> commits.rss_date
  
* templates/include/header.ezt
* templates/rss.ezt
    update for changed template variables

* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
* CHANGES
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1214 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 16:55:26 +00:00
rey4
70ffad13c1 Update URL to the highlight program. Inadvertently gave a URL to
GNU Highlight instead of the Highlight program we support. The two
programs have the same name, and do the same things, but are not at
all related. Patch by Wataru Hirayama <hirayama@rr.iij4u.or.jp>

* INSTALL


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1213 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 14:47:13 +00:00
rey4
dabb055603 Add RSS capability to ViewVC using patch from Paul Koning (pkoning)
in issue 179. (All changes are his except for a fix in standalone.py,
and a line initializing "commits.url" template variable to None
in build_commit).

* lib/config.py
* viewcvs.conf.dist
    add [cvsdb] rss_row_limit config option

* lib/cvsdb.py:
  (CheckinDatabase.CreateSQLQueryString): make "LIMIT" value customizable
  (CheckinDatabaseQuery.__init__): set new "limit" member
  (CheckinDatabaseQuery.SetLimit): new

* lib/viewcvs.py:
  (_legal_params): add "limit" parameter
  (common_template_data): add "rss_href" variable
  (make_rss_time_string): new
  (build_commit): add commits.title, commits.rev, commits.author,
    commits.date, commits.url template variables
  (view_query): handle "limit" parameter and new "rss" format

* templates/include/header.ezt
    use new rss_href variable

* templates/rss.ezt
    new

* bin/standalone.py
  (run_viewcvs): set HTTP_HOST environment variable
 


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1212 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 05:16:23 +00:00
rey4
9aef5f5ad6 Add "port" option to connect to specified mysql port.
Patch written by sunjammerx in issue 106.

* lib/config.py
  (Config.set_defaults):
    set default port

* lib/cvsdb.py
  (CheckinDatabase.__init__, ConnectDatabaseReadOnly, ConnectDatabase):
     handle port value

* lib/dbi.py
  (connect):
    same

* INSTALL
* viewcvs.conf.dist
    update


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1211 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 03:07:31 +00:00
rey4
053658384c Make "Revision Log" links on markup, annotate and diff pages
jump to the current revision on the log page, like they used
to in 0.9.x. This patch by Jordan Russell <jr-list-2005@quo.to>
from issue 109.

* lib/viewcvs.py
  (common_template_data):
    set "log_rev_href" template variable

* templates/include/file_header.ezt
    use "log_rev_href" template variable

* viewvc.org/template-authoring-guide.html
    update


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1210 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-21 20:45:11 +00:00
rey4
93c239a2af Fix issue 181, query results groups subversion commits from different
revision numbers. Patch by Paul Koning (pkoning)

* lib/viewcvs.py
  (view_query):
    when roottype != cvs, only group commits from same revision


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1209 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-21 15:18:45 +00:00
rey4
9b5c4db217 Add support for colorizing using highlight. This is a stripped down version
of a patch by Andreas Amann (aamann) from issue 126.

* lib/viewcvs.py
  (MarkupHighlight):
    new EZT callback for invoking highlight

  (view_markup):
    use MarkupHighlight class when "use_highlight" option enabled

* lib/config.py
* viewcvs.conf.dist
    add new configuration options for highlight

* templates/docroot/styles.css
    add ".line" style to make highlight line number stand out
    
* INSTALL
    mention highlight required version and home page


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1208 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-20 18:42:32 +00:00
rey4
5c7258464e Simplify enscript and php colorizing using EZT callbacks
* lib/viewcvs.py
  (MarkupShell):
    base class for colorizing callbacks that use shell tools

  (MarkupEnscript, MarkupPHP):
    make these into callbacks instead of pseudo-file pointers, eliminate
    the need for temporary files since with callbacks these tools can
    run in the middle of template execution and send their output to 
    straight to stdout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1207 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-20 17:11:01 +00:00
rey4
08cc30e0cd Change required CvsGraph version from 1.4 to 1.5 to close out
issue 171 reported by Gerard Gerritsen (sigcafe)

* INSTALL


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1206 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 21:15:56 +00:00
cmpilato
f609e62ba2 * templates/include/header.ezt
Make the ViewVC logo a link to http://www.viewvc.org/.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1205 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 17:07:21 +00:00
cmpilato
eb9ee85f90 * templates/docroot/images/logo.png
Grumble.  Fix the background "color" of the transparent portions to
  be white for whack Internet Explorer's sake.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1204 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 17:04:56 +00:00
cmpilato
fbd59621cf * lib/viewcvs.py
(parse_date): Use compat.timegm() instead of time.mktime().  This closes
    issue #5, and comes with rey4's money back guarantee.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1203 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 16:14:34 +00:00
cmpilato
9fdeff7fd0 * templates/docroot/images/logo.png
Tweak the logo to reflect the new project name.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1202 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 16:04:29 +00:00
cmpilato
72146c0875 Revert the changes made in r1196. They were wrong. Actually, cmpilato
was wrong -- the changes merely followed his lead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1201 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 14:58:20 +00:00
rey4
b91146fee0 Work on issue 168, s/ViewCVS/ViewVC. This patch changes references to
ViewCVS in comments, strings, and documentation. References to ViewCVS
in filenames and urls still need to be fixed. Also, logo.png (the blimp)
needs to be updated or replaced.

This patch is by Gerard Gerritsen (sigcafe), the only change I've made is
to restore a reference to ViewCVS in a comment about backwards compatibility.

* windows/README
* viewcvs-install
* README
* templates/include/footer.ezt
* templates/include/header.ezt
* templates/error.ezt
* templates/query.ezt
* templates/docroot/help.css
* templates/docroot/help_query.html
* templates/docroot/help_dirview.html
* templates/docroot/help_rootview.html
* templates/docroot/styles.css
* templates/docroot/help_log.html
* templates/diff.ezt
* tools/make-release
* lib/sapi.py
* lib/dbi.py
* lib/accept.py
* lib/cvsdb.py
* lib/config.py
* lib/query.py
* lib/vclib/bincvs/__init__.py
* lib/vclib/svn/__init__.py
* lib/vclib/__init__.py
* lib/vclib/svn_ra/__init__.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/__init__.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
* lib/blame.py
* lib/popen.py
* lib/compat.py
* lib/viewcvs.py
* lib/debug.py
* INSTALL
* bin/standalone.py
* bin/make-database
* bin/mod_python/query.py
* bin/mod_python/viewcvs.py
* bin/cgi/query.cgi
* bin/cgi/viewcvs.cgi
* bin/asp/query.asp
* bin/asp/viewcvs.asp
* bin/svndbadmin
* bin/loginfo-handler
* bin/cvsdbadmin
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1200 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 17:19:28 +00:00
rey4
4f0805fcc1 Fix issue 172, typo in query results table header reported by
Paul Koning (pkoning). This is also issue 175.

* templates/query_results.ezt
    fix html-o


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1199 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 15:42:01 +00:00
rey4
cd05e5c22b Fix issue 173, cvsdb references MySqlDb connection escape() method not
present in old versions of mysql-python.

escape() has been a method of the _mysql.Connection objects since the very
beginning, but didn't get exposed in the python objects until 0.9.2
when they made the python class inherit from the C one. Python connections
have had an equivalent literal() method since 0.9.0.

* lib/cvsdb.py
    call conn.literal() method instead of conn.escape()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1198 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 15:40:52 +00:00
rey4
752c3b05d4 Fix issue 166 "empty diff generates an exception" reported by
Yoshinori Okuji (yo). This is also issue 184 

* lib/viewcvs.py
  (rcsdiff_date_reformat):
    avoid an exception when date is None


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1197 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 15:37:22 +00:00
cmpilato
5cb9ec78ac Finish Issue #5.
* lib/viewcvs.py
  (parse_date): Use time.altzone when DST is in effect.  Fix suggested
    by SourceForge user "johmart".

NOTE:  This change was reverted in r2001.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1196 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-16 17:46:39 +00:00
cmpilato
75e08ad3bf * www/index.html
Ah, forget the custom style stuff right now.  The color clash with the
  Tigris.org branding is awful.

* www/images,
* www/styles.css
  Removed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1195 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:54:17 +00:00
cmpilato
5cd3a20158 * www/index.html
Minor tweaks to preformatted section.

* www/styles.css
  Gut out unused styles, and remove more font size dictation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1194 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:47:45 +00:00
cmpilato
0f1185f221 * www/index.html
Use CSS for preformatted text instead of <pre> tags.

* www/styles.css
  Stop shrinking the font size.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1193 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:40:11 +00:00
cmpilato
299afac8b7 Begin sorta kinda figuring out how to distribute data on the new
tigris.org project site.

* www/index.html
  Describe ViewVC (taken from viewvc.org/index.html).

* www/styles.css,
* www/images
  Copy from viewvc.org/images/.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1192 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:37:19 +00:00
cmpilato
285572e89c Fix email addresses on the website. Noticed by Richard Calmbach.
* viewvc.org/who.html
* viewvc.org/license-1.html
* viewvc.org/upgrading.html
* viewvc.org/download.html
* viewvc.org/contributing.html
* viewvc.org/index.html
* viewvc.org/contact.html
  s/@viewcvs.tigris.org/@viewvc.tigris.org/

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1191 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 15:36:43 +00:00
cmpilato
92b4270895 * www/index.html
Move some stuff from the project attributes into the index.html file.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1190 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-14 22:56:05 +00:00
cmpilato
cd9a2d3a44 Goofing off a little bit in the www/ area, preparing for some real
site content creation.

* www
  New tigris.org magic website directory.

* www/project_tools.html
* www/index.html
  New site files.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1189 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-14 22:53:17 +00:00
cmpilato
a03977c386 Add *.pyc to the ignores list for the lib directory and its subdirs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1188 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 21:35:06 +00:00
cmpilato
08efb7ca46 Finish issue #165 - Can't get valid log display for directories (subversion)
* lib/viewcvs.py
  (view_log): Pass '1' for the 'svn_show_all_dir_logs' option in calls to
    repos.itemlog().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1187 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 20:21:10 +00:00
cmpilato
2a96f56114 Fix issue #176 - Subversion annotate doesn't honor rev number.
* lib/vclib/svn/__init__.py
  (BlameSource.__init__, BlameSourceKludge.__init__):  Use both the @-syntax
    and the -r parameter to 'svn' to get the right blame information.
    Patch by Paul Koning <pkoning@tigris.org>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1186 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 20:10:44 +00:00
rey4
27db52403e Fix exception caused by r1173 when kv files are used. This is issue 170
reported by cmpilato.

* lib/viewcvs.py:
  (Config.load_config):
    re-add line from before r1173 that assigns "base" member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1185 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 06:01:19 +00:00
rey4
ca8d7b89d4 Fix MySQL 4.1 incompatibility in make-database script. Patch provided by
sourceforge user "dchabal" in issue 131. The same bug was also reported
in issues 1, 17, 146.

* bin/make-database
    remove "DEFAULT '0'" clauses from auto_increment column declarations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1184 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-12 17:28:59 +00:00
rey4
d6f18dc5bf Don't forget to install mod_python handler. Fixes issue 163 reported
by Andreas Amann (aamann) caused by revision 1173

* viewcvs-install
  (FILE_INFO_LIST):
    add new handler.py file


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1183 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-11 14:51:45 +00:00
rey4
d742c7fe32 Fix invalid variable reference in log_table template reported by
Gerard Gerritsen (sigcafe) in issue 164

* templates/log_table.ezt
    s/stick/pathrev/



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1182 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-11 14:46:55 +00:00
rey4
3154c3a102 Simplify pathrev/lastrev code, removing cruft left over from
previous iterations. This change shouldn't affect any
user-visible ViewVC behavior.

* lib/viewcvs.py
  (_last_rev):
    removed

  (view_directory):
    update call to pathrev_form

  (pathrev_form):
    find lastrev inside here instead of taking lastrev parameter
    call svn.last_rev instead of _last_rev
    make some other simplifications

  (redirect_pathrev):
    call svn.last_rev instead of _last_rev


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1181 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 19:03:24 +00:00
rey4
311d9ec761 Fix HEAD links on log page broken in r1150
* lib/viewcvs.py
  (Request.get_link):
    don't hide view parameters when other parameters are None. This
    fixes the HEAD annotate link

  (get_file_view_info):
    add pathrev argument

  (view_log):
    pass None as pathrev argument to get_file_view_info, that way the links
    point to HEAD instead of the current sticky tag


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1180 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 19:01:59 +00:00
rey4
9cb702c219 Prevent exception when jumping to a pathrev earlier than the revision
where the current path was added. This was the behavior in r1146 which
was changed in r1159

* lib/vclib/svn/__init__.py
  (last_rev):
    use alternate implemention when peg_revision > limit_revision


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1179 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 18:59:38 +00:00
rey4
2a6beda68b Fix bincvs co bug.
* lib/vclib/bincvs/__init__.py:
  (_re_co_side_branches):
    handle "no side branches present" error which seems to occur sometimes
    when you check out a branch tag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1178 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 18:58:51 +00:00
rey4
f2d2d530f1 Revert portion of r1176 that stopped exposing the "prefer_markup" value
(formerly "viewable") to all templates. Even though the default templates
don't use these values, people might want to use them in custom templates.

* lib/viewcvs.py
  (get_file_view_info):
    add prefer_markup return value

  (nav_header_data):
    add "prefer_markup" template variable

  (view_directory):
     update call to get_file_view_info()

  (view_log):
     set "entry.prefer_markup" template variable
     set "prefer_markup" template variable
     set "tag_prefer_markup" template variable

* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
    update docs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1177 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-09 08:17:27 +00:00
rey4
754e9dbc30 Update template authoring guide and make template cleanups.
* lib/viewcvs.py
  (get_file_view_info):
    get rid of viewable return value

  (nav_header_data):
    get rid of "viewable" template variable

  (view_directory):
    rename "entries.viewable" variable to "entries.prefer_markup"
    rename "selection_form" variable to "search_re_form"
    rename "search_tag_action" variable to "search_action"
    rename "search_tag_hidden_values" variable to "search_re_hidden_values"

  (view_log):
    rename "entries.html_log" variable to "entries.log"
    restore value of "entries.next_main" variable to what it was in ViewCVS
      0.9.x
    get rid of "entries.viewable" template variable
    get rid of "viewable" template variable
    get rid of "tag_viewable" template variable

  (view_revision):
    rename "changes.filename" variable to "changes.path"
    rename "changes.base_path" variable to "changes.copy_path"
    rename "changes.base_rev" variable to "changes.copy_rev"

  (build_commit)
    rename "commits.desc" variable to "commits.log"
    get rid of "commits.rev_href" variable and replace with
      "commits.view_href", "commits.download_href", and
      "commits.prefer_markup"

* templates/include/dir_footer.ezt
* templates/include/file_header.ezt
* templates/dir_new.ezt
* templates/directory.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/query.ezt
* templates/query_results.ezt
* templates/revision.ezt
    update templates for changed variables

* CHANGES
    fix blurb about paging

* viewvc.org/upgrading.html
    update information about 0.9.x variables

* viewvc.org/template-authoring-guide.html
    fill it out


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1176 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-08 18:18:08 +00:00
cmpilato
e4f868ffdc * templates/include/diff_form.ezt
Restore the diff_select FORM's NAME attribute so the JavaScript
  stuffs work.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1175 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-07 19:07:01 +00:00
rey4
baafc550a9 Check in another directory listing template following discussion that
started at

  http://mailman.lyra.org/pipermail/viewcvs-dev/2005-November/002139.html

The major differences from directory.ezt are:

  - there is a new column of icons providing links to most other views

  - revision, date, author, and log message columns are merged into a
    single "Last Change" column which is more compact and easier to
    decipher when reading from left to right. The fact that you can't
    do things like sort by log message or read down the author column
    shouldn't be a problem because in the most cases, doing these things
    doesn't make any sense.

Ideally everybody will fall in love with this template, and we'll be able
to make it the default, release ViewVC 1.0, and put these old UI issues to
rest. Otherwise we can tweak and butcher this template until we agree that
its good enough to be the default, and move on from there.

* templates/dir_new.ezt
    new template file

* lib/viewcvs.py
   (sort_file_data):
     when sorting in reverse, leave directories at the top and files
     with no revision information at the bottom. Also make sorting by
     revision number the same as sorting by date in cvs.

   (view_directory):
     add "row.revision_href" links for directory entries

* templates/docroot/images/annotate.png
    new icon for annotate view. image is "stock_people.png" from gnome

* templates/docroot/images/download.png
    new icon for download view. image is
    http://www.gentoo-portage.com/img/download.png

* templates/docroot/images/list.png
    new icon for directory listings. image is "stock_view-details.png"
    from gnome

* templates/docroot/images/log.png
    new icon for log view. image is "stock_list_enum.png" from gnome

* templates/docroot/images/view.png
    new icon for markup view. image is "stock_show-all.png" from gnome

* templates/dir_alternate.ezt
    removed, nobody seems to like it


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1174 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-06 19:22:41 +00:00
rey4
72672b458c Tweak logic used to find installed paths ("lib" directory, configuration
file, templates, etc). Specifically, make the following changes:

- Get rid of hardcoded paths in module files ("lib" directory) and
  configuration files (viewcvs.conf and mod_python's .htaccess)

- Allow stub scripts (for asp, cgi, and mod_python) to specify
  configuration files so it's possible to have multiple configurations of
  viewcvs running off a single installation.

- Be more consistent about resolving paths when they aren't hardcoded
  (when ViewCVS is running from a source directory). In particular, try
  not to depend on the working directory. That way it's legal to run
  ./standalone.py instead of bin/standalone.py without getting an
  ImportError.

- Get rid of global cfg variables in viewcvs.py and cvsdb.py. They led to
  all sorts of hacks in other files to pilfer and reset them. They were
  also possible sources of races in multithreaded environments like
  mod_python and asp.

- Rewrite mod_python handler so library paths can be specified inside the
  stub files.

* lib/apache.py
    removed, contained old mod_python handler

* lib/config.py
  (Config.load_config):
    remove sys.argv voodoo, just load the configuration path specified in
    the pathname argument

  (Config.set_defaults):
    use relative path for cvsgraph_conf setting instead of hardcoded
    <VIEWCVS_INSTALL_DIRECTORY> literal

* lib/cvsdb.py
  (CONF_PATHNAME, config, cfg):
    removed, configuration stuff

  (CheckinDatabase.__init__, CheckinDatabase.CreateSQLQueryString):
    add "_row_limit" member instead of using cfg object

  (CreateCheckinDatabase):
    removed, a do-nothing function

  (ConnectDatabaseReadOnly, ConnectDatabase):
    add cfg arguments

  (GetUnrecordedCommitList):
    add db argument

* lib/query.py
  (CONF_PATHAME):
    removed

  (build_commit, run_query, main):
    add cfg arguments, use new viewcvs.get_template function

* lib/viewcvs.py
  (CONF_PATHNAME, cfg, g_install_dir):
    removed

  (Request.__init__):
    add cfg member

  (Request.run_viewcvs, Request.get_link, check_freshness,
   get_view_template, generate_page, default_view, get_file_view_info,
   format_log, common_template_data, MarkupEnscript.__init__,
   markup_stream_python, markup_stream_php, make_time_string, view_markup,
   sort_file_data, view_directory, paging, view_log, view_annotate,
   view_cvsgraph_image, view_cvsgraph, view_doc, rcsdiff_date_reformat,
   spaced_html_text, DiffSource.__init__, DiffSource._get_row, view_patch,
   view_diff, generate_tarball, download_tarball, view_revision,
   is_query_supported, english_query, build_commit, view_query,
   view_error, main):
    stop using global config, use cfg arguments or request member instead

  (_install_path):
    new, use __file__ to locate template and configuation paths

  (get_view_template):
    use _install_path and return compiled template instead of path

  (is_viewable, default_view):
    rename is_viewable to default_view and return view instead of boolean

  (handle_config, load_config):
    rename handle_config to load_config and return config object instead
    of setting cfg global

* bin/cgi/viewcvs.cgi
* bin/cgi/query.cgi
* bin/cvsdbadmin
* bin/loginfo-handler
* bin/standalone.py
* bin/svndbadmin
    look for library relative to sys.argv[0] when no hardcoded library
    path is available. Also add configuration loading code.

* bin/asp/viewcvs.asp
* bin/asp/query.asp
    add configuration loading code

* bin/mod_python/.htaccess
    specify new mod_python handler, remove reference to
    <VIEWCVS_APACHE_LIBRARY_DIRECTORY>

* bin/mod_python/handler.py
    added, holds new mod_python handler

* bin/mod_python/viewcvs.py
* bin/mod_python/query.py
    rewrite for new handler, add hardcoded library and configuration paths

* viewcvs.conf.dist
    remove references to <VIEWCVS_INSTALL_DIRECTORY>

* viewcvs-install
  (FILE_INFO_LIST):
    stop hardcoding paths in config files

  (SetPythonPaths,):
    get rid of <VIEWCVS_INSTALL_DIRECTORY> and
    <VIEWCVS_APACHE_LIBRARY_DIRECTORY> substitutions

  (ApacheEscape, _re_apache):
    removed

  (InstallTree):
    stop hardcoding paths in lib directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1173 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-06 04:04:14 +00:00
cmpilato
80436a855c * lib/viewcvs.py
(_get_diff_paths_parts): Was _get_location.  This is a reversion of
    a changed accidentally committed in r1171.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1172 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-05 14:35:35 +00:00
cmpilato
74090cdc09 * viewvc/lib/viewcvs.py
(view_directory, redirect_pathrev, view_log): Only call _last_rev()
    when viewing a Subversion repository (per the assert in the
    function).
  (_get_location): Was _get_diff_paths_parts.  *** THIS CHANGE WAS A 
    MISTAKE, REVERTED IN r1172 ***

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1171 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-02 20:46:24 +00:00
cmpilato
3f03d0923e Some diff-related fixes.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.rawdiff): Stop being so picky about the diff
    header sanity.  Start looser, and we'll tighten up as we need to.

* lib/vclib/__init__.py
  (_diff_fp.close): Add 'self' to the parameter list.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1170 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-22 16:32:59 +00:00
cmpilato
5f34e658fc * viewvc.org/index.html
Oops.  Missed a ViewCVS -> ViewVC in the title.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1169 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-17 15:00:15 +00:00
cmpilato
22a6e8b209 * templates/markup.ezt
Revert a change made in r1150, in which the markup template used the
  'viewable' data to avoid displaying binary files.  We'll let custom
  template writers do that if they wish, but will maintain our prior
  behavior.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1168 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 16:43:52 +00:00
cmpilato
4782355970 * viewcvs-install
Fix some code width and formatting issues throughout.
  (install_tree): Add '.svn' to the list of ignorable paths.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1167 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 16:42:18 +00:00
cmpilato
5ca85cbf4d * viewcvs.sourceforge.net/contact.html
* viewcvs.sourceforge.net/contributing.html
* viewcvs.sourceforge.net/download.html
* viewcvs.sourceforge.net/images
* viewcvs.sourceforge.net/index.html
* viewcvs.sourceforge.net/license-1.html
* viewcvs.sourceforge.net/styles.css
* viewcvs.sourceforge.net/template-authoring-guide.html
* viewcvs.sourceforge.net/upgrading.html
* viewcvs.sourceforge.net/who.html
  Replace the whole of the SourceForge site...

* viewcvs.sourceforge.net/.htaccess
  ...with a simple redirect.  :-)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1166 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 06:40:29 +00:00
cmpilato
c3614949e8 I like the Perl dig, but let's be kind enough to use it as a reminder
of what can go wrong, not a cheap claim of what we somehow did right.

* viewvc.org/index.html
  Move the Perl slam from here...

* viewvc.org/contributing.html
  ...to here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1165 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 06:21:47 +00:00
cmpilato
a192534c92 * viewvc.org/contact.html
* viewvc.org/contributing.html
* viewvc.org/download.html
* viewvc.org/index.html
* viewvc.org/license-1.html
* viewvc.org/upgrading.html
* viewvc.org/who.html
  Remove SourceForge logo and linkage.

* viewvc.org/styles.css
  Minor stylation tweaks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1164 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 06:14:05 +00:00
cmpilato
373041996d Copy the old SourceForge site so it can be cleaned up
for use at viewvc.[com|net|org].

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1163 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 04:56:12 +00:00
cmpilato
db63df565e * tools/make-release
Update the release tool to work with the Subversion repsitory.

* viewcvs.sourceforge.net/contributing.html
  Update whole sections of this page (including the part that tells
  how to make use of the release tool) with post-migration information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1162 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-12 07:06:54 +00:00
cmpilato
3c9b6d1869 Tigris.org likes to use '/trunk/www' for the project htdocs stuff.
This gives me a chance to finally rename the 'www' directory to
something more in line with other CGI programs I've seen.  And while
I'm here, and while we have Subversion, I might as well do many of the
reorgs I've been wanting to do for some time.

* www
  Renamed to...

* bin
  ...this.

* standalone.py,
* tools/make-database,
* tools/svndbadmin,
* tools/loginfo-handler,
* tools/cvsdbadmin
  Moved from here...

* bin/standalone.py,
* bin/make-database,
* bin/svndbadmin,
* bin/loginfo-handler,
* bin/cvsdbadmin
  ...to here.

* viewcvs-install
  Update locations of moved files.

* viewcvs.sourceforge.net/upgrading.html
  Tweak relevant documentation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1161 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-12 06:15:20 +00:00
cmpilato
fc5ec817e5 Website tweaks to track project rename and relocation.
* viewcvs.sourceforge.net
  Renamed from...

* website
  ...here.

* viewcvs.sourceforge.net/who.html
* viewcvs.sourceforge.net/license-1.html
* viewcvs.sourceforge.net/upgrading.html
* viewcvs.sourceforge.net/download.html
* viewcvs.sourceforge.net/contributing.html
* viewcvs.sourceforge.net/index.html
* viewcvs.sourceforge.net/contact.html
  Update text to indicate new project name and location.  Historical
  and legal references to ViewCVS were left untouched -- not sure what
  to do about the legal ones just yet.

* viewcvs.sourceforge.net/images/title.xcf
  New Gimp multi-layer file, created from...

* viewcvs.sourceforge.net/images/title.psd
  ...the old PhotoShop file.  I didn't know Gimp could do that!!
  
* viewcvs.sourceforge.net/images/title.jpg
  Re-rasterize the title graphic with new "ViewVC"-bearing text.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1160 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-12 05:15:30 +00:00
cmpilato
4896268450 Re-add Russ Yanofsky's "last_rev" support, fine-tuned for performance
by myself.

NOTE: There are still some pool usage fixes to be made here.  Boy am I
looking forward to Subversion 1.3.0's (almost-)pool-free bindings...

* viewcvs/website/template-authoring-guide.html
  Restore definition of lastrev template item.

* viewcvs/templates/include/pathrev_form.ezt
  Expose the lastrev dictionary item.

* viewcvs/lib/vclib/svn/__init__.py
  (last_rev): New.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (last_rev): New.

* viewcvs/lib/viewcvs.py
  (_last_rev): New wrapper around the svn provider's last_rev() functions.
  (pathrev_form, redirect_pathrev, view_log, view_directory): Use _last_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1159 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-10 22:08:48 +00:00
cmpilato
6d792a94a9 * viewcvs/lib/vclib/svn/__init__.py
(get_revision_info): Pull the revision props directly instead of using
    the (buggy) ChangeCollector.get_root_props() interface.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1158 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-10 16:01:15 +00:00
cmpilato
41975fa847 * viewcvs/templates/revision.ezt
Move the log message into the metadata table (this has been bugging
  me for some time), and don't force the table to 100% width.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1157 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-10 15:52:11 +00:00
rey4
af70f41740 * templates/docroot/help_rootview.html:
fix HTML error caught by Greg Stein


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1156 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-09 16:06:09 +00:00
rey4
8aa47a94e9 More documentation updates
* templates/docroot/help_rootview.html
* templates/docroot/help_dirview.html
* templates/docroot/help_log.html
    updated

* templates/docroot/help_logtable.html
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1155 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-09 15:34:25 +00:00
rey4
8bba165888 Get diffs to work in the ccvs module (used when use_rcsparse is enabled),
using the system "diff" command like the svn and svn_ra modules. Factor
the diff code out of the svn and svn_ra modules so they can share
functionality with each other and ccvs. Thanks to C. Mike for getting me
to work on this.

* lib/vclib/__init__.py:
  (_diff_fp):
    new class, based on svn_ra.FileDiff, used by ccvs, svn, and svn_ra
    modules

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.rawdiff):
    implement in terms of openfile, itemlog, and _diff_fp

* lib/vclib/svn_ra/__init__.py
  (FileDiff, do_diff, _escape_msvcrt_shell_command, _escape_msvcrt_shell_arg):
    removed

  (temp_checkout)
    new function

  (SubversionRepository.rawdiff):
    change implementation to use temp_checkout and _diff_fp

* lib/vclib/svn/__init__.py
  (do_diff):
    removed

  (temp_checkout):
    new function, based on code from subversion's fs.py

  (SubversionRepository.rawdiff
    change implementation to use temp_checkout and _diff_fp


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1154 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-09 15:29:56 +00:00
cmpilato
e5f784525f Built-in help touch-ups.
* viewcvs/templates/docroot/help.css
  Added (a file from a recent patch by Marten Thavenius <martent@gmail.com>
  which I inadvertently failed to version when applying the patch).

* viewcvs/templates/docroot/help_rootview.html
  Update names of Fogel's CVS book and my (et al) Subversion book.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1153 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-08 14:33:04 +00:00
rey4
78c66dff21 Documentation updates.
* CHANGES
    add changes since last time we were going to release 1.0

* templates/docroot/help_rootview.html
    add better overview of ViewCVS. a little dry but more useful than
    "Directory entries end in slashes" and other stuff that shouldn't have
    to be pointed out.

    also remove outdated information about ViewCVS Project and
    replace it with a link to viewcvs.sourceforge.net


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1152 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-08 12:21:15 +00:00
rey4
b0d6bf328e Restore the sometimes checkout, sometimes markup behavior for
file links in the directory listing templates. Also make other
minor cleanups.

* templates/directory.ezt
    restore the file links and make the alt attribute for the
    parent direcotry icon the same as for the other icons

* templates/dir_alt.ezt
    restore the file links and add title attributes to all links

* website/upgrading.html
    update documentation for 0.9's rows.rev_href variable

----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1151 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-07 08:51:48 +00:00
cmpilato
0eab479ca0 Make the various file-related views available from the directory and
log views on a per-entry/revision basis.  Template authors can choose
to ignore the 'viewable'-ness of an item if they choose.  In the
process, this makes the directory view always link to the markup view
for files (instead of sometimes doing markup, sometimes checkout).
Consistent, predictable UI, folks ...

* viewcvs/lib/viewcvs.py
  (get_file_view_info): New.
  (nav_header_data, view_directory, view_log): Use new get_file_view_info to
    populate file navigation links.

* viewcvs/templates/markup.ezt
  If a file isn't viewable, show a warning instead of the markup.

* viewcvs/website/upgrading.html
  Track changes in the data dictionary.

* viewcvs/website/template-authoring-guide.html
  Track changes in the data dictionary, and fill in a few blanks here
  and there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1150 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-04 19:20:55 +00:00
cmpilato
811b660e86 Restore performance by removing extremely expensive Subversion history
crawl.  Also, gracefully redirect old non-HEAD directory views.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Redirect old DIRECTORY?rev=REV URLs to
    DIRECTORY?pathrev=REV ones.
  (_last_rev): Removed.
  (pathrev_form, redirect_pathrev, view_log): Lose the "lastrev" stuff.

* viewcvs/templates/include/pathrev_form.ezt,
* viewcvs/website/template-authoring-guide.html
  Track the loss of "lastrev".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1149 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-04 13:16:24 +00:00
rey4
7080f2c083 Fix error in CVS log view when file has default branch set.
* lib/viewcvs.py
  (view_log):
    fix call to prep_tags


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1148 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-04 05:46:08 +00:00
rey4
92057a3380 Reorganize and update template information in upgrade guide.
* website/upgrading.html
    put all information about 0.9 template variables in a big
    table sorted alphabetically by variable name. Table was
    generated from a little script which parsed the 0.9
    templates and extracted the names of all variables that
    they referenced, so the list is complete and accurate.
    The color scheme was generated by me, so the table is
    garish and maybe even ugly. Feel free to modify.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1147 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:36:14 +00:00
rey4
c002889dad Take some rough edges off the new sticky revision interface. Instead of
showing 404 errors when users try to jump to revisions where the path
being viewed doesn't exist, just redirect to the closest revision where
the path does exist.

Also, italicize the links which change the current 'pathrev' value
to make them stand out from links that stay within the current revision.

* lib/viewcvs.py
  (redirect_pathrev):
    new view that validates input from the pathrev form and redirects to
    the right revision

  (pathrev_form):
    new function that generates fields for pathrev form

  (_last_rev):
    new function for tracking subversion revisions

  (Request.run_viewcvs, Request.get_link, _legal_params, _views):
    add handling for redirect_pathrev view

  (Request.get_form):
    new function that wraps around get_link

  (view_directory, view_log):
    make use of new pathform_form and get_form functions

  (common_template_data, view_revision, view_queryform):
    make use of get_form function

  (view_directory, view_log):
    make use of pathrev_form

* templates/include/pathrev_form.ezt
    only show the "Clear" button when clearing won't cause a 404

* templates/annotate.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/markup.ezt
    italicize revision jumping links

* website/template-authoring-guide.html
    update


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1146 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:33:56 +00:00
rey4
01437d5937 New URL scheme for Subversion. The problem with the old scheme is it
doesn't have a concept of a "sticky" revision. So if you are looking
at version 10 of a directory, and click to view a file inside which
was last modified in version 6, the fact you were looking at version 10
of the parent directory is not recorded anywhere, and the "Parent Directory"
links on the markup page will take you to a version 6 directory listing
instead of the listing you came from. This problem exists all over
ViewCVS, not just in directory listings, and the result of it is that when
you browse a repository by following the provided links you get sent further
and further back into the history, all the while seeing incomplete log pages
and outdated directory listings which you never asked for.

The new URL scheme works by introducing a new 'pathrev' sticky variable and
is described in detail in a comment in the _orig_path function in
lib/viewcvs.py. The scheme is not backwards compatabile with all (or
maybe even most) old subversion URLs. Specifically, any old URL referring
to a path that no longer exists in the HEAD will not work. Other subversion
URLs will still work.

It is still possible to add backwards compatibility. We'd have to rename
the rev parameter to something else, so we could know that all URLs with
'rev' in them are old style URLs which need to be redirected. I don't know
if it's worth doing this though.

This is not an isolated change. I've tried to unite the Subversion "sticky
revision" with the present "only_with_tag" logic for CVS. And since I had
to go over viewcvs.py with a fine-toothed comb implementing these things,
there are also some miscellaneous cleanups there.

* lib/vclib/bincvs/__init__.py
  (_file_log):
    change filtering so when matching revisions to tag, includes all
    preceding revisions, not just tag revision itself

* lib/viewcvs.py
  (_sticky_vars):
    'only_with_tag' is gone, so change this back into a list with no
    span-roots values

  (request.run_viewcvs):
    read new 'pathrev' parameter and use it when calling repos.itemtype

  (request.get_link):
    add 'pathrev' parameter to urls, restore update _sticky_vars loop

  (_legal_params, prep_tags, build_commit):
    replace 'only_with_tag' with 'pathrev'

  (_orig_path):
    new function

  (nav_path, common_template_data):
    stop adding 'rev' parameters to links
    removed unused 'roots_href' template variable

  (nav_header_data):
    add new 'revision_href', 'orig_path', 'orig_href' template variables
    for use in markup and annotate views

  (view_markup, view_checkout, view_annotate, setup_diff, generate_tarball,
   download_tarball):
    use 'pathrev' when looking up file revision

  (view_directory):
    use 'pathrev' when looking up directory revisions instead of 'rev'.
    stop adding 'rev' to links.
    add template variables: pathrev, pathrev_action, pathrev_hidden_values.
    remove unused template variables: num_files, rev, view_tag, has_tags,
    main_href, jump_rev_action, jump_rev_hidden_values, row.show_log.

  (view_log):
    use 'pathrev' to retrieve log information instead of 'rev'.
    stop linking to original paths of copied files.
    add template variables: entry.orig_path, entry.orig_href, default_branch,
    pathrev, pathrev_action, pathrev_hidden_values, branch_tags, plain_tags.
    remove template variables: entry.filename, entry.prev_path,
    branch, path_selected, view_tag, branch_names, branch_select_action,
    branch_select_hidden_values.

  (view_cvsgraph):
    use common_template_data instead of nav_header_data, 'pathrev' instead
    of 'only_with tag'

  (view_diff):
    use common_template_data instead of nav_header_data
    add template variables: path_left, path_right

  (view_revision):
    use 'pathrev' instead of 'rev' in links

* templates/include/dir_header.ezt
    rearrange header and add sticky tag/revision row

* templates/include/dir_footer.ezt
    remove tag selector

* templates/include/pathrev_form.ezt
    new, sticky tag/revision selector form based on code from
    dir_footer.ezt

* templates/include/branch.ezt
* templates/include/branch_form.ezt
* templates/include/view_tag.ezt
    removed

* templates/include/log_header.ezt
    new, based on branch.ezt and view_tag.ezt

* templates/include/log_footer.ezt
    new

* templates/include/log.ezt
* templates/include/log_table.ezt
    include log_header.ezt and log_footer.ezt

* templates/include/annotate.ezt
* templates/include/diff.ezt
* templates/include/markup.ezt
    show original paths and add view_revision links

* cvsgraph.conf.dist
    replace only_with_tag parameter with pathrev

* website/template-authoring-guide.html
    update template variable information


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1145 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:31:02 +00:00
rey4
5204e26666 Change vclib interface to accept 'rev' parameters wherever it accepts
path parameters so it is possible to use a single Repository object
to request information about any path at any revision.

Note: I wasn't able to test the svn_ra.get_location function because
I only have subversion 1.2.3.

* lib/vclib/__init__.py
  (Repository.itemtype, Repository.openfile, Repository.listdir,
   Repository.dirlogs, Repository.itemlog, Repository.annotate):
    add rev arguments, update docstrings

* lib/vclib/bincvs/__init__.py
  (CVSRepository.itemtype, CVSRepository.listdir, BinCVSRepository.openfile,
   BinCVSRepository.dirlogs, BinCVSRepository.itemlog):
    same

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs, CCVSRepository.itemlog):
    same

* lib/vclib/svn/__init__.py
  (SubversionRepository.__init__):
    remove rev argument

  (get_location, created_rev, _get_history, get_revision_info, _fetch_log,
   _get_last_history_rev, get_logs, do_diff,
   SubversionRepository.itemtype, SubversionRepository.openfile,
   SubversionRepository.listdir, SubversionRepository.dirlogs,
   SubversionRepository.itemlog, SubversionRepository.annotate):
    add rev arguments, use new _getrev and _getroot functions to handle
    all revision string parsing and revision_root creation

  (SubversionRepository._getrev, SubversionRepository._getroot):
    new functions

* lib/vclib/svn_ra/__init__.py
  (_rev2optrev):
    accept integers instead of strings, and eliminate head/unspecified
    revision handling which is already taken care of by _getrev

  (SubversionRepository.__init__):
    remove rev argument

  (get_location, created_rev, get_revision_info, get_logs,
   SubversionRepository.itemtype, SubversionRepository.openfile,
   SubversionRepository.listdir, SubversionRepository.dirlogs,
   SubversionRepository.itemlog, SubversionRepository.annotate,
   SubversionRepository.rawdiff, SubversionRepository._get_dirents):
    add rev arguments, use new _getrev function to handle all revision
    string parsing

  (SubversionRepository._getrev):
    new function

* lib/blame.py
  (link_includes):
    update call to repos.itemtype

* tools/cvsdbadmin
  (RecurseUpdate):
    update call to repos.listdir

* lib/viewcvs.py
  (Request.run_viewcvs):
    update calls to SubversionRepository constructors and _strip_suffix

  (_strip_suffix):
    add rev parameter, remove redundant where parameter

  (_repos_pathtype, view_markup, search_files, _get_diff_path_parts,
   generate_tarball):
    update calls to vclib methods

  (nav_path, view_directory, view_log, setup_diff, download_tarball,
   view_revision):
    explicitly read 'rev' query param instead of relying on
    SubversionRepository.rev, and update vclib calls


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1144 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:23:42 +00:00
cmpilato
7787585540 * viewcvs/lib/viewcvs.py
(Request.get_link): Just some whitespace/formatting cleanups.  No
    logic changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1143 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-02 19:15:52 +00:00
cmpilato
9213450bc0 Some revision view cleanups.
* viewcvs/lib/viewcvs.py
  (view_revision): Fix the links generated for deleted items.

* viewcvs/lib/vclib/svn/__init__.py
  (_cleanup_path): New.
  (_trim_path): Remove.
  (_log_helper, NodeHistory.add_history): Use new _cleanup_path().
  (ChangedPathSet.add_change): Fix the detection of replaces-with-history.
    Also, use new _cleanup_path().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1142 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-02 19:13:07 +00:00
cmpilato
b6b1146a1c * viewcvs/lib/viewcvs.py
(view_directory): Oops!  Use make_time_string() to set entries.date
    to a string date representation, not "number of seconds since
    Epoch".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1141 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-28 13:53:36 +00:00
cmpilato
721b99609b More data dictionary consistency tweaks.
* viewcvs/lib/viewcvs.py
  (view_directory): Lose the initialization of the unused entries.href
    (accidentally overlooked a previous purge).  Rename entries.type
    to entries.pathtype.
  (view_revision): Recycle changes.pathtype (which just happens to
    work because the vclib file/dir constants are the same as those
    used for our EZT exposure) instead of setting a second
    changes.type variable.

* templates/directory.ezt,
* templates/dir_alternate.ezt,
* viewcvs/website/upgrading.html
  Track renamed and dropped variables.

* viewcvs/website/template-authoring-guide.html
  Fill in more of the directory view stuff, tracking the renamed and
  dropped variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1140 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-26 21:00:24 +00:00
cmpilato
203faae2d0 Consistify the datestamp variables to just 'date' (the timestamp) and
'ago' (the string describing how long ago that timestamp was from
"now").

* viewcvs/lib/viewcvs.py
  (view_directory): Expose entries.date variable, and rename
    entries.time to entries.ago.

* viewcvs/templates/dir_alternate.ezt,
* viewcvs/templates/directory.ezt
  Track renamed entries.time variable.

* viewcvs/website/upgrading.html,
* viewcvs/website/template-authoring-guide.html
  Track changes to the data dictionary.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1139 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-26 19:40:42 +00:00
cmpilato
d36d230e75 * website/download.html
Add link to nightly snapshots.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1138 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-21 12:23:57 +00:00
cmpilato
010b3be03c Fix Bug #1332969 - small fix of markup warning on Repository Listing page
* viewcvs/templates/include/header.ezt
  Fix a markup warning which occurs when there's no nav_path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1137 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-20 13:19:19 +00:00
cmpilato
a27d1016c9 Miscellaneous tweaks.
* viewcvs/lib/viewcvs.py
  (copy_stream): Add 'htmlize' option.
  (MarkupPipeWrapper.__call__): Use copy_stream() with htmlize=1
    instead of duplicating that loop logic.
  (view_log): Set 'rev_selected' and 'path_selected' based on
    previously acquired values.
  (_re_extract_rev): Tweak regexp so it can match context diff '***'
    headers, too.
  (view_patch): Move request.server.header() call to just before
    rendering.
  (view_diff): Escape the 'patch_href' item.  Move
    request.server.header() call to just before rendering.
  (view_error): Don't use the error template if we've already started
    sending output through the server.

* viewcvs/lib/sapi.py
  (ModPythonServer.__init__, ModPythonServer.header): Add and manage
    new headerSent variable (like the ones used by CGIServer and
    ASPServer).

* viewcvs/lib/query.py
  (main): Call server headers here instead of down in the exception printer.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1136 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-19 20:38:33 +00:00
cmpilato
8f79165d0c Move some logic that really UI-ish from the core code into the
templates.

* viewcvs/lib/viewcvs.py
  (view_log): Lose 'tr1' and 'tr2' dictionary items.

* viewcvs/templates/log.ezt,
* viewcvs/templates/log_table.ezt
  Calculate first and last revisions using EZT magic.

* viewcvs/templates/include/diff_form.ezt
  Choose default diff form values based on the 'rev_selected'
  dictionary item as well as the EZT-calculated first and last
  revisions.

* viewcvs/website/upgrading.html,
* viewcvs/website/template-authoring-guide.html
  Track removed variables, and add some missing punctuation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1135 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-17 20:31:11 +00:00
cmpilato
2d37af8286 More template authoring guide; more dictionary tweaks as this exercise
points out more ugliness (which was its secondary goal, after all).

* viewcvs/lib/viewcvs.py
  (view_revision, view_markup, view_log): Use 'date' instead of
    'date_str' in data dictionary items.
  (view_directory): Use 'entries' instead of 'rows' in the data
    dictionary.  Remove redundant 'has_tags' dictionary init.

* viewcvs/templates/markup.ezt,
* viewcvs/templates/log.ezt,
* viewcvs/templates/revision.ezt,
* viewcvs/templates/log_table.ezt,
* templates/dir_alternate.ezt
* templates/directory.ezt
* viewcvs/website/upgrading.html
  Track variable renames.

* viewcvs/website/template-authoring-guide.html
  Track variable renames, and begin working on the directory view section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1134 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-17 19:50:20 +00:00
cmpilato
1a7a0c0a77 * viewcvs/lib/viewcvs.py
(view_patch): Fix a little logic bug in the patch diff_format
    selector.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1133 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 21:51:07 +00:00
cmpilato
99da769f25 Lose the poorly thunk 'makepatch' checkbox on the diff form. There
are probably whole volumes written about similar UI decisions and how
unintuitive they are.  Instead, abstract that work in a new patch
view.

NOTE:  While the new patch view supports the diff_format input
parameter, no template links or forms make use of it.  The code will
default to unified diff unless told to use context diff via the CGI
params or runtime config.

* viewcvs/lib/viewcvs.py
  (_legal_params): Lose 'makepatch'.  It was a good idea with a poor
    implementation choice.
  (_views): Add new 'patch' view, and tweak the alignment of this
    definition a bit.
  (get_link): Always copy the params dictionary instead of tainting
    the input dictionary.
  (view_patch): New.  Was the "if makepatch" section of view_diff().
  (view_diff): Abstract some setup stuff into setup_diff(), and the
    makepatch stuff into view_patch().

* viewcvs/templates/diff.ezt
* viewcvs/templates/include/diff_form.ezt
  Lose the 'makepatch' form checkbox.

* viewcvs/templates/include/file_header.ezt
  Add a patch view link.

* viewcvs/templates/docroot/images/diff.png
  New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1132 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 21:35:58 +00:00
cmpilato
46a3ee4888 * viewcvs/templates/templates/docroot/images/broken.png,
* viewcvs/templates/templates/docroot/images/text.png
  Fix some transparency-related oddities in these images.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1131 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 21:32:41 +00:00
cmpilato
043995ce16 Tweak the diff view data dictionary for consistency.
* viewcvs/lib/viewcvs.py
  (DiffSource._flush_row): Make the 'have_left' and 'have_right'
    members of the change object be EZT booleans.
  (DiffSource._get_row): Rename 'extra' member to 'line_info_extra'.
  (view_diff): Rename some data dictionary variables:
    'rev1' => 'rev_left'
    'rev2' => 'rev_right'
    'tag1' => 'tag_left'
    'tag2' => 'tag_right'
    'date1' => 'date_left'
    'date2' => 'date_right'

* viewcvs/templates/diff.ezt
  Track renamed variables.

* viewcvs/website/upgrading.html
  Note the slight tweak to the way 'have_left' and 'have_right' work,
  not that I expect anyone to have really been testing for "yes".
  Also, note the renamed variables.

* viewcvs/website/template-authoring-guide.html
  Populate the annotate, graph, and diff sections, tracking the
  tweaked variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1130 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 20:29:16 +00:00
cmpilato
2777f41d32 * website/template-authoring-guide.html
Add some left/right padding in table cells.  Also, populate the NAVDATA
  section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1129 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 16:13:51 +00:00
cmpilato
f5ddba9443 Lose the unnecessary 'jump_rev' data dictionary item. It was used in
two views (directory and revision).  In the directory case, it was
renamed to just 'rev'; in the revision case, it was dropped as
redundant with with existing 'rev' variable.  Also, don't assume that
"is not a directory" implies "is a file" when looking at the common
'pathtype' variable.

* viewcvs/lib/viewcvs.py
  (common_template_data): Allow 'pathtype' to be None instead of
    'file' when the pathtype is neither a file nor a directory.
  (view_revision): Lose 'jump_rev'.
  (view_directory): Rename 'jump_rev' to just 'rev'.

* viewcvs/templates/revision.ezt
  Use 'rev' instead of 'jump_rev' throughout.

* viewcvs/templates/include/dir_header.ezt
  Stop using 'jump_rev' -- make 'youngest_rev' the default jump-to
  location.

* viewcvs/website/upgrading.html,
* viewcvs/website/template-authoring-guide.html
  Track the demise of 'jump_rev'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1128 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 15:33:35 +00:00
cmpilato
9d39c14082 * website/template-authoring-guide.html
Populate the COMMON section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1127 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 15:28:51 +00:00
cmpilato
1cf2b31004 * website/template-authoring-guide.html
Begin work on a template authoring guide.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1126 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-12 17:40:10 +00:00
cmpilato
df37902e41 * viewcvs/lib/vclib/svn/__init__.py
(get_revision_info): Wrap reads from the revision property hash with
    str() to ensure conversion from "buffer" type.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1125 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-11 16:59:34 +00:00
cmpilato
30f1537eb7 * viewcvs/templates/revision.ezt
Add a trailing slash to directory paths.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1124 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-11 16:58:11 +00:00
cmpilato
d9f6360681 Fix some bugs introduced yesterday that show up when using the
'svn_ra' module with the 'revision' view.

* viewcvs/lib/viewcvs.py
  (view_revision): Collapse some similar URL generation calls, but
    also trap the AssertionError thrown when using the 'svn_ra' backend
    (as it can't determine path types yet).

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LastHistoryCollector.add_history): It's a long way from correct,
    but at least pass along copyfrom information correctly from this
    log handler.

* viewcvs/templates/revision.ezt
  Make the file/dir icons part of the filename links, too.  But don't
  make links where no valid hrefs exist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1123 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-11 14:35:21 +00:00
cmpilato
997d65e926 Make some tweaks to the 'revision' view to differentiate between
'added' and 'replaced' items, and to make the fact that something was
or wasn't copied from elsewhere a first-class piece of data.

* viewcvs/lib/vclib/svn/__init__.py
  (_compare_paths): Move from the svn_ra module.
  (ChangedPath.__init__): Add 'is_copy' param, and stow it away.
  (ChangedPathSet): New.
  (get_revision_info): Use newer svn.repos.ChangeCollector() interface
    so we can hook the notification callback (using the new
    ChangedPathSet class) and get replacement information.

* viewcvs/lib/viewcvs.py
  (view_revision): Boolean-ify the new is_copy ChangedPath member.
    Expose change.log_href links to log views.
  (common_template_data): Expose log_href for Subversion directories.

* viewcvs/templates/docroot/styles.css
  (td, th, tr): Set vertical-align to 'top'.

* viewcvs/templates/revision.ezt
  Re-work this template into a different layout (still not happy it,
  but...)

* viewcvs/lib/vclib/svn_ra/__init__.py
  Import _compare_paths from the 'svn' module.
  (LastHistoryCollector.add_history): Tweak to recognize replaced
    items, and to pass the new 'is_copy' param to ChangedPath().
  (_compare_paths): Move to the 'svn' module.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1122 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-10 20:22:59 +00:00
cmpilato
ef9e91dd20 * viewcvs/lib/viewcvs.py
(DiffSource._get_row): Rename 'line1' and 'line2' 'change' members to
    'line_info_left' and 'line_info_right', respectively.

* viewcvs/templates/diff.ezt
  Track renamed template variables.

* viewcvs/website/upgrading.html
  Document renamed variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1121 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-10 14:10:48 +00:00
cmpilato
0be0bf1e9d * viewcvs/lib/viewcvs.py
(view_revision_svn): Remove.
  (view_revision): Eat up view_revision_svn's little bit o' work.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1120 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-10 13:38:58 +00:00
cmpilato
2e9593eff0 * viewcvs/lib/vclib/bincvs/__init__.py
(BinCVSRepository.rawdiff): Ignore warnings from rcsdiff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1119 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-05 12:51:50 +00:00
cmpilato
2e13e6fd4c Expose regular-expression-based search to Subversion repositories, too.
* viewcvs/lib/viewcvs.py
  (view_directory): Set 'selection_form' and friends for 'svn'
    roottypes, too.

* viewcvs/lib/vclib/svn/__init__.py
  (FileContentsPipe.readline): Fix usage of core.svn_stream_readline().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1118 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-04 15:05:39 +00:00
cmpilato
8bdfd374a2 Sticky variables are cool and all (despite being less elegant than a
cookies-based implementation...), but there are some that simply
should stick when switching to a view of a different repository root
(such as only_with_tag).

* viewcvs/lib/viewcvs.py
  (_sticky_vars): Convert to a dictionary, and let the values
    associated with the sticky variables indicate whether that
    stickiness spans repository roots.
  (Request.get_link): Pay attention to the spanrootsedness of the
    sticky variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1117 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-04 15:01:08 +00:00
cmpilato
0506513760 Expose "tip o' the branch" links from the log view.
* viewcvs/lib/viewcvs.py
  (view_log): Add new template variables: 'tag_view_href',
    'tag_download_href', 'tag_download_text_href', 'tag_annotate_href',

* viewcvs/templates/include/view_tag.ezt
  Expose links to the tip of a currently selected branch.

* viewcvs/website/upgrading.html
  Document new variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1116 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-03 22:23:35 +00:00
cmpilato
54c1b4f760 Finish Bug #1309545 ("tip of the branch" URLs don't work with 'bincvs' module)
* viewcvs/lib/vclib/bincvs/__init__.py
  (COMalformedOutput, COMissingRevision): New exception classes.
  (BinCVSRepository._get_tip_revision): New helper.
  (BinCVSRepository.openfile): If a COMissingRevision exception is
    raised, use rlog to try to resolve to a real (existing) revision.
  (_parse_co_header): Stop writing HTML error messages, and use the
    new exceptions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1115 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-03 20:57:12 +00:00
cmpilato
0881ded7c0 * templates/directory.ezt,
* templates/dir_alternate.ezt
  Lose unnecessary P tags which tend to oversize errorful rows.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1114 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-03 15:31:27 +00:00
cmpilato
73b347ee5d Finish Bug #1097695 - Exception on CVS revisions with 2-digit year
* viewcvs/lib/vclib/bincvs/__init__.py
  (_parse_log_entry): Ensure that revision years > 1970, as rlog seems
    only to assume they are > 1900.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1113 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-30 15:10:49 +00:00
cmpilato
a16f40e0ac * viewcvs/templates/directory.ezt
Lose the alt-text on the row icons, and restore View/download distinction
  in title attributes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1112 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-29 13:42:32 +00:00
cmpilato
2a93244acb * viewcvs/lib/viewcvs.py
(view_query): Query on subdirectories of the request directories,
    too.  This is a followup to the changes made in revision 1.367.
    Thanks to Russell Yanofsky for noticing the mistake.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1111 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-29 13:28:38 +00:00
cmpilato
c85732a907 * viewcvs/lib/viewcvs.py
(nav_header_data, view_log): Expose annotation links for Subversion
    in a couple more places.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1110 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-28 19:27:55 +00:00
cmpilato
97a07dc88e This patch (mostly by Marten Thavenius) upgrades ViewCVS to XHTML 1.0
Strict.  Changes have been made in the EZT templates, the CSS files,
HTML code embedded in the Python files as well as in the help
files. The original code structure and design is the very same.  No
other improvements have been made to the browser code and it still
uses the old layout tables to create the page grid.

Apart from the XHTML/CSS code changes, the patch adds an argument (-x
x) for CVSGraph in viewcvs.py in the view_cvsgraph function to tell
CVSGraph to generate XHTML code. For Mozilla/Firefox to recognize the
id attribute in the image map generated, the content-type must be set
to application/xhtml+xml (see
https://bugzilla.mozilla.org/show_bug.cgi?id=109445).  This patch does
however not change the content-type, but uses an ugly hack to make the
CVSGraph output work in Mozilla with the current text/html
content-type: a name attribute is merged into the id attribute in the
map_name defined in the cvsgraph.conf.dist file.

The XHTML code does not contain the standard XML declaration, just the
XHTML 1.0 Strict Doctype. This is to keep ViewCVS as encoding agnostic
as before and let the browser decide which encoding to use. An XML
file without the encoding declared must be interpreted as UTF-8 (or
UTF-16 if the byte order mark is included).

* viewcvs/cvsgraph.conf.dist
  Add name="" hack to the 'map_name' variable so Mozilla/Firefox will work.

* viewcvs/lib/ezt.py
  XHTML-ize sample output.

* viewcvs/lib/viewcvs.py
  XHTML-ize hard-coded output.
  (view_cvsgraph): Pass "-x x" to cvsgraph to force XHTML production.

* viewcvs/lib/blame.py
* viewcvs/lib/debug.py
* viewcvs/lib/py2html.py
* viewcvs/lib/query.py
* viewcvs/lib/vclib/bincvs/__init__.py
* viewcvs/templates/annotate.ezt
* viewcvs/templates/diff.ezt
* viewcvs/templates/dir_alternate.ezt
* viewcvs/templates/directory.ezt
* viewcvs/templates/error.ezt
* viewcvs/templates/graph.ezt
* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
* viewcvs/templates/markup.ezt
* viewcvs/templates/query.ezt
* viewcvs/templates/query_form.ezt
* viewcvs/templates/query_results.ezt
* viewcvs/templates/revision.ezt
* viewcvs/templates/roots.ezt
* viewcvs/templates/docroot/help_dirview.html
* viewcvs/templates/docroot/help_log.html
* viewcvs/templates/docroot/help_logtable.html
* viewcvs/templates/docroot/help_query.html
* viewcvs/templates/docroot/help_rootview.html
* viewcvs/templates/docroot/styles.css
* viewcvs/templates/include/branch.ezt
* viewcvs/templates/include/branch_form.ezt
* viewcvs/templates/include/diff_form.ezt
* viewcvs/templates/include/dir_footer.ezt
* viewcvs/templates/include/dir_header.ezt
* viewcvs/templates/include/file_header.ezt
* viewcvs/templates/include/footer.ezt
* viewcvs/templates/include/header.ezt
* viewcvs/templates/include/paging.ezt
* viewcvs/templates/include/sort.ezt
* viewcvs/templates/include/view_tag.ezt
  XHTML-ize hard-coded output and templatized data.

* viewcvs/CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1109 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-28 17:06:16 +00:00
cmpilato
b629620cf6 Lose 'row.href' and 'row.rev_href' for the more meaningful
'row.log_href' and 'row.view_href'.

* viewcvs/lib/viewcvs.py
  (view_directory): For files, rename 'row.href' to 'row.log_href',
    and 'row.rev_href' to 'row.view_href'.  For directories, do the
    renames, but swap the mappings.

* viewcvs/templates/dir_alternate.ezt
* viewcvs/templates/directory.ezt
  Track the changes to these data dictionary items.

* viewcvs/website/upgrading.html
  Note the changed variables.  Also, add svn_path as a configuration
  parameter recently added.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1108 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-27 18:08:47 +00:00
cmpilato
4a24ab0c36 * viewcvs/lib/viewcvs.py
(common_template_data): Show a non-empty root listing when there is
    a non-empty list of roots, regardless of the size of that list.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1107 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 19:34:41 +00:00
cmpilato
701452a3fb Fix Bug #1177407: CVS tags with a slash cause an exception
* viewcvs/lib/viewcvs.py
  (_re_validate_number): Allow '/' in tag names.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1106 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 18:57:32 +00:00
cmpilato
577728db86 Fix Bug 1271136: Query results wrong for directories with similar
names

* viewcvs/lib/viewcvs.py
  (view_query): Use "exact" matches for the query directory, instead
    of "like" ones.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1105 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 17:14:42 +00:00
cmpilato
1b967b1a09 * viewcvs/lib/vclib/__init__.py (Repository.rawdiff),
* viewcvs/lib/vclib/svn/__init__.py (SubversionRepository.rawdiff),
* viewcvs/lib/vclib/svn_ra/__init__.py (SubversionRepository.rawdiff),
* viewcvs/lib/vclib/ccvs/__init__.py (CCVSRepository.rawdiff),
* viewcvs/lib/vclib/bincvs/__init__.py (BinCVSRepository.rawdiff):
  For clarity, replace uses of the term 'path' with 'path_parts' in the
  Repository.rawdiff() stub and implementations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1104 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 16:07:17 +00:00
cmpilato
d7429e31ae Add Subversion blame support to the 'svn_ra' module, and re-enable the
'svn' module's blame support with a non-streamy kludge.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (SubversionRepository.annotate): Implement (for real).
  (_item): New, copied from one of a thousand places...

* viewcvs/lib/vclib/svn/__init__.py
  (BlameSourceKludge): New, non-streamy form of the Subversion blame factory.
  (SubversionRepository.annotate): Use BlameSourceKludge here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1103 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 15:57:57 +00:00
cmpilato
30c3fbef04 * viewcvs/lib/vclib/svn/__init__.py
(BlameSource.__getitem__): Ensure initialization of prev_rev.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1102 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-24 20:05:30 +00:00
cmpilato
edd45cb153 * viewcvs/lib/vclib/svn/__init__.py
(SubversionRepository.annotate): Re-disable temporarily.  Something's
    wrong.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1101 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 21:08:56 +00:00
cmpilato
ac88e349ca Expose annotation support for local Subversion repositories. Patch
largely by Stefan Haller <haller@ableton.com>, at least in the
approach used.

* viewcvs/viewcvs.conf.dist
  (svn_path): New configuration variable.

* viewcvs/lib/config.py
  (Config.set_defaults): Populate a new svn_path config member.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Tweak the way Subversion's vclib.Repository
    objects are opened to have different codepaths for the 'svn' and
    'svn_ra' modules, and pass the new cfg.general.svn_path option to
    the 'svn' module's SubversionRepository.

* viewcvs/lib/vclib/svn/__init__.py
  (BlameSource, BlameSequencingError, _item): New.
  (SubversionRepository.__init__): Add 'svn_path' parameter.
    Calculate and store a path for the 'svn' command-line client binary.
  (SubversionRepository.annotate): Really implement annotation.

* viewcvs/templates/log.ezt,
* viewcvs/templates/log_table.ezt
  Enable annotate links for Subversion, too!


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1100 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 20:15:08 +00:00
cmpilato
a5ad1e5f41 * viewcvs/lib/blame
(link_includes): Use the more generic itemtype() interface instead of
    the rcsfile() one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1099 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 19:40:29 +00:00
cmpilato
828ee07077 Abstract the annotate interface by moving core functionality down
into the vclib providers.

* viewcvs/lib/vclib/__init__.py
  (Repository.annotate): New interface.

* viewcvs/lib/vclib/ccvs/blame.py
  New file, with contents cored from viewcvs/lib/blame.py, and
  reworked a little bit to avoid data tainting, and to be independent
  of the vclib implementation.

* viewcvs/lib/vclib/ccvs/__init__.py
  (CCVSRepository.annotate): Implement Repository.annotate() by returning
    a blame.BlameSource object.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository.annotate) Implement by returning a
    vclib.ccvs.blame.BlameSource object.

* viewcvs/lib/vclib/svn/__init__.py
* viewcvs/lib/vclib/svn_ra/__init__.py
  (SubversionRepository.annotate): New.  Return NotImplementedError.

* viewcvs/lib/viewcvs.py
  (view_annotate): Use new blame.blame() function.

* viewcvs/lib/blame.py
  Gut this sucker, moving most of the heavy lifting into the ccvs module.
  (HTMLBlameSource): New wrapper for BlameSource objects to handle
    HTML-izing and such.
  (blame): New function, thin wrapper around
  (make_html): Remove unused 'sticky' param.  Tweak to use new
    abstracted interface, but at the cost of diff_url support.  I'll
    probably come back to this (by adding a --diff-url option), but
    does anyone really care?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1098 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 18:51:35 +00:00
cmpilato
034a661704 * viewcvs/INSTALL
Rework the list the required software-n-stuff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1097 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 13:48:36 +00:00
cmpilato
dcf43ad7b8 Teach ViewCVS to obey the Subversion location tracing algorithm, which
identifies a line of history using a path and a "peg revision", and
then traces that line of history to figure out the object's current
path as of other revisions fed to the algorithm.

Previously, if I had a Subversion file that had been renamed a few
times (so, had multiple distinct paths over time), and I wanted to
diff between revisions at which the object's path was different, as
well as different from its path as of HEAD, the URL was this
monstrously long thing:

   http://.../viewcvs/path/to/file?p1=/old/path/of/file&r1=X&p2=/another/old/path/of/file&r2=Y

Now, it's simply:

   http://.../viewcvs/path/to/file?r1=X&r2=Y

Support for p1 and p2 are still present (so you can diff across
arbitrary paths in Subversion), but URLs generated by ViewCVS will no
longer use those query params.

* viewcvs/lib/viewcvs.py
  (view_log): Lose the use of p1 and p2 in diff URLs.
  (_get_diff_path_parts): New helper function.
  (view_diff): Teach ViewCVS to obey the Subversion location tracing
    algorithm by using the new _get_diff_path_parts() helper.

* viewcvs/lib/vclib/svn/__init__.py
  Require Subversion 1.1.0 or better.
  (_allow_all, get_location): New.

* viewcvs/lib/vclib/svn_ra/__init__.py
  Require Subversion 1.3.0 or better.
  (get_location): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1096 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 13:47:53 +00:00
cmpilato
70c4a29059 * viewcvs/lib/compat.py
Revert revision 1.18.  The Way of Russell is Enlightenment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1095 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 11:22:30 +00:00
cmpilato
88ac9dd646 * viewcvs/lib/vclib/__init__.py
(InvalidRevision.__init__): Make the revision argument optional, and
    fix the exception strings up a bit.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1094 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-22 22:03:55 +00:00
cmpilato
0579698762 * viewcvs/lib/compat.py
(compare_versions): New.  (To be used in a future commit by
    Subversion vclib layers.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1093 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-22 20:37:23 +00:00
cmpilato
d19322a7c5 * viewcvs/lib/vclib/svn_ra/__init__.py
(LogCollector.add_log): Fix a bug in the rename tracing algorithm which
    was triggered whenever a path's parent was copied, and the path's
    copied location was edited, in the same revision.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1092 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-21 19:53:29 +00:00
cmpilato
1b2dc4efa3 Consistify the output of the vclib diff engines, sticking with GNU
diff format.  This also has the effect of simplifying the wrapping
code (which wasn't working anyway) a little bit.  Also, restore
functionality lost in the last re-org of the diff functionality
(svn_ra).  Finally, make the vclib.ccvs module's lack of diff
functionality a little more apparent to those who attempt to use it.

* viewcvs/lib/vclib/__init__.py
  (Repository.rawdiff): Specify that returned diffs are expected to be
    in GNU diff format.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository.rawdiff): Eat up the rcsdiff header lines, not
    exposing them to the caller.  The goal is to expose consistent
    diff output across vclib providers, so we'll shoot for GNU diff
    compliance.

* viewcvs/lib/vclib/ccvs/__init__.py
  (CCVSRepository.rawdiff): Implement this interface, though only to
    raise an exception about how the functionality isn't implemented.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (do_diff): Sync with vclib.svn.do_diff().
  (SubversionRepository.rawdiff): Implement this interface.

* viewcvs/lib/viewcvs.py
  (diff_parse_headers): Lose the 'rootpath' argument.  We've tuned the
    vclib providers to stop exposing that stuff.
  (view_diff): Update calls to diff_parse_headers().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1091 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-20 15:06:52 +00:00
pefu
adbaa3d909 Fixed SF-Bug # 1192503: Updated broken link to competing project cvsweb
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1090 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-13 22:04:24 +00:00
rey4
42955196e8 Pass strings and callbacks to EZT instead of so many pseudo file objects.
* lib/viewcvs.py
  (MarkupBuffer):
    remove, not used anymore and StringIO is always there if we need it

  (MarkupPipeWrapper):
    make into a one-shot callback instead of going though contortions to
    support repeated read() calls

  (MarkupEnscript.__init__):
    add unrelated comment

  (markup_stream_python, view_markup):
    no need to wrap strings in MarkupBuffers, ezt supports strings too


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1089 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-24 05:22:59 +00:00
rey4
f236e63a43 Various improvements to EZT
- make substitution pattern implementation to use current format instead
    of writing directly to output

  - make it possible to pass python functions to ezt templates as simple
    callbacks

  - update documentation with information about callbacks, file pointers,
    and the [format] directive

* lib/ezt.py
  (__doc__):
    update documentation

  (_write_value):
    add code to implement callbacks and substitution patterns

  (Template._parse, Template._cmd_print, Templte._cmd_print_html):
    update to work with changed _write_value function

  (Template._cmd_subst):
    removed, functionality moved into _write_value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1088 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-24 05:10:45 +00:00
rey4
883e9a98bb Simplify diff code somewhat
* lib/viewcvs.py
  (diff_parse_headers, human_readable_diff, raw_diff):
    merge raw_diff and human_readable_diff into new
    diff_parse_headers function

  (view_diff):
    call diff_parse_headers


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1087 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-24 05:01:56 +00:00
rey4
7cdebbaf24 Move some diff functionality into vclib
* lib/vclib/__init__.py
  (Repository.rawdiff, UNIFIED, CONTEXT, SIDE_BY_SIDE, _diff_args):
    new

* lib/vclib/bincvs/__init__.py
  (Repository.rawdiff):
    new

* lib/vclib/svn/__init__.py
  (Repository.rawdiff):
    new

  (do_diff):
    move code that fixes diff headers here

* lib/viewcvs.py
  (_path_parts):
    new function to break a repository path into parts

  (Request.run_viewcvs):
    use _path_parts function

  (view_diff):
    use new Repository.rawdiff methods and _path_parts


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1086 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 20:07:02 +00:00
rey4
cbc95d7617 Fix check for forbidden paths on tarball download and simplify
generate_tarball function.

* lib/viewcvs.py
  (download_tarball):
    get rid of overly broad check for forbidden paths which would 404 on
    tarballs of all directories with forbidden names instead of just top
    level directories with forbidden names.

  (generate_tarball):
    get rid of tar_top and rep_top arguments

    get rid of default value for stack argument, which is likely to cause
    problems in multithreaded environments like mod_python

    reorganize and add comments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1085 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 19:33:18 +00:00
cmpilato
12d28a5509 Sooth pain felt by Daniel Berlin <dberlin@dberlin.org>, who complained
that navigation to a Subversion resource no longer in HEAD (or in a
directory no longer in HEAD) caused generated parent directory links
which 404'ed.

* viewcvs/lib/viewcvs.py
  (nav_path, common_template_data): When generating navigational links
    for Subversion repositories, if the current page was a request
    with an associated explicit revision number, use that revision
    number in references to parent directory views and "other" views
    of the file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1084 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:52:06 +00:00
rey4
c2c60e243d Fix exception when cvsdbadmin is passed only one argument
* tools/cvsdbadmin
  (global code)
    make sure script has 2 arguments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1083 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:51:54 +00:00
rey4
6c90233f4e Tighten up some logic in cvs revision number functions. I think the first
change might fix an rare exeception someplace, but these changes been sitting
in my working copy for a couple of months and I don't remember.

* lib/vclib/bincvs/__init__.py
  (_match_revs_tags):
    when iterating over trunk revisions, don't assume that a non-empty history
    array means there is a valid previous revision, always check the "prev"
    value explicity. It could be None now that _match_revs_tags accepts
    incomplete lists of revisions (as of rev 1.47)

  (_add_tag):
    remove redundant check for None revisions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1082 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:49:47 +00:00
rey4
5d0396e4c7 Restore viewcvs's ability to run under python 1.5
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.rcs_popen):
    convert tuples to lists before passing to list.extend

* lib/compat.py
  (formatdate):
    cut n' paste of rfc822.formatdate()

* lib/popen.py
  (popen):
    don't use string "find" method

* lib/viewcvs.py
  (Request.get_link):
    don't use dictionary "setdefault" method

  (check_freshness):
    don't use rfc822.formatdate()

* lib/win32popen.py
  (CommandLine, MakePrivateHandle, MakeInheritedHandle):
    don't use +=, |= operators

  (File2FileObject):
    don't use string "find" methods

  (SpoolWorker):
    don't use print >> syntax


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1081 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:41:59 +00:00
cmpilato
11769e1b29 Miscellaneous fixes around the forbiddenness support, mostly bugs
where too much data was being hidden that I think I caused myself, but
also a security fix where not enough data was being hidden.  At any
rate, this should bring us to consistent support for forbidden modules
(directories, not files) across the various views.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Move the forbidden check until later, after
    we know the path type, because forbiddenness only applies to
    top-level directories (modules), not files.
  (view_directory): Only do forbidden checks on directories, not files.
  (view_query): Strip forbidden/hidden paths from the query results.
    Noticed by Jon Stritar (jstritar) in Bug #1249974.

* viewcvs/lib/query.py
  (build_commit): Strip forbidden/hidden paths from query results.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1080 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-17 21:45:35 +00:00
cmpilato
26d6fdb439 * viewcvs/CHANGES
Forward port entries from the 0.9.x branch.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1079 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-17 21:20:51 +00:00
cmpilato
bf4e37d54e * viewcvs/website/download.html
Update links to downloadable versions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1078 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-17 21:17:14 +00:00
cmpilato
5df9a282b0 Make svndbadmin run to completion on the Subversion source code
repository, which it previously failed to do because of poor change
handling.  Also, stop it from Aborting at the end of every run due to
double-freeing of memory.

* viewcvs/tools/svndbadmin
  (SvnRepo.__init__): No longer keep self.pool around, and certainly
    don't close it on __del__() -- that's what the svn.core.run_app()
    wrapper framework is for.
  (_get_diff_counts): Just accept a diff file pointer object as input,
    and let the caller generate such a thing and pass it in.
  (SvnRev.__init__): Make use of the change item's base_path and
    base_rev to get accurate locations against which to diff.  Update
    calls to _get_diff_counts(), and make use of a new revision root
    cache.
  (SvnRev._get_root_for_rev): New revision root caching helper.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1074 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-09 03:22:50 +00:00
cmpilato
d1b71817d7 * viewcvs/lib/viewcvs.py
(generate_tarball, Request.run_viewcvs): Use '404 Not Found' instead
    of '403 Forbidden' for forbidden paths.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1073 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 16:08:34 +00:00
cmpilato
f1657e2c34 Fix copy-n-pasto in CHANGES file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1071 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 07:58:52 +00:00
cmpilato
2c0181d625 Merge in CHANGES from 0.9.3 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1070 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 07:28:32 +00:00
cmpilato
2a75e75d23 Tweak website to point to new 0.9.3 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1069 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 07:12:53 +00:00
cmpilato
27ad9a4f9d * lib/viewcvs.py
(download_tarball): Throw a 403 Forbidden area if a tarball request
    is for a forbidden module.  Patch by Olaf Hering <olh@suse.de>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1065 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 05:30:27 +00:00
cmpilato
6eeaf2be2b * lib/vclib/svn/__init__.py
(SubversionRepository.__init__): Catch (and ignore) a ValueError
    exception thrown by signal.signal.  It's probably the situation
    described in this email:
    http://mailman.lyra.org/pipermail/viewcvs/2005q1/003357.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1064 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-08 04:46:58 +00:00
dionisos
cefd17b78e Stricter input checking: throw an exception when not expecting EOF yet.
* tparse/tparse.h, tparse/tparse.cpp: Add 'allow_eof' parameter to
  TokenStream::get() and adjust callers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1063 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 16:05:26 +00:00
dionisos
c3a80705ba * tparse/tparse.cpp (parse_rcs_admin): Allow 'symbol<space>:<space>revnum'
as recently added to the python modules.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1062 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 15:00:26 +00:00
dionisos
a9f8e7a802 * tparse/tparse.h: Fix 2 warnings revealed by gcc -Wall.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1061 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 13:58:06 +00:00
dionisos
55889fd691 Exception usage cleanup. Use exceptions to terminate the parser in all cases.
Also protect pointers with auto_ptr to ensure cleanup.

Note: Before this change exceptions *could* occur, but all pointer-referenced
memory would be leaked.

* tparse/tparse.h: Change #include-s to C++ names.
  (RCSParseError):  Change to be a public descendant of exception. Use
  string datatype to ensure automatic cleanup. Implement a destructor
  as required by exception.
  (RCSExpected):  Use string datatype to ensure automatic cleanup. Add
  constructor for expected characters.
  (Branche): Removed.  Replaced with std::list<>.
  (Sink): Change method definition to reflect switch to exceptions.
  (TokenParser::match):  Add method for matching characters.
  (TokenParser::semicol, TokenParser::matchsemicol): Removed.
  Obsolete because we're now able to match single characters.
  (tparseParser):  Change method definition to reflect the switch
  to exceptions.
  (tparseParser::parse):  Adapt to changed method definitions.

* tparse/tparse.cpp: Change #include-s to C++ names.
  (TokenParser::get): Space changes and conversion to auto_ptr.
  (tparseParser::parse_rcs_admin,
   tparseParser::parse_rcs_description,
   tparseParser::parse_rcs_deltatext): Conversion to auto_ptr and exceptions.
  (tparseParser::parse_rcs_tree): Conversion to auto_ptr and exceptions. Also
  adjust for removal of Branche class.

* tparse/tparsemodule.h:  Include Python.h, since
  we,re actually using python types.

* tparse/tparsemodule.cpp (pyobject, pystring):
  New classes.  Used to anchor python objects ensuring their refcounts
  are decremented.
  (chkpy):  New.  Function to check python return value and act appropriately.
  (initparse):  Correctly anchor python strings.
  (rcstoken_to_pystring):  Removed.  Now integrated into the pystring class.
  (PythonSink):  Claim ownership for the duration of the instance lifetime.
  Also adjust all methods for the switch to exceptions.
  (tparse):  Adapt to the switch to exceptions.  Also prevent memory leakage
  when an exception occurs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1060 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 13:56:23 +00:00
dionisos
cab7c9ae04 Fix problems parsing files with 0 (nul) characters in them (typically
binary files).

At the same time reduce processing time by ~50% (in my measurements).


* tparse/tparse.h: Remove deprecated (and now unused) strstream header.
  (rcstoken): New class. Used to hold parser output.
  (Branche, Sink, TokenParser): Use rcstoken class whereever char* was
  used for holding parser output.

* tparse/tparse.cpp (rcstoken::init, rcstoken::append,
  rcstoken::grow,rcstoken::copy_begin_end, rcstoken::copy_begin_len): New.
  (TokenParser::get): Change return type to rcstoken and adapt accordingly.
  (TokenParser::unget): Change argument type.
  (tparseParser::parse_rcs_admin,tparseParser::parse_rcs_tree,
   tparseParser::parse_rcs_description,
   tparseParser::parse_rcs_deltatext): Adjust to use rcstoken class.

* tparse/tparsemodule.cpp (rcstoken_to_pystring): New. Helper function
  to do token to python string transformation.
  (PythonSink): Adjust all methods to use the rcstoken class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1059 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-30 19:09:19 +00:00
dionisos
700b9eb7ad Use 'const char *' type for exception arguments.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1058 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-30 13:23:42 +00:00
dionisos
4038b9fe96 Eliminate compile warning.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1057 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-30 12:06:31 +00:00
cmpilato
543de7e0f7 Fix Bug #1181208.
* lib/viewcvs.py
  (raw_diff): Rootpath only shows up in Subversion diffs, not CVS.  So
    look for headers in a slightly less demanding way, replacing the
    rootpath if it appears, but certainly not caching the whole diff
    in memory if it doesn't.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1056 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-18 23:35:37 +00:00
cmpilato
c6cef2c309 Remove this patch. mailer.py (in Subversion /trunk) can now do ViewCVS diff
URLs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1055 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-15 16:03:22 +00:00
cmpilato
7e563d0746 Minor code cleanups.
* lib/viewcvs.py
  (view_diff): Little comment fix.

* lib/vclib/svn_ra/__init__.py
  (ChangedPath): Remove; use the one from vclib.svn.

* lib/ezt.py
  Update to latest upstream version, but reapply "the LongType fix".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1054 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-12 17:00:56 +00:00
cmpilato
2ab8c50dd7 Lose some duplicated code.
* lib/vclib/svn_ra/__init__.py
  (_datestr_to_date): Remove, and pull in the one from vclib.svn instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1053 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-12 02:43:34 +00:00
cmpilato
949c6a196d Some fixes to the 'diff' view.
While this would appear to fix the problems Aaron Craven
<viewcvs@vickerscraven.net> has been seeing with respect to HTML
escaping levels of diff output, this is a fluke.  A real problem (not
addressed here) is that raw_diff() is that basically, any time
raw_diff() is called with 'parseheader' set, it is treating the whole
diff output as headers (the early outs aren't firing).  This is
broken, and rather defeats the point of attempting streamy diffs since
we're collecting the whole thing into an array in memory.

* lib/viewcvs.py
  (raw_diff): Don't forget to htmlize() headers if so requested.
  (view_diff): Use 'unidiff' as the diff format choice if asked to
    make a patch for 'side-by-side' mode.  'Unidiff' and 'context
    diff' are the only valid patch formats, as far as we are
    concerned.  Also, fix a little comment typo.  Finally, revert my
    previous change, where I added an extra MarkupPipeWrapper around
    the file object returned from raw_diff() -- this was bogus, as
    raw_diff() should have been htmlifying stuff anyway.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1052 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-12 01:37:28 +00:00
cmpilato
5fb004046a Fix a bug which caused context and unidiff output to not be properly
htmlize()'d.  Reported (with patience, thankfully) by Aaron Craven
<viewcvs@vickerscraven.net>

* lib/viewcvs.py
  (view_diff): Wrap the raw diff FP object with an htmlize()ing class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1051 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-11 04:57:37 +00:00
cmpilato
4bfb7f1354 Rename Repository.filelog() to Repository.itemlog() (Subversion
supports logs on directories, too, ya know).  And make some other
little documentation changes.

* viewcvs/lib/vclib/__init__.py
  (Repository.itemlog): Was Repository.filelog().
  (Revision.__init__): Document the input parameters.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository.itemlog): Was BinCVSRepository.filelog().

* viewcvs/lib/vclib/ccvs/__init__.py
  (CCVSRepository.itemlog): Was CCVSRepository.filelog().

* viewcvs/lib/vclib/svn/__init__.py
  (SubversionRepository.itemlog): Was SubversionRepository.filelog().

* viewcvs/lib/vclib/svn_ra/__init__.py
  (SubversionRepository.itemlog): Was SubversionRepository.filelog().

* viewcvs/lib/viewcvs.py
  (view_markup, view_log): Update calls to Repository.itemlog() (from
    Repository.filelog()).

* viewcvs/lib/cvsdb.py
  (GetCommitListFromRCSFile): Update calls to Repository.itemlog()
    (from Repository.filelog()).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1050 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-08 22:57:02 +00:00
cmpilato
0738697d61 Fix an annotate bug reported by Amy Langenhorst <Amy.Langenhorst@noaa.gov>.
* lib/blame.py
  (CVSParser.is_branch): Tighten up regular expression with '^'/'$'.
    Revisions like "11.0.2.2.0.1" were matching not with groups
    "11.0.2.2" and "1", but with "11" and "2.2.0.1".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1049 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-08 22:55:58 +00:00
cmpilato
f7e15a4b8e * lib/viewcvs.py
(view_log): Fix a bug where use of the diff form via branch
    selection resulted in a log view instead of a diff view.  Reported
    by Amy Langenhorst <arl@noaa.gov>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1048 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-04 19:02:23 +00:00
cmpilato
874e0be23b Sorta kinda revert my changes from Feb. 1 2005, wherein I stopped
grouping directories in the directory view.  Now, make that behavior
optional (though, the default), but also fix it so that the directory
group itself is internally sorted by the current sort key.  This more
accurately mimics the likes of the Windows Explorer.

* viewcvs/viewcvs.conf.dist
  (sort_group_dirs): New option.

* viewcvs/lib/config.py
  (Config.set_defaults): Set default value for sort_group_dirs.

* viewcvs/lib/viewcvs.py
  (file_sort_cmp): If grouping directories, sorts dirs higher than
    files.  Otherwise, use normal sorting rules.

* viewcvs/website/upgrading.html
  Note the new option.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1047 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-03-07 15:13:23 +00:00
cmpilato
bbd4c762cb * templates/docroot/images/broken.png
* templates/docroot/images/cvsgraph_16x16.png
* templates/docroot/images/cvsgraph_32x32.png
  More PNG background fixes from Jordan Russell <jr-list-2005@quo.to>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1046 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-03-01 20:25:52 +00:00
cmpilato
b1d10a7f96 Jordan Russell <jr-list-2005@quo.to> was kind enough to rework some of
PNG files to have white backgrounds so that wussie browsers that don't
support PNG transparency (like Internet Explorer) can deal with them.

* templates/docroot/images/back_small.png
* templates/docroot/images/logo.png
* templates/docroot/images/text.png
  Tweaked.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1045 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-28 15:54:15 +00:00
cmpilato
6355639d08 Provide the Subversion youngest revision, and a link to it, to the
directory view.  This is pretty common request, the most recent by
Sergio Rua <srua@plus.net>.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (get_youngest_revision): New.

* viewcvs/lib/vclib/svn/__init__.py
  (get_youngest_revision): New.

* viewcvs/lib/viewcvs.py
  (view_directory): Re-organize some data dictionary stuffing (I
    really wish that *all* data dictionary parameters were initialized
    at the head of each view function so we can see a canonical list
    of those params, but maybe another day...).  Also, for 'svn'
    roottypes, populate a new 'youngest_rev' and 'youngest_rev_href'
    dictionary items.

* viewcvs/website/upgrading.html
  Document the new 'youngest_rev' and 'youngest_rev_href' template keys.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1044 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-28 15:40:08 +00:00
cmpilato
ad0bc5c421 * viewcvs/templates/markup.ezt
This template was on crack.  The absence of a revision log was
  enough to turn of the display of almost all of the other interesting
  data, and turn on the display of data that was in one half redundant,
  and in the other half non-existant.  Good Lord...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1043 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-25 15:59:20 +00:00
cmpilato
329a9edab4 * viewcvs/lib/viewcvs.py
(enscript_extensions): Add '.cs', '.bas', and '.cls' extensions,
    mapping to 'csharp', 'vba', and 'vba', respectivelyly, at the
    request of Bo Berglund <bo.berglund@telia.com> and Hern��n Mart��nez
    Foffani <hernan@orgmf.com.ar>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1042 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-22 15:09:09 +00:00
dionisos
81aaaab615 * tparse/tparse.cpp (parse_rcs_tree): Don't special case non-special case.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1041 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-20 13:15:25 +00:00
dionisos
ec41758e2e Stop passing ownership of parameters into the sink.
* tparse/tparsemodule.cpp: Stop freeing parameters passed into the sink.

* tparse/tparse.cpp: Dispose of allocated memory after use.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1040 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-20 13:03:02 +00:00
dionisos
0acab473b2 Add .cvsignore file to ignore 'build/' output directory.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1039 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-20 12:36:53 +00:00
cmpilato
f723597546 Now that Subversion's RA layer has a pleasant API (instead of a nasty
vtable structure), update the ViewCVS 'svn_ra' module to use it.  This
module now almost has total functional parity with the 'svn' module.

* viewcvs/lib/vclib/svn_ra/__init__.py
  Import the svn.ra module.
  (date_from_rev, created_rev): Actually flesh out these functions
    using the new RA capabilities.
  (LastHistoryCollector.add_history): Remove leading slashes from
    paths used to make ChangedPath items.
  (either_binary): Leave a TODO, with some optimization ideas.
  (SubversionRepository.__init__): Use the RA interface to fetch the
    youngest revision instead of a really kludgy (and more expensive)
    algorithm based on dirents.
  (FileDiff.get_files, SubversionRepository.openfile): Fixup the use
    of streams.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1038 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-17 19:01:46 +00:00
rey4
66cdbe31e7 Support relative images and links in checked out HTML pages when
checkout_magic is disabled by changing the default view for file URLs from
"log" to "checkout"

This causes some URL compatibility to be lost when checkout_magic is disabled.
Bookmarks which pointed to log pages but don't have explicit view=log
parameters will point to checkout pages instead.

* lib/viewcvs.py
  (Request.run_viewcvs):
    change default view for files from "log" to "checkout" when checkout_magic
    is disabled

  (Request.get_link):
    don't add explicit view=checkout parameters for checkout links when
    checkout_magic is disabled

    don't drop explicit view=log parameters for log links

* website/upgrading.html
    add note about URL compatibility

* INSTALL
    update section on access control

* viewcvs.conf.dist
    update documentation for "root_as_url_component" and "checkout_magic"

    move "checkout_magic" option directly underneath "root_as_url" component
    because the two options are related


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1037 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-13 16:48:12 +00:00
rey4
6b9207ab39 Add title attributes to directory links
* lib/viewcvs.py
  (view_directory):
    add new row.viewable attribute so it is possible to tell whether a file
    link goes to a checkout or markup page

* templates/directory.ezt:
    add title attributes


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1036 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-13 16:46:56 +00:00
maxb
08cf03dbd3 tparse: A few of the smaller changes from Erik's patch, slightly extended by me.
* tparse/tparse.h (tparseParser::tparseParser, tparseParser::parse):
    Split the actual parsing out of the constructor, into a parse() function.
* tparse/tparsemodule.cpp (PythonException): Move earlier in the file.
  (tparse): Call tparseParser::parse(). Do not INCREF and then DECREF the
    parameters - our caller must by definition be holding a reference in order
    to pass the objects in, and we are finished with them before we return.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1035 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-12 13:13:25 +00:00
maxb
b7482f30f5 tparse: A few cleanups. Some whitespace adjustments extracted from Erik's
big std::string-izing patch, and also toss some code I noticed was unused.

* tparse/tparse.cpp
  (Whitespace, Token_term, TokenParser::unget, tparseParser::parse_rcs_tree):
    Whitespace adjustments.
* tparse/tparsemodule.cpp (tparse): Whitespace adjustments.

* tparse/tparse.h (RCSParseError.getvalue, RCSExpected.getvalue):
    Remove some unused code, which includes one use case of the deprecated
    ostrstream class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1034 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-12 01:50:11 +00:00
maxb
af6dbf5ecd tparse: Enable compilation on gcc 3.x, sacrificing compatibility with gcc 2.x.
* tparse/tparse.h: #include <strstream>, not <strstream.h>,
    and add "using namespace std;".

* tparse/tparsemodule.cpp: Do not #include <stdiostream.h>.
  If a version of GNU C++ with the stdio_filebuf extension to the STL is
  detected, then use it to allow the passing of a filehandle from Python
  to the parser. Otherwise, throw a NotImplementedError when a filehandle
  is passed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1033 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-11 23:53:52 +00:00
cmpilato
fd5acb4930 * viewcvs/lib/viewcvs.py
(enscript_extensions): Add '.f90' as an extension mapping to
    'fortran'.  Suggestion by Ed Zaron <ezaron@coas.oregonstate.edu>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1032 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-10 23:37:11 +00:00
cmpilato
5020756254 Add notation about the new 'template_dir' directive.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1031 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-08 16:58:47 +00:00
cmpilato
da38c84d9c Move the [options] section up to just below the [general] stuffs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1030 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-08 02:48:14 +00:00
cmpilato
50508ebcc7 In short, facilitate the creation, testing, installation, and sharing
of "template sets."

I'm introducing a new configuration variable ('template_dir') which is
the parent directory of all ViewCVS templates.  Those templates have
names which match the views they describe (directory.ezt,
revision.ezt, graph.ezt, etc.).  The 'docroot' variable will now
default to "<template_dir>/docroot".  Finally, the [templates] section
will continue to work as before, save that all configuration therein
(and templates not configured will fallback to
"<template_dir>/<view_name>.ezt").

The beauty of this is that folks can start whipping up (and
maintaining themselves) ViewCVS template sets which can be traded and
shared, like themes for Mozilla or Windows XP.  EZT is super-powerful,
and there are some really fun things you can do with it to serve up
interesting and unique ViewCVS views.  But while we want to encourage
creativity and innovation, we don't want the ViewCVS project itself
having to maintain everyone's fun little themes.  Anyway, so now
installing a new template set is just a matter of dropping that set
directory somewhere (anywhere, really) on your system and pointing
'template_dir' to that directory tree.  No (very annoying) template
modification conflicts to deal with every time you update ViewCVS on
your system.

And the best part is that existing ViewCVS configurations should all
continue to work compatibly.

* viewcvs/viewcvs.conf.dist
  Add a new option, "template_dir".  Tweak documentation on the
  "docroot" option.  And make the whole [templates] section work a
  little differently.

* viewcvs/lib/config.py
  (Config.set_defaults): Use 'None' as the default value for the
    self.templates.directory, self.templates.log,
    self.templates.query, self.templates.diff, self.templates.graph,
    self.templates.annotate, self.templates.markup,
    self.templates.error, self.templates.query_form,
    self.templates.query_results, and self.templates.roots options.
    Add a new default value for self.options.template_dir.

* viewcvs/lib/viewcvs.py
  (get_view_template): New.
  (generate_page): Instead of taking a template name, take a view
    name.  Also, call get_view_template() to generate the full
    template path.
  (view_markup, view_roots, view_directory, view_log, view_annotate,
    view_cvsgraph, view_diff, view_revision_svn, view_queryform,
    view_queryform, view_error): Update calls to generate_page().

* viewcvs/lib/query.py
  (main): Use viewcvs.get_view_template().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1029 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-08 02:46:20 +00:00
rey4
12d47495c3 Reorganize URL handling functions for clarity and to make it
easier to change the default view.

* lib/viewcvs.py
  (Request.run_viewcvs):
    move code that handles the magic markup mimetype.

    remove unneccessary special case code for log pages with revisions
    selected for diffs

  (Request.get_link):
    consolidate code that determines whether to skip sticky variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1028 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-06 19:55:49 +00:00
rey4
0b989145a7 Minor updates to documentation.
* INSTALL
    update cvsgraph revision number and cgi directory path

* CHANGES
    mention "root_as_url_component" and fix the way a date is formatted

* website/upgrading.html
    fix stutter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1027 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-06 19:53:17 +00:00
rey4
605109cbfd Fix page title for repository listing page
* templates/include/header.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1026 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-06 19:49:30 +00:00
cmpilato
83af4b6b3d Move the magical 'Repository Listing' option to the top of the option set.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1025 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-05 16:52:12 +00:00
rey4
86a7feb403 Add unobtrusive link to repository listing view on the common page
headers.

* templates/include/header.ezt
    add "Repository Listing" option to the roots select box

* lib/viewcvs.py
  (Request.run_viewcvs):
    handle magic "roots" value submitted by the roots select box

  (common_template_data):
    add "view" template parameter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1024 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:33:20 +00:00
rey4
56e7993f12 Add repository listing view. This change doesn't any links to the new
view because I'm not really sure where they would fit best in the UI.
So for now, the view is only visible when viewcvs.cgi is loaded
with no trailing path in the URL and either root_as_url mode is
enabled or default_root is not set.

* lib/viewcvs.py
  (Request.run_viewcvs, Request.get_link, nav_path, common_template_data,
   _views):
    add support for new view

  (view_roots):
    new function

* lib/config.py
  (Config.set_defaults):
    set default templates.roots option

* templates/roots.ezt
    new template

* viewcvs.conf.dist
  (templates/roots):
    new option

  (general/default_root, options/root_as_url_component):
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1023 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:32:32 +00:00
rey4
5d572bef92 Remove duplicate code
* lib/viewcvs.py
  (nav_header_data):
    get rid of duplicate template assignments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1022 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:29:09 +00:00
rey4
21f89e87d5 Get revision numbers to display on annotate pages when viewing HEAD.
* lib/blame.py
  (BlameSource.__init__):
    set "revision" member to revision being annotated

* lib/viewcvs.py
  (view_annotate):
    use "revision" member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1021 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:28:22 +00:00
rey4
37a8e3ee3c Document removed template variables
* website/upgrading.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1020 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:26:54 +00:00
rey4
d9fd8ee727 Replace dodgy os.dup calls with calls to os.dup2
* standalone.py
  (ViewCVS_Handler.run_viewcvs):
    don't duplicate file descriptors inside an assert, asserts shouldn't
    be used to handle runtime errors, only to detect logic errors, and
    anyway, the code needs to run with asserts disabled

    call dup2() instead of dup() to explicitly set the standard out,
    instead of just hoping that the standard out is the first available
    descriptor


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1019 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:08:59 +00:00
rey4
4504b5fc3d Make redirects work better with the standalone server
* lib/sapi.py
  (CgiServer.redirect):
    use addheader() method instead of printing headers literally


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1018 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:07:16 +00:00
rey4
72dbcf1fb7 Fix bug in copy_stream which broke docroot requests with the standalone
server on linux.

* lib/viewcvs.py
  (copy_stream):
    when copying to the sys.stdout, make sure to use the current
    sys.stdout file object instead of the file object cached by
    python as a default argument


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1017 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:05:40 +00:00
rey4
33e9c1db0c Make the blame module use get_url links
* lib/viewcvs.py
  (sticky_vars):
    removed

  (view_annotate):
    pass partial get_url links to blame module

* lib/blame.py
  (link_includes, BlameSource.__init__, BlameSource.__getitem__):
    use get_url links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1016 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:04:03 +00:00
rey4
d0029c46d3 Add revision links to annotate view
* lib/viewcvs.py
  (view_markup, nav_header_data)
    move "view_href," "download_href," "annotate_href" assignments
    into nav_header_data

* templates/annotate.ezt
    add revision links here


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1015 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:03:19 +00:00
rey4
dc76b574a9 Clean up path handling in viewcvs views, eliminate unused template variables.
* lib/viewcvs.py
  (_path_join):
    new function

  (Request.run_viewcvs, nav_path, common_template_data, view_markup,
   view_log, view_cvsgraph, generate_tarball, view_query):
    use _path_join

  (nav_header_data):
    remove unused variables

* templates/graph.ezt
    don't use "path" variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1014 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 12:58:14 +00:00
cmpilato
4d1a7b09b3 Fix tarball generation bug noticed by Nicolas Benoit <nbenoit@tuxfamily.org>.
* viewcvs/lib/viewcvs.py
  (generate_tarball): rep_top is a list, so stop testing it against strings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1013 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-02 15:07:29 +00:00
cmpilato
e58df06c55 * viewcvs/lib/vclib/svn/__init__.py
(_sigterm_handler): Make self available for compatibility with older
    Python versions.  (Thanks for catching this, Greg Stein.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1012 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-02 15:02:55 +00:00
cmpilato
5ad97c13bb Ensure that Subversion repositories get a clean disconnect when
SIGTERM is sent to the process by registering a handler for that
signal which gracefully shuts down APR.

* viewcvs/lib/vclib/svn/__init__.py
  (SubversionRepository.__init__): Register a handler for SIGTERM that
    cleanly closes up shop.
  (SubversionRepository._close): New (with code copied and modified
    from __del__).
  (SubversionRepository.__del__): Cored out (see _close).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1011 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-01 20:37:00 +00:00
cmpilato
b5cf642f0e * viewcvs/lib/viewcvs.py
(file_sort_cmp): Only treat directories as special when sorting by name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1010 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-01 16:40:15 +00:00
cmpilato
f85b7bb67e * viewcvs/lib/popen.py
(popen): Removed commented-out code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1009 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-31 21:14:04 +00:00
cmpilato
e8fa0f0186 * viewcvs/lib/debug.py
(PrintStackTrace): Remove unused function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1008 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-31 21:12:13 +00:00
cmpilato
27c4c62394 * viewcvs/lib/viewcvs.py
(_sticky_vars): Remove 'dir_pagestart' and 'log_pagestart' from the
    set of sticky parameters.  I simply can't see any utility in
    keeping those things around, as they muck up more URLs than they help.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1007 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-29 03:55:24 +00:00
rey4
ff5aa6d251 Fix handling of "tarball" parameter (for backwards compatibility
with ViewCVS 0.9.2

* lib/viewcvs.py
  (Request.run_viewcvs)
    look for tarball parameter on directory paths, not file paths
----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1006 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 19:35:14 +00:00
rey4
83d2817867 Fix subversion markup view
* lib/viewcvs.py
  (view_markup):
    set annotate_href value

----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1005 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 06:38:20 +00:00
rey4
c9ca3313c6 Remove "auto" view replacing auto links with direct checkout or
markup links.

* lib/viewcvs.py
  (is_viewable):
    new function

  (view_auto):
    removed

  (view_directory, view_cvsgraph, build_commit):
    change auto links into direct links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1004 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 06:08:08 +00:00
rey4
99818c7cf0 Add a bunch of links between different views. Some of these links
were present in ViewCVS 0.9.2, but seem to have been inadvertently
removed since then.

* lib/viewcvs.py
  (common_template_data):
    set "up_href, "log_href," and "graph_href" template variables
    for files

  (view_markup):
    set "annotate_href"

  (view_directory):
    stop setting "up_href" here

  (view_log):
    stop setting "graph_href" and "back_url" here
    set "annotate_href" here

  (view_queryform):
    set "dir_href" here

* templates/annotate.ezt
* templates/diff.ezt
* templates/graph.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/markup.ezt
* templates/query_form.ezt
* templates/include/branch.ezt
    add links

* website/upgrading.html
    document changed variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1003 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 05:20:46 +00:00
cmpilato
ee9b309d4c Answer a FAQ about Subversion bindings.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1002 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 04:54:50 +00:00
rey4
0b8521ef61 Add viewcvs logo to the page across from the title.
* templates/include/header.ezt
    look at it go...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1001 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 03:47:20 +00:00
rey4
c0110cacae Simplify page titles. Someone was getting a little - too crazy - with -
the: punctuation ;)

* templates/annotate.ezt
* templates/diff.ezt
* templates/graph.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/markup.ezt
* templates/query.ezt
* templates/query_form.ezt
* templates/query_results.ezt
* templates/revision.ezt
* templates/include/dir_header.ezt
* templates/include/header.ezt
  change titles

* lib/config.py
  (Config.set_defaults):
    remove "main_title" option

* viewcvs.dist.conf
    remove "main_title" option

* website/upgrading.html
    document removal of "main_title" option


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1000 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 03:40:55 +00:00
rey4
cbac6b920c Fix infinite redirect problem for tarball download links, and remove
trailing slashes on revision view links.

* lib/viewcvs.py
  (Request.run_viewcvs):
    don't require trailing slashes on tarball download or revision
    view URLs

  (Request.get_link):
    remove trailing slashes on revision view links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@999 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 19:04:13 +00:00
rey4
aedd660e9a Fix infinite redirect problem for revision URLs.
C. Michael Pilato <cmpilato@collab.net> first reported this bug
on the dev list.

* lib/viewcvs.py
  (Request.get_link):
    add trailing slashes on revision view links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@998 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 18:31:10 +00:00
cmpilato
d34e4f0594 * viewcvs/lib/viewcvs.py
(nav_path): Escape the root name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@997 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 18:11:57 +00:00
cmpilato
9fdb38c5e5 * viewcvs/lib/viewcvs.py
(Request.run_viewcvs): If there is no rootname, set a default one so
    that further attempts to use it don't choke.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@996 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 17:37:59 +00:00
rey4
fdb5ced659 Templatize the clickable path in header.ezt.
* lib/viewcvs.py
  (clickable_path, _dir_url):
    removed

  (nav_path):
    new function, replaces clickable_path

  (common_template_data):
    set "nav_path" template variable with nav_path() instead of
    clickable_path()

  (view_directory, view_log, view_queryform, view_query):
    don't override 'nav_path' variable

* templates/include/header.ezt
    use changed 'nav_path' variable

* website/upgrading.html
    document changed 'nav_path' variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@995 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 17:30:45 +00:00
rey4
3d3554b07e Remove extra clickable paths from directory and markup pages.
* lib/viewcvs.py
  (view_markup):
    don't set 'nav_file' template variable

* templates/markup.ezt
    remove the clickable path right before the revision information

* templates/include/dir_header.ezt
    remove clickable path in "Current Directory" row of summary table

* website/upgrading.html
    add documentation on 'nav_file' template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@994 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 16:55:48 +00:00
rey4
df3d83f843 Fix bug that prevented magic checkout URLs from working.
* lib/viewcvs.py
  (Request.run_viewcvs):
    fix use of nonexistent variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@993 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 16:17:53 +00:00
rey4
35c9d578f7 Add a promiment link to the log page on the markup page. ViewCVS 0.9.2
had one, but it got lost in the sauce.

* templates/markup.ezt
    add (log) link right before (download) and (as text) links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@992 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 16:14:12 +00:00
rey4
8a6ffa0257 Fix a bug in redirection logic
* lib/viewcvs.py
  (Request.run_viewcvs):
    add trailing slash to all directory paths, not just paths
    for directory listing pages


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@991 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 07:20:33 +00:00
rey4
77e0fd633a Add "Parent Directory" link in directory listings
* templates/directory.ezt
* templates/dir_alternate.ezt
    add "Parent Directory" rows

* lib/viewcvs.py
  (view_directory):
    set "up_href" template value

* website/upgrading.html
    document "up_href" variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@990 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 05:57:01 +00:00
rey4
7e897b10df Fix UnmatchedEndError in dir_alternate template.
* templates/dir_alternate.ezt
    remove unmatched [end]


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@989 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 05:38:13 +00:00
rey4
5c42382511 Redirect on irregular URLs so it is easier to limit viewing parts of
the repository in apache based on the URL.

Thanks to Jonathan <voigtjr@gmail.com> for bringing this issue to my
attention on the users' list.

* lib/viewcvs.py
  (Request.run_viewcvs):
    add redirects for weird urls

  (view_directory):
    don't redirect here when there's no trailing slash; it's taken
    care of in run_viewcvs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@988 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 02:16:09 +00:00
rey4
0b7be07a67 Fix cvs log view
* lib/viewcvs.py
  (view_log):
    set default value for entry.copy_path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@987 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 01:34:20 +00:00
cmpilato
c15cc3bb33 * viewcvs/lib/debug.py
(PrintException): Escape the error message so it doesn't goof up
    HTML display.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs, _validate_param): Don't escape params in
    strings of raised exceptions, as that's the exception-handling
    code's job.
  (nav_header_data, common_template_data, clickable_path, view_log,
    view_directory): Escape template data that needs escapin'.
  (view_markup): Use un-escaped filename instead of the one in the
    data dictionary.
  (view_checkout): Re-org a little bit so that fp is always explicitly
    closed.
  (copy_stream): Instead of defaulting the output stream to None, and
    letting None mean "gimme sys.stdout", just make the default output
    sys.stdout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@986 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:40:09 +00:00
cmpilato
167311b79b * viewcvs/lib/viewcvs.py
(view_doc): Refer to "static files" instead of "help files", and to
    try to get all the exceptionful states to occur before we fire up
    the output process.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@985 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:38:47 +00:00
cmpilato
39d2eedd10 Fix Bugs item #1090934, reported by ahndee.
* lib/viewcvs.py
  (view_revision_svn): Convert 'text_mods' and 'prop_mods' members of
    each changed path item into EZT booleans.

* templates/revision.ezt
  Use if-any tests, instead of comparisons with "1", to determine if
  each changed path item has text or property mods.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@984 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:27:27 +00:00
cmpilato
38dc2d2521 * viewcvs-install
Add support for DESTDIR installs, and support for --prefix and
  --destdir command-line arguments (which override the defaults and
  prevent prompts from appearing).  DESTDIR install stuff from a
  patch by Olaf Hering <olh@suse.de>, command-line arg stuff by me.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@983 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:10:47 +00:00
rey4
ce2a896be2 Fix loginfo crashes on "cvs import" and "cvs add <directory>". Thanks to John
Beranek <john@redux.org.uk> for reporting the bug on the users' list.

* tools/loginfo-handler
  (HeuristicArgParse, CvsNtArgParse):
    fix return values


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@982 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-10 02:43:07 +00:00
rey4
1c703900bb Generate CvsGraph image map links with get_url function just like other
links instead of cobbling them together in cvsgraph.conf. This way
cvsgraph.conf doesn't have to change if we add new url schemes and we can
handle sticky variables and root parameters without special case code.

* lib/viewcvs.py
  (Request.get_url):
    accept new "partial" argument to append trailing ? or & to generated
    url

  (view_cvsgraph):
    pass get_url generated links to cvsgraph instead of url fragments

* cvsgraph.conf.dist
    use the new links passed by ViewCVS


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@981 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-10 02:09:46 +00:00
rey4
b6a4e521be Remove apache logo from default templates
* templates/include/footer.ezt
    Powered by... nothing :'(


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@980 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-06 01:45:59 +00:00
rey4
518573a350 Minor cleanups.
* lib/vclib/bincvs/__init__.py
  (_log_path):
    remove initialization of unused variable

  (_check_path):
    distinguish error messages that come from os.stat()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@979 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-04 01:57:13 +00:00
rey4
2529196782 Improve error messages in directory view for inaccessible CVS files.
* lib/vclib/__init__.py
  (DirEntry.__init__):
    set "errors" member instead of "verboten"

* lib/vclib/bincvs/__init__.py
  (CVSRepository.listdir):
    don't skip "Attic" and "CVS" entries if we're not sure if they are
    directories

    don't skip entries in Attic/ when we can't tell if they are files or
    directories

  (CVSDirEntry.__init__):
    use "errors" argument instead of "verboten"

  (_get_logs):
    don't set "DirEntry.log_errors" member, use "errors"

  (_log_path):
    don't return file access errors here, they are returned by _check_path

  (_check_path):
    return error strings on file access errors instead of simple booleans

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs):
    don't set "DirEntry.log_errors" member, use "errors"

* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
  (get_logs):
    don't set "DirEntry.log_errors" member

* lib/viewcvs.py
  (view_directory):
    use "DirEntry.errors" member instead of "log_errors"

  (generate_tarball):
    use "DirEntry.errors" member instead of "verboten"

* tools/cvsdbadmin
  (RecurseUpdate):
    use "DirEntry.errors" member instead of "verboten"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@978 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-03 20:44:56 +00:00
rey4
dd140d8f59 Merge in changes from cvsgraph.conf in CvsGraph 1.5.1
* cvsgraph.conf.dist
    update

* lib/viewcvs.py
  (view_cvsgraph):
    pass query string as %8 custom parameter instead of %6


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@977 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-02 22:51:48 +00:00
cmpilato
356642e4b6 Error template fixes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@976 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-11-19 06:38:39 +00:00
cmpilato
cbf330498f Drop a TODO for later processing.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@975 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-11-19 06:37:39 +00:00
rey4
0986d26a6a Update enscript link
* website/index.html
    link to enscript home page instead of gnu.org entry


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@974 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 22:12:03 +00:00
rey4
496719d672 Tone down normalization of the script name. We just need to trim its
leading slashes, not put it through some hocus-pocus purification
ritual.

* lib/viewcvs.py
  (_normalize_path):
    just trim leading slashes


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@973 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 22:12:01 +00:00
cmpilato
bb591ca897 Remove some italics.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@972 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 05:19:53 +00:00
cmpilato
8164d4fd3f Fix Bug #983511 by normalizing the SCRIPT_NAME.
* lib/viewcvs.py
  (_normalize_path): New.
  (Request.__init__): Run _normalize_path() on self.script_name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@971 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 05:19:52 +00:00
cmpilato
3ee18bdb13 (_get_logs): Fix a bug in determining imperfect-but-wanted entries.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@970 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 04:45:36 +00:00
cmpilato
514f573a6a Space text chunks a little more naturally.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@969 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-28 15:27:53 +00:00
cmpilato
b404bc2719 Website content edits.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@968 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-28 03:34:37 +00:00
cmpilato
c7e1eeb97d * tools/make-release
Fix the CVS root used, and remove the website before tarrin' up.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@967 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 06:36:30 +00:00
cmpilato
aa7d64fb28 Add the PhotoShop file I used to create the title image. Note that the cloud
photo is a public domain image taken from:
  http://pdphoto.org/PictureDetail.php?mat=pdef&pg=5173


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@966 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 06:32:39 +00:00
cmpilato
98046b15f5 Hope I'm not stepping on any toes here, but I couldn't bear the site
of the ViewCVS web pages any longer.  This begins a journey of
organization and updating that has been long past due.  And hey, if
folks hate it -- it's under version control.

* website/contact.html
* website/download.html
* website/images/bg-grad.jpg
* website/images/title.jpg
* website/styles.css
  New files.

* website/contributing.html
* website/index.html
* website/license-1.html
* website/upgrading.html
* website/who.html
  Heavily modified files.

* website/images/chalk.jpg
* website/images/logo.png
  Removed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@965 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 06:22:13 +00:00
cmpilato
1a76505beb Minor docco fix. Patch by Juanma Barranquero <lektu@mi.madritel.es>.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@964 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 02:09:09 +00:00
cmpilato
e3abe288f6 Update mailing list information.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@963 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-25 17:46:27 +00:00
cmpilato
b26f6c0e09 * viewcvs/lib/viewcvs.py
(view_log): Only show download hrefs for files, and make view hrefs
    for directories show the directory view.

* viewcvs/templates/include/branch.ezt
  Only display the view_href if it exists.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@962 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-20 16:27:04 +00:00
cmpilato
0540dd9c0a * lib/viewcvs.py
(view_log): Always expose the view_href and download_href.

* templates/log.ezt
* templates/log_table.ezt
  Lose the "if CVS" condition I added for some includes a while ago.

* templates/include/branch.ezt
  Always show bookmarkable links to HEAD/download.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@961 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-19 14:46:35 +00:00
cmpilato
6fbdc57c44 Fix issue #1035766.
* lib/viewcvs.py
  (_re_rewrite_url): Look for the HTML-encoded version of ampersands
    in URLs ("&amp;").


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@960 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-18 16:39:26 +00:00
cmpilato
4884f8f5c6 Address issue #1049046.
* lib/viewcvs.py
  (_re_rewrite_email): Allow plus signs in email addresses.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@959 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-18 16:03:44 +00:00
rey4
68ebc10d44 Minor fix in svndbadmin
* tools/svndbadmin
  (usage):
    fix call to os.path.basename()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@958 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 03:08:04 +00:00
rey4
eaa2136cf6 Minor cleanups in loginfo script
* tools/loginfo-handler
  (HeuristicArgParse):
    fix spelling error in docstring

  (HeuristicArgParseDirectory, FindLongestDirectory)
    rename function

  (NextFile):
    fix return value

  (ProcessLoginfo):
    update inaccurate comment

  (module code):
    update inaccurate debug message


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@957 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 03:04:30 +00:00
rey4
325e79d4dc Minor cleanup in viewcvs module
* lib/viewcvs.py
  (view_query)
    shorten call to get_url


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@956 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:46:30 +00:00
rey4
5687f191f3 Minor cleanup in cvsdb module
* lib/cvsdb.py
  (Commit.SetBranch)
    shorten this code

  (CheckinDatabaseQuery.AddCommit, CheckinDatabaseQuery.SetCommitCB):
    remove unused callback functionality


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@955 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:40:10 +00:00
rey4
31410c3272 Minor cleanup in bincvs module
* lib/vclib/bincvs/__init__.py
  (_log_path)
    no need to deal with Attic paths here, they are filtered out in
    listdir


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@954 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:32:32 +00:00
rey4
173a8a7290 Get rid of rlog module, make CVSdb use bincvs instead.
* lib/rlog.py
    deleted

* lib/cvsdb.py
  (RLogDataToCommitList):
    removed

  (GetCommitListFromRCSFile):
    change to use vclib instead of rlog module

  (GetCommitListFromRCSFile, GetUnrecordedCommitList):
    update to accept vclib-style path_parts arguments

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.filelog):
    accept "cvs_pass_rev" option for passing -r arguments to rlog

  (_match_revs_tags):
    make this function work with an incomplete list of revisions
    instead of crashing. This is neccessary when an -r argument
    is passed to rlog.

  (_add_tag):
    make this function work when we need to create a tag with no
    revision object. We need this to create a HEAD tag when an -r
    argument is passed to rlog and we don't know what the HEAD
    revision is.

  (fetch_log):
    removed

* tools/cvsdbadmin
  (RebuildFile):
    removed, merged into UpdateFile

  (UpdateFile)
    accept new argument to reinsert all commits

  (RecurseRebuild):
    removed, merged into RecurseUpdate

  (RecurseUpdate):
    update to use vclib's listdir instead of os.listdir

  (CommandRebuild, CommandUpdate):
    removed, code moved into __main__ section

* tools/loginfo-handler
  (FileData, CommitFromFileData, GetUnrecordedCommitList):
    removed, these were just wrappers over the cvsdb interface

  (HeuristicArgParse, CvsNtArgParse)
    return tuples describing file data instead of file data objects

  (ProcessLoginfo):
    update to use cvsdb interface


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@953 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:23:23 +00:00
rey4
34b3f3e47a Fix file path issues in CVSdb on windows. Summary of changes:
- Stop converting directory and file paths to lower case with native
    slashes before storing them in the database. Instead store with
    preserved case and forward slashes.

  - Stop trying to clean up paths haphazardly all over the cvsdb module,
    instead expect paths to be normalized before they get passed to
    cvsdb.

* lib/cvsdb.py
  (Commit.SetRepository, Commit.SetDirectory, Commit.SetFile,
   CheckinDatabaseQuery.SetRepository,
   CheckinDatabaseQuery.SetDirectory):
    remove path cleanup code

  (RLogDataToCommitList)
    don't strip repository prefix because rlog module now does it

  (CleanRepository):
    new function

* lib/rlog.py
  (_get_co_file):
    change to return paths with forward slashes and without repository
    prefixes

  (GetRLogData):
    update call to _get_co_file

* tools/cvsdbadmin
  (UpdateFile, CommandUpdate, RebuildFile, CommandRebuild)
    remove calls to normcase here

  (module code):
    use CleanRepository function to clean up repository path

* tools/loginfo-handler
  (CleanDirectory):
    removed

  (HeuristicArgParse, CvsNtArgParse):
    don't call CleanDirectory or normcase here

  (HeuristicArgParseDirectory):
    remove stray print statement

  (module code):
    use cvsdb.CleanRepository function to clean up repository path

* tools/svndbadmin
  (module code):
    use cvsdb.CleanRepository function to clean up repository path

* lib/viewcvs.py
  (view_query):
    change to use forward slashes in directory names instead of native
    slashes

    use cvsdb.CleanRepository function to clean up repository paths

* lib/query.py
  (build_commit):
    change to handle forward slashes in directory paths instead of
    native slashes

  (run_query):
    use cvsdb.CleanRepository function to clean up repository path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@952 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 00:47:42 +00:00
rey4
0547748716 Remove site-specific kludge from cvsdb (originally added by Jay Painter for
RealNetworks repositories)

* lib/cvsdb.py
  (CheckinDatabase.CreateSQLQueryString):
    remove code that excludes ".ver" files from all queries


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@951 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 02:07:07 +00:00
rey4
1095284f7f Fix case-sensitive path comparison in bincvs that causes problems on
windows when lowercase drive letters are used in cvs paths in
viewcvs.conf.

* lib/vclib/bincvs/__init__.py
  (_paths_eq):
    new function for comparing paths that works on case-insensitive
    filesystems

  (BinCVSRepository.openfile, _get_logs):
    use new path comparison function

  (_parse_co_header, _parse_log_header):
    stop cleaning up returned filenames, it's no longer neccessary
    with new path comparison function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@950 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 02:00:34 +00:00
rey4
673b15f3aa Update windows README
* windows/README
  - add troubleshooting info for CreateProcess exception
  - consolidate information about old CVSNT bugs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@949 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 01:48:30 +00:00
rey4
fb0a3cb754 Remove workaround for really old CVSNT bug in loginfo-handler
* tools/loginfo-handler
  (BrokenCvsNtArgParse):
    remove

  (global scope)
    no longer accept "brokencvsnt" argument


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@948 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 01:44:53 +00:00
cmpilato
f570dd8bd6 Don't include the branch and view_tag templates for non-CVS log displays.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@947 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-13 18:19:14 +00:00
cmpilato
d417cc000b * viewcvs/lib/viewcvs.py
(view_log): Dictate the 'where' and 'pathtype' values to the
    URL-generating function when making download links.  Patch by
    Stefan Haller <haller@ableton.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@946 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-13 17:39:55 +00:00
rey4
fd665fd18e Swap sorting arrows in directory view following a discussion on the
dev list that ended at

http://mailman.lyra.org/pipermail/viewcvs-dev/2004-September/001769.html

* templates/docroot/images/ascending.png
* templates/docroot/images/descending.png
* templates/docroot/images/down.png
* templates/docroot/images/up.png
    rename ascending and descending images to down and up based on the
    direction of the arrows

* templates/directory.ezt
* templates/dir_alternate.ezt
    update to use new image names


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@945 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 02:59:27 +00:00
rey4
b0ebdbed63 Fix escaping of directory paths in query pages so searching within
directories works on windows.

* lib/cvsdb.py
  (EscapeLike):
    new function

* lib/viewcvs.py
  (view_query):
    escape directory paths before using them in LIKE comparisons


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@944 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 02:32:15 +00:00
rey4
32ad18a7ad Remove unused and undocumented 'filename' template variable from log
pages. It was was added in rev 1.158.

* lib/viewcvs.py
  (view_log):
    remove 'filename' template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@943 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 01:40:58 +00:00
rey4
155c926b23 Update upgrading.html with information about some recently changed
template variables, also fix some existing entries in the file.

* website/upgrading.html
  (sortdir_up_href, sortdir_down_href, roots):
    add new documentation about these variables

  (roottype, rootname, pathtype, raw_diff):
    fix these entries up


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@942 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 01:17:17 +00:00
rey4
267d335899 Combine "Dead Files" and "Files Shown" counts in directory listing
* templates/include/dir_header.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@941 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 23:51:55 +00:00
rey4
162f650a9b Update windows README
* windows/README
    update CVSNT url
    add warning about using old versions of CVSNT


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@940 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 23:30:41 +00:00
rey4
0366e98834 Remove unused loginfo module
* lib/vclib/ccvs/loginfo.py
    deleted


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@939 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 23:08:27 +00:00
rey4
e0a60537f7 Tweak handling of MIME types in ViewCVS pages
- Don't pass "text/plain" as a MIME type to templates when the real
  type is unknown, pass None instead

- Load MIME types file once after reading the ViewCVS configuration
  instead of reloading at each request.

* lib/viewcvs.py
  (Request.run_viewcvs):
    set Request.mime_type member here

  (Request.setup_mime_type_info):
    removed

  (guess_mime, is_plain_text):
    new

  (is_text, is_viewable_image, view_checkout):
    change to cope with None MIME types, treating them like text

  (view_markup):
    use new is_plain_text function

  (view_directory, search_files):
    use new guess_mime function

  (view_log):
    make use of Request.mime_type member and the new is_plain_text
    function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@938 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 22:35:43 +00:00
rey4
1f561d48eb Fix some silliness in link generating code
* lib/viewcvs.py
  (Request.get_link):
    where implies where != ''


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@937 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 21:02:26 +00:00
rey4
f8bf3f132f Fix time conversion bug that prevented queries from working on
Python 2.3 installations without mxDateTime.

Thanks to paul@times-interactive.com for bringing the bug and fix
to my attention on the users' list.

* lib/dbi.py
  (TicksFromDateTime):
    handle case where MySQLdb returns datetime objects


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@936 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 20:53:31 +00:00
rey4
55aa1e3d12 Update the documentation so it's no longer an impediment to a 1.0
release. There's still a lot of room for improvement, but there
should be no gaping holes or inaccuracies.

* INSTALL
    update old paths

    remove mention of svn_parent_path

    remove advice about trailing slashes in the Troubleshooting
    section. They're nice, but optional now that we don't use
    relative links.

* README
    add pointer to windows/README

* templates/docroot/help_logtable.html
    document the missing columns

* website/upgrading.html
    document the configuration options

    add a word of advice about upgrading with custom templates


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@935 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 17:57:14 +00:00
rey4
38e39154ac Update the list of developers
* website/who.html
    add James Henstridge and Lucas Bruand and list the various
    peoples' contributions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@934 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 04:01:18 +00:00
rey4
ebba161285 Update the CHANGES file
* CHANGES
  (Version 1.0):
    add new features and bugfixes. I came up with the list by scanning
    the CVS logs since 0.9.2 for user-visible changes, so it should
    be pretty complete.

  (Version 0.9.2):
    correct release date


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@933 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 02:23:16 +00:00
rey4
50e1e87f71 Edit a comment in viewcvs.conf.dist
* viewcvs.conf.dist
  (docroot):
    edit comment


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@932 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-28 16:33:44 +00:00
rey4
f74b149949 Don't copy website on install
* viewcvs-install
  (TREE_LIST):
    remove website directory from list


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@931 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-28 16:30:22 +00:00
rey4
22965539ff Make the navigation bar easier to read
* templates/docroot/styles.css
  (.vc_navheader):
    switch to gray background because blue links on purple background
    are hard to read

* header.ezt
  (nav_path):
    make it bold


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@930 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-27 21:01:06 +00:00
rey4
b062a30d76 Simplify handling of roots in root_as_url mode.
* lib/viewcvs.py
  (Request.run_viewcvs):
    don't do blind redirects when we have a "root" parameter in
    root_as_url mode because it can lead to multiple redirects
    and redirects to invalid urls

    don't even try to interpret non-root_as_url url's in
    root_as_url mode when they don't specify an explicit
    root. It can't be done reliably and there's little
    value in it anyway


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@929 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 03:45:20 +00:00
rey4
38321990ae Get rid of unused "viewable" and "is_text" template variables on log
page. They weren't terribly useful or accurate.

* lib/viewcvs.py
  (Request.setup_mime_type_info):
    stop setting "default_viewable" member

  (view_auto):
    stop using request's "default_viewable" member, just compute value
    on the fly

  (view_log):
    stop setting "viewable" and "is_text" template variables

* website/upgrading.html
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@928 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 03:06:28 +00:00
rey4
c0300fcc2c Fix bug in clickable_path (from lib/viewcvs.py 1.167) that makes
navigation on markup, diff, and annotate pages a pain.

* lib/viewcvs.py
  (clickable_path):
    interpret leaf_is_link argument correctly


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@927 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 02:39:19 +00:00
rey4
7886133d91 Tweaks to code that generates links in ViewCVS pages. The only
externally visible difference is that in root_as_url mode,
links with "root" parameters no longer get a redundant path
component pointing at the current root.

* lib/viewcvs.py
  (_sticky_vars):
    don't make root a sticky var, it gets special treatment anyway
    and having it sticky just makes things more complicated

  (Request.get_link):
    remove redundant and never-used rootname argument

    make logic that suppresses sticky variables on checkout and
    tarball links more explicit

    change code for merging sticky variables to operate on the
    dictionary of parameters instead of building a new dictionary

    make code that handles the "root" parameter generate minimal
    URLs in all circumstances

  (Request.get_options):
    removed, logic moved into Request.get_link

  (Request.sticky_vars):
    new method that returns a dictionary of stick variables

  (view_annotate, view_cvsgraph):
    call Request.sticky_vars instead of Request.get_options


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@926 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 02:23:27 +00:00
rey4
24041aeb9a Use new-style viewcvs links in CvsGraph images
* cvsgraph.conf.dist
    update path strings


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@925 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 00:55:30 +00:00
rey4
502873ecc0 Bugfix in query page, stop using old "icons" config variable
* lib/query.py
  (main)
     stop trying to set "icons" template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@924 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 00:32:01 +00:00
rey4
e80dfb1aa9 Now that we're using our own icons instead of the icons provided by Apache,
we can get rid of the alternative icons we provided for the standalone web
server and IIS. We can also get rid of the "icons" configuration option.

* lib/apache_icons.py
* tools/bin2inline_py.py
    removed, icons for the standalone server

* windows/icons/apache_pb.gif
* windows/icons/small/back.gif
* windows/icons/small/dir.gif
* windows/icons/small/text.gif
    removed, icons for IIS

* templates/include/footer.ezt
    point "Powered by Apache" image at /icons/apache_pb.gif instead of
    [icons]/apache_pb.gif

* standalone.py
  (apache_icons, icons_last_modified):
     removed

  (ViewCVS_Handler.do_GET):
    remove handling of /icons/ paths

  (serve):
    stop setting options.icons config value

* viewcvs.conf.dist
  (icons):
    removed

* lib/config.py
  (Config.set_defaults):
    stop setting default options.icons config value

* lib/viewcvs.py
  (common_template_data):
    don't set "icons" template variable

* windows/README
  (ICONS FOR IIS):
    removed

  (DOCROOT OPTIMIZATION):
    new section about the docroot parameter

* website/upgrading.html
    remove documentation for "icons" template variable, update
    documentation for "docroot"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@923 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 00:00:31 +00:00
jhenstridge
0e9248f2a7 Remove the moved files to finish off the reorganisation.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@922 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-22 06:40:53 +00:00
jhenstridge
d027efa883 Copy online documentation, stylesheet and required images to
templates/docroot/

* templates/docroot/help_*.html, templates/docroot/styles.css: copied
  from website/
* templates/docroot/images/*: copied from website/images/ or from Apache.
  fix up the transparency on some of the PNGs (just 1-bit transparency
  though, so they work with IE).
* lib/viewcvs.py (view_doc): update to the new location for documentation.
  We can use the same location in the "installed" and "uninstalled" modes.
* viewcvs.conf.dist: update the comment about the docroot config value.
* templates/*.ezt: update for new icon locations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@921 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-22 06:22:42 +00:00
cmpilato
3c236331e1 Some error-related cleanups.
* viewcvs/lib/viewcvs.py
  Update all uses of "ViewcvsException" to "ViewCVSException".
  (_RCSDIFF_IS_BINARY): Make this value match the one used in templates.
  (human_readable_diff): If rcsdiff comes back with the wrong version
    information, raise an exception that error.ezt can handle.  Also,
    simplify the handling of rcsdiff_eflag.
  (download_tarball, view_cvsgraph_image, view_cvsgraph_image): Raise
    403 Forbidden's for disable features.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@920 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-14 18:16:58 +00:00
jhenstridge
b68ec0fda5 Fix some validity errors on the query_form.ezt template.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@919 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-14 08:56:18 +00:00
jhenstridge
7cce726069 Fix up validity errors due to non-escaped ampersands in URLs.
* lib/viewcvs.py: add an optional escape parameter to the get_url()
   method, that will entity escape the URL.
   Pass escape=1 to each call to get_url() that is used to construct a
   URL for display in a template.
 * lib/blame.py: fix up a small entity escaping problem here too.
 * templates/revision.ezt: fix up a few HTML validity errors in this
   template that were a lot more obvious after clearing up the other
   errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@918 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-14 08:49:32 +00:00
cmpilato
2481c9a5c9 Normalize configured paths at a different time so that we don't
destroy URLs used by the svn_ra module.

* viewcvs/lib/config.py
  (_parse_roots): Don't normalize the paths for roots here -- it will
    destroy URLs.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Normalize them here, *after* we know what's a
    URL and what's a normal path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@917 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-09 22:10:57 +00:00
jhenstridge
302fa88601 * templates/include/dir_footer.ezt: get rid of validity error due to
misnesting of <form> and <table> tags.
* templates/include/diff_form.ezt: get rid of a similar problem in the
  diff form.
  Also simplify the form a bit for the case when there are no tags (ie.
  subversion).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@916 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-03 12:31:59 +00:00
jhenstridge
c969184313 * templates/directory.ezt, dir_alternate.ezt: make the sort order arrow
part of the header hyperlink.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@915 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-03 11:48:38 +00:00
cmpilato
f857dad099 Learn these here RCS parsers about the fact that that "branch" keyword
over yonder is right optional.  Patch by Max Bowsher <maxb@ukf.net>.
Faux cowboy by cmpilato.

* lib/vclib/ccvs/rcsparse/common.py (_Parser.parse_rcs_admin)
* lib/vclib/ccvs/rcsparse/default.py (Parser.parse_rcs_admin)
* tparse/tparse.cpp (parse_rcs_admin)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@914 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-17 23:08:54 +00:00
cmpilato
e58b5f67aa * lib/viewcvs.py
(_re_validate_number): Allow brackets in tag names.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@913 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-17 19:17:55 +00:00
cmpilato
e376b03b6d * website/styles.css
Make the annotate data "smaller", and increase the padding between
  columns.

* viewcvs/templates/annotate.ezt
  Remove superfluous spaces in table cells.  Mozilla is rendering
  wrongly, presumably because the cells are using "nowrap" or "pre"
  whitespace handling.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@912 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-14 16:50:57 +00:00
cmpilato
2f0a5efaf1 Cleanup the new dead file handling code to be more template-friendly
(and honest).

* lib/viewcvs.py
  (view_directory): Always calculate the num_dead variable with
    truth.  Just because we aren't showing dead files doesn't mean they
    don't exist.

* templates/include/dir_header.ezt
  Provide a single place for reporting the number of, and toggling the
  display of, dead files.

* templates/directory.ezt
* templates/dir_alternate.ezt
  Stop handling dead file display toggling on what appears (and yet
  isn't) a per-item basis.  Also, use Apache's broken.gif as the icon
  for dead files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@911 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-11 14:35:44 +00:00
rey4
4f1e9a7ce7 Update alternate template.
* templates/dir_alternate.ezt
    fix handling of attic directories as in templates/directory.ezt, rev 1.47


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@910 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-01 14:41:39 +00:00
rey4
72f060b3ad Get the query view working on windows. The backslashes in repository paths
weren't being escaped before being embedded in sql strings.

Also do some cleanup in dbi.py

* lib/cvsdb.py
  (CheckinDatabase.SQLQueryListString):
    escape string values using Connection.escape() method

  (CheckinDatabase.CreateSQLQueryString):
    update calls to SQLQueryListString()

* lib/dbi.py
  (Cursor, Connection):
    remove these proxy objects, they don't do anything

  (connect):
    return MySQLdb.Connection object instead of proxy object


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@909 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-01 14:33:00 +00:00
rey4
f3ca45b9a0 Handle CVS Attic paths transparently in the bincvs module
instead of exposing them to users.

* templates/include/dir_footer.ezt
    add link to show dead files

* templates/directory.ezt
    remove code for detecting Attic entries,
    change (in the attic) caption to (dead)

* lib/viewcvs.py
  (Request.run_viewcvs):
    handle old Attic URL's by redirecting,
    remove unused request.full_name member

  (get_up_path, _re_up_attic_path, nav_header_data, generate_tarball,
   download_tarball):
    remove code for handling Attic directories

  (view_markup):
    remove unused "full_name" variable

  (view_directory):
    remove code for handling Attic directories,
    replace "no_match" template variable with "num_dead"

  (view_log):
    update call to get_up_path

  (view_annotate, view_cvsgraph_image, view_cvsgraph, view_diff):
    use CVSRepository.rcsfile to get path to rcs file

* lib/vclib/bincvs/__init__.py
  (CVSRepository.itemtype):
    look in Attic for repository files

  (CVSRepository.listdir):
    remove "cvs_list_attic" option, now always list attic files.
    leave "Attic" and "CVS" directories out of returned listing.

   (CVSRepository.rcsfile, CVSRepository._atticpath):
     new methods

   (BinCVSRepository.openfile, BinCVSRepository.filelog):
     use CVSRepository.rcsfile to get path to rcs file

   (_get_logs):
     don't mark directories as dead

* lib/vclib/ccvs/__init__.py
   (CCVSRepository.filelog, CCVSRepository.openfile):
     use CVSRepository.rcsfile to get path to rcs file

* website/upgrading.html
    document "no_match" and "num_dead" template variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@908 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-31 22:34:51 +00:00
rey4
98b799adbf Improve error handling in directory view.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile, BinCVSRepository.filelog, fetch_log):
    update calls to _parse_log_header

  (_re_log_error, _re_cvsnt_error, _re_lineno):
    update regular expressions for parsing rlog error messages

  (_parse_log_header):
    do a better job of parsing rlog error messages and return messages
    to callers

  (_get_logs):
    set new DirEntry.log_errors property and deal with multiple rlog error
    messages about the same file and cases where error messages precede
    file information

  (_log_path):
     return error info

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs):
    set new DirEntry.log_errors property

* lib/vclib/svn/__init__.py
  (get_logs):
    set new DirEntry.log_errors property

* lib/vclib/svn_ra/__init__.py
  (get_logs):
    set new DirEntry.log_errors property

* lib/vclib/__init__.py
  (Repository.dirlogs):
    document new DirEntry.log_errors property

* lib/viewcvs.py
  (view_directory):
    set new template variables

* website/upgrading.html
    document new template variables

* templates/include/dir_footer.ezt
    get rid of confusing "One or more files were unreadable" message.
    We display more specific error messages in the directory list.

    add links to set selection criteria at the bottom of "There are
    [num_files] files, but none match the current selection criteria"
    message

* templates/directory.ezt
* templates/dir_alternate.ezt
    simplify the way error messages are displayed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@907 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-31 14:38:03 +00:00
jhenstridge
73a344bb15 * lib/viewcvs.py (view_diff): also use entry.filename as the location for
the view_href in the case where the path type is a directory.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@906 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-29 02:37:47 +00:00
jhenstridge
32b741f259 * lib/viewcvs.py (view_log): when constructing the view and download URLs,
use entry.filename as the location.  This fixes the view/download links
  when the log crosses a copy boundary.  Fixes bug #999355.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@905 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-29 02:33:04 +00:00
jhenstridge
ea19338677 * lib/viewcvs.py (htmlify): when htmlifying email addresses, encode the
@ symbol as a character reference.  This can trip up some email address
  spiders, while being transparent to web browsers.
  The idea came from Bugzilla.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@904 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-29 02:04:16 +00:00
jhenstridge
7a0284214c * templates/include/header.ezt: remove stray </h1> tag.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@903 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-28 02:51:40 +00:00
jhenstridge
997d4f85d1 * lib/viewcvs.py (view_directory): If it is a subversion repository,
use the directory revision number as a weak etag.
 (view_revision_svn): use the revision number as a weak etag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@902 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-26 09:00:42 +00:00
jhenstridge
85d9d50631 * diff_form.ezt: wrap the text associated with the "makepatch" checkbox
in a <label> element, so that users can click on the text to toggle
  the value.
  Quote a few unquoted attribute values.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@901 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-26 08:17:15 +00:00
jhenstridge
d906319a8e * viewcvs-install (install_tree): don't install files ending in '~', since
this is the suffix many unix editors use for backups (and there aren't
  any files with that suffix in viewcvs).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@900 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-26 05:20:39 +00:00
jhenstridge
c3aff09497 * lib/viewcvs.py, templates/log.ezt, templates/log_table.ezt: revert
change that moved generation of human readable diff URLs from the
  templates to the Python code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@899 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-24 16:34:04 +00:00
rey4
db74810b91 Normalize user-specified paths in cvs_roots, svn_roots, and root_parents.
The bincvs module doesn't take kindly to paths with alternate directory
seperators or trailing slashes.

* lib/config.py
  (_parse_roots):
    call os.path.normpath for cvs_roots and svn_roots paths

* lib/viewcvs.py
  (handle_config):
    call os.path.normpath for root_parents paths


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@898 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 23:47:00 +00:00
jhenstridge
4e573ace1d Fix up the diff links when diff_format is set to a non-default value on
the log pages.

* templates/include/diff_form.ezt: if no tags exist for the file, don't
  show the drop down tag selection box.  This gets rid of some unneeded
  UI when browsing Subversion repositories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@897 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 12:43:11 +00:00
jhenstridge
198923b18a * viewcvs.py: add code to calculate various diff URLs used in the log
view.  For Subversion repositories, these URLs are usually shorter
  (only include p1/p2 when paths differ) and handle a few corner
  cases w.r.t. moves that the old code didn't.

* log.ezt, log_table.ezt: use the diff URLs passed in from viewcvs.py
  rather than constructing them in the template.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@896 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 11:28:30 +00:00
jhenstridge
4f348926fe Add thead/tbody tags to log_table.ezt, query.ezt and revision.ezt
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@895 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 09:55:50 +00:00
jhenstridge
09165074cf set size of sort arrow images, so that they don't cause reflows while
loading.  Wrap the column headers in a <thead> tag, and the rest of
the elements in a <tbody> tag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@894 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 08:43:04 +00:00
jhenstridge
0f89aa8265 Add vc_log CSS class to log message on revision.ezt template. Fix from
Simon Lieschke (patch #995667)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@893 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 10:08:29 +00:00
jhenstridge
768233a590 fix up typo in comment.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@892 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 08:58:18 +00:00
jhenstridge
80e621dc0d Sort the tags attached to a revision in the log view. Fix came from
bug #994522.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@891 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 02:19:07 +00:00
jhenstridge
247234ff03 Add support for generating backout scripts from query results like Bonsai
can.  Suggested in Bug #777122.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@890 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 02:10:51 +00:00
jhenstridge
af221adef2 Use a different parameter name for the query sort key so that it doesn't
get mixed up with the directory view sort (similar to how the log view
uses logsort as a parameter name).

Don't display the branch column in results for a subversion repo query.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@889 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 16:01:09 +00:00
jhenstridge
f2d02f282b Update get_link() to add a rev parameter for diff links on subversion
repositories (sets rev to the same value as r2).

Update run_viewcvs() so that if no view is selected, handle requests
that specify r1,r2,rev as diffs rather than checkouts, and requests
that specify r1,rev as logs.

Update log.ezt and log_table.ezt to set the rev parameter in the diff
links when browsing subversion repositories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@888 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 15:46:47 +00:00
jhenstridge
69d586a5d8 Since you don't need to click on the sort arrow to change sort direction,
don't make the arrows look like buttons.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@887 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 15:11:48 +00:00
jhenstridge
cc970525ac Simplify column sort code, so that clicking the sort column header
reverses the sort order, while clicking on other headers sorts by
that column in ascending order.  This matches how most GUIs handle
sorting in columned lists.

Also port the sort handling from dir_alternate.ezt to directory.ezt
to reduce differences between the two templates.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@886 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 14:58:30 +00:00
jhenstridge
57c58fde9b Fix up dir_alternate.ezt template to fix bug #995121 (switch the
pathname and revision links for directories).

Previously dir_alternate.ezt was broken for CVS repositories, resulting
in a traceback since it was trying to show the log href which doesn't
exist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@885 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 12:17:50 +00:00
jhenstridge
55bdd8cb45 Convert double dashes in comment to single dashes, since the double dash
ends the comment.  Mentioned in a Debian bug report:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=245550

Add a <meta name="generator"> tag to the top listing the version of
viewcvs used to generate the page.  This is less likely to be removed
from custom templates, and should be helpful when tracking bugs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@884 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-20 07:26:52 +00:00
jhenstridge
fcdcd96359 Remove the italics from the log message CSS rules, since regular type
was more common for rendering log messages.

Before, non-italic was used in the markup, log and query templates,
while italic was used in log_template and query_results (which I copied
off of log_template).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@883 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-20 07:16:50 +00:00
jhenstridge
31ac07eb78 render all revision log messages as <pre class="vc_log">...</pre>
Add CSS for vc_log to set it italic (as it was already shown in most places),
and set some proprietary properties to turn on word wrapping for Mozilla,
Opera and IE, and the equivalent standard CSS3 property (for when browsers
support it).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@882 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-19 08:49:39 +00:00
jhenstridge
8a3030d4cf use CSS classes for the different columns in annotate mode. In particular,
set "white-space: pre" for the text column, so that white space isn't
collapsed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@881 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-18 11:11:56 +00:00
jhenstridge
236668b628 Expose glob matching and notregex matching in query_form.ezt.
Loosen some of the parameter validation to _validate_regex for
branch, file and who query parameters.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@880 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-18 06:37:31 +00:00
jhenstridge
f3cbf1e629 Add two new match types: notregex and glob. The "glob" match type is
implemented using fnmatch to translate it into a regular expression.

Refactor CreateSQLQueryString a little bit to split out join conditions.
Previously if you wanted to query files names A or B, it would generate
SQL like this:
  ((checkins.fileid=files.id AND files.file='A') OR
   (checkins.fileid.files.id AND files.file='B'))
Now it generates the shorter (and hopefully easier to optimise):
  (checkins.fileid=files.id) AND (files.file='A' OR files.file='B')
I'd change it to do INNER JOIN's, but apparently MySQL 3.22 doesn't
support them fully.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@879 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-18 05:41:53 +00:00
jhenstridge
7ad43eaa74 Port the "diff link" support over to the query.cgi script.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@878 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-17 06:46:02 +00:00
jhenstridge
d8cc63ee4e Add simple querying support directly to the viewcvs script. This is
closer to the Bonsai query interface, and provides better integration
with the rest of viewcvs.

Fixed two bugs in cvsdb.py:
 - when loading up query results, set the checkin type on the Commit object
 - When sorting on file name or author, order by the name rather than ID.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@877 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-17 06:03:33 +00:00
jhenstridge
41c06a258e Fix file descriptor leak in standalone.py
Reported as http://sourceforge.net/tracker/?func=detail&aid=735455&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@876 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-17 01:50:20 +00:00
jhenstridge
a6ae62b59f 1) add a bit of documentation on using svndbadmin to load revision
information into the query database.
2) Update query.cgi to set [docroot] correctly.  This allows it to find
   the stylesheet, and corrects the help link in the footer.
3) Results could point at subversion repositories, so check if the
   repository is in svn_roots too.
4) Only display repository names rather than paths in the results.
   This matches what viewcvs.cgi shows the user.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@875 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 16:39:46 +00:00
cmpilato
4a479b303b Add copyright info to SVN mailer patch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@874 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 16:31:21 +00:00
cmpilato
39beba2aa9 New patch for integration with Subversion's mailer.py script.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@873 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 16:25:59 +00:00
jhenstridge
4d6369388e Remove the svn_parent_path config value, and replace it with a root_parents
config value, which can handle CVS repositories as well as Subversion ones.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@872 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 15:43:01 +00:00
cmpilato
648ac31eb3 * viewcvs/lib/viewcvs.py
(list_roots): Make the roots hash values into tuples, adding the roottype.
  (common_template_data): Make the 'roots' list items into hashes that
    carry the root names and types.

* viewcvs/templates/include/header.ezt
  Split the list of repositories up into CVS ones and Subversion ones
  using optgroups.  Note the super-cool single pass over the roots,
  appending options to variables created on-the-fly.  Have I mentioned
  how much I love James Henstridge today?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@871 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 14:11:55 +00:00
jhenstridge
59f7ac841a Fix the same issue in view_log(). Was mentioned in the same bug report
as the view_directory() one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@870 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 14:05:14 +00:00
jhenstridge
fc86389a25 s/query_dict/request.query_dict/ in view_directory() to fix traceback
when using pages.  Reported in the bug tracker as:
  http://sourceforge.net/tracker/index.php?func=detail&aid=953892&group_id=18760&atid=118760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@869 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 14:03:10 +00:00
jhenstridge
d428e9fa2e - Add svndbadmin script, which can be used to add Subversion revision
information to the Bonsai checkin database.
- Get viewcvs-install to install the new script.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@868 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 11:53:48 +00:00
rey4
19866deb18 Update windows README file
* windows/README
    add link for downloading subversion python bindings binaries

    remove mention of cvsnt bugs. they've all been either fixed or
    worked around, and the cvsnt bugzilla database is now deleted

    fix a spelling


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@867 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-01 23:51:45 +00:00
cmpilato
1b68297aff Makin' things purtier. Patch by James Henstridge <james@jamesh.id.au>.
* viewcvs/templates/log_table.ezt
  Set the HTML class attribute to vc_header_sort for the header of the
  sort column.  Change the tags around the log message from
  <i><pre>...</pre></i> to <pre><i>...</i></pre>.  Since <pre> is a
  block level element and <i> is an inline element, the old nesting
  results in an extra block after the message in the table cell.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@866 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-01 20:56:38 +00:00
cmpilato
289c3b25bc Make Etag support optional (in a first-class fashion).
* viewcvs/lib/viewcvs.py
  (check_freshness): Check the new configuration option for etag
    support.  Also, cfg.general.http_expiration_time is now
    cfg.options.http_expiration_time.

* viewcvs/lib/debug.py
  (DISABLE_ETAGS): Remove.

* viewcvs/lib/config.py
  (Config.set_defaults): Set new 'generate_etags' option default to 1,
    and move 'http_expiration_time' to the [options] section (from the
    [general] one).

* viewcvs/viewcvs.conf.dist
  (cfg.options.generate_etags): New.
  (cfg.options.http_expiration_time): Was cfg.general.http_expiration_time.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@865 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-23 20:57:16 +00:00
cmpilato
7b8eb7639e Instead of sending colored diffs to the diff.ezt template, and raw
diffs to their own text/plain output, templatize all diffs.  By
default now, all diffs will go through diff.ezt (which has been
updated to handle it).  Only if the new 'makepatch' boolean CGI flag
is set will diffs be sent directly as text/plain, non-templatized
output.

* viewcvs/lib/viewcvs.py
  (_legal_params): Add new 'makepatch' boolean parameter.
  (check_freshness): Fix a speeling eror.
  (MarkupPipeWrapper.__init__): Add 'htmlize' parameter, and use it.
  (human_readable_diff): Lose the 'request', 'sym1', and 'sym2'
    parameters.  Now return the parsed dates and DiffSource object
    instead of populating a data dictionary and completely generating
    the page.
  (spaced_html_text): Use an intermediate variable for readability.
  (raw_diff): New.
  (view_diff): Honor the new 'makepatch'.  Update calls to
    human_readable_diff(), and make use of raw_diff().  Do all page
    generation for diffs here now.  Adds a new 'raw_diff' data
    dictionary item, useful for testing raw vs. colored, as well as
    for positioning that raw diff output in the template.

* templates/diff.ezt
  Use the new 'raw_diff' data dictionary item to position raw diff
  output in the template.  Update the diff form to allow for the
  generation of traditional "patch-ish" raw diff output.

* templates/include/diff_form.ezt
  Allow for the generation of traditional "patch-ish" raw diff output.

* website/styles.css
  (vc_raw_diff): New style class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@864 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-22 14:37:11 +00:00
cmpilato
3e73713c17 Add a debug setting which promises to restore my sanity in the face of
Etags and browser caching.  And use it.

* lib/debug.py
  (DISABLE_ETAGS):  New.

* lib/viewcvs.py
  (check_freshness): If DISABLE_ETAGS is set, never report that the
    page is fresh.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@863 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-22 14:12:23 +00:00
cmpilato
e8dc91b483 Fix the description of http_expiration_time.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@862 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-21 19:34:38 +00:00
cmpilato
4d8b46e2c8 Bang out a 'revision' view for the svn_ra module. Soooo incomplete,
sooo hard a problem to solve efficiently.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (_rev2optrev): Fix use of 'if foo' when I mean 'if foo is not None'.
  (ChangedPath): New class.
  (LastHistoryCollector.__init__): Remove uninteresting 'pass'.
  (LastHistoryCollector.add_history): Add 'paths' and 'pool'
    arguments, and now at least do some semblance of support for
    dealing with those paths.
  (LastHistoryCollector.get_history):
  (_get_rev_details): Was _get_revision_info().  Now uses the
    LastHistoryCollector.add_history callback directly.  Callers changed.
  (get_revision_info): New.
  (SubversionRepository.get_dirents): Fix a dirent caching bug.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@861 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-14 16:14:45 +00:00
cmpilato
ac8c9d303c Add cache expiry support to ViewCVS. Patch by James Henstridge
<james@daa.com.au>.

* standalone.py
  (StandaloneServer.header): Fix some status handling stuff.

* viewcvs.conf.dist
  Add default value for new http_expiration_time option.

* lib/config.py
  (Config.set_defaults): Set default value for new
  http_expiration_time

* lib/viewcvs.py
  (check_freshness): Add cache control headers using the configured
    expiration times.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@860 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-14 15:52:41 +00:00
rey4
8b85373685 Remove workaround for CVSNT bug 188, which was fixed in version 2.0.12
* lib/vclib/bincvs/__init__.py:
  (_get_logs):
    simplify filename checking

  (_path_ends_in):
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@859 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-06 03:08:16 +00:00
rey4
ea73dfb7a3 Fix bugs #911437 and #922679 caused by newer versions of cvsnt using forward
slashes instead of backslashes in outputted paths.

(_parse_log_header, _parse_co_header):
  deal with forward slashes in paths outputted by cvsnt rcs utilities

(BinCVSRepository.openfile):
  fix uninitialized variable error in raise statement


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@858 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-06 02:46:49 +00:00
cmpilato
8f9c8de036 Make ViewCVS more cache-friendly. Patch by James Henstridge
<james@daa.com.au>.

* lib/viewcvs.py
  (check_freshness): New.
  (MarkupBuffer.close): New.
  (MarkupPipeWrapper.close): New.
  (MarkupPipeWrapper.__del__): Call own close() function now.
  (MarkupEnscript.close): New.
  (MarkupEnscript.__del__): Call own close() function now.
  (view_markup, view_log, view_diff): Call new check_freshness() function.
  (view_doc): Gut caching code and use check_freshness() instead.

* lib/sapi.py
  (CgiServer): Fix handling of 304's in IIS.

* standalone.py
  Now purge the environment of HTTP_* variables before setting our
  own.  Also, perhaps set the 'HTTP_IF_MODIFIED_SINCE' and
  'HTTP_IF_NONE_MATCH' variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@857 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-03 15:42:04 +00:00
cmpilato
f0b96a1617 Fix a bunch of pool usage problems with ViewCVS/Subversion.
* viewcvs/lib/vclib/svn/__init__.py
  (_fetch_log): Now accept a 'pool' parameter.
  (FileContentsPipe): Was StreamPipe().
  (FileContentsPipe.__init__): Instead of taking a stream, accept the
    root, path, and a pool.  Use a subpool of the pool for the stream
    creation.
  (FileContentsPipe.__del__): New.
  (SubversionRepository.__init__): Make a scratch subpool that
    operations can safely use and clear.
  (SubversionRepository._scratch_clear): New convenience function.
  (SubversionRepository.itemtype, SubversionRepository.listdir): Use
    and clear the scratch pool.
  (SubversionRepository.filelog): Update call to _fetch_logs().  Use
    and clear the scratch pool.
  (SubversionRepository.openfile): Update call to FileContentsPipe().
    Use and clear the scratch pool for the call to _get_last_history_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@856 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-01 19:43:51 +00:00
cmpilato
da2822ecf0 Sending caching headers back to the browser for static content to
reduce roundtrips.  Patch by James Henstridge <james@daa.com.au>.

* viewcvs/lib/viewcvs.py
  (copy_stream): Use a slightly different mechanism for falling back
    to sys.stdout (for standalone.py).
  (view_doc): Send Last-modified headers for static content.

* viewcvs/standalone.py
  Calculate the modification time of the Apache icons module.
  (StandaloneServer.do_GET): Send that modification time.
  (StandaloneServer.header): Send custom headers.

* viewcvs/lib/sapi.py
  (CgiServer.addheader, AspServer.addheader, ModPythonServer.addheader): New.
  (CgiServer.header): Fix the way statuses are returned.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@855 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-24 22:57:30 +00:00
cmpilato
0ccadb2681 Fix a typ-o in yon copyright block.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@854 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-18 20:15:30 +00:00
cmpilato
6e6c604a94 Update the upgrade docs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@853 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-14 15:32:49 +00:00
cmpilato
6af773b46b * viewcvs/lib/viewcvs.py
(view_directory): Do mime_type detection of files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@852 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-14 15:21:10 +00:00
cmpilato
db610d9a21 * viewcvs/lib/viewcvs.py
(view_directory): Expose file sizes (when available) in the
    directory view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@851 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-13 04:29:08 +00:00
cmpilato
9d63323c24 Oops. Forgot to actually add the stylesheet.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@850 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-12 14:58:57 +00:00
cmpilato
71b16e1321 *** empty log message ***
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@849 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-12 01:46:43 +00:00
cmpilato
af1f78ba83 * viewcvs/templates/include/dir_footer.ezt
Use <optgroup> tags to group branches and tags.  Patch by James
  Henstridge <james@daa.com.au>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@848 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-11 06:53:52 +00:00
cmpilato
a0bc4d071b * viewcvs/lib/viewcvs.py
(common_template_data): Expose request.pathtype as a generally
    available template variable.  (Have I mentioned today how much I
    dislike per-template data dictionary items?)

* viewcvs/templates/log_table.ezt
* viewcvs/templates/log.ezt
  Use the pathtype variable to determine whether or not to show
  file-only stuff like diff and download options.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@847 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 15:37:11 +00:00
cmpilato
cfe3d1ea29 Fix a brain-O. "filter_path" is the *opposite* of "show_all_logs".
Duh.  Stop using filter_path and (failing at) translating between the
senses here.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.__init__): Drop the 'options', take explicit 'show_all_logs'.
  (LogCollector.add_log): Update for new variables.  Also, fix some
    logic so this works when we aren't showing all logs, too.
  (SubversionRepository.filelog): Parse the options here, and pass to
    the LogCollector().

* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.__init__, NodeHistory.add_history, _get_history): Stop
    using 'filter_path'; use 'show_all_logs' instead.

* viewcvs/lib/viewcvs.py
  (view_log): Make showing all directory logs default to 0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@846 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 14:56:09 +00:00
cmpilato
e075e20fa7 More directory log view fixes.
* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.add_history): Use subpools in this loop.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.add_log): Fix an off-by-one error.  The path for this
    revision is self.path *before* we find the previous path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@845 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 14:08:50 +00:00
cmpilato
bcd7a406aa * viewcvs/lib/vclib/svn/__init__.py
(NodeHistory.add_history): Fixes for support for directory log
    filtering.  Don't filter out copy revisions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@844 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 14:01:12 +00:00
cmpilato
d2a8e86357 Fix the root-change mechanism I broke recently.
* viewcvs/lib/viewcvs.py
  (Request.get_link): Allow where == '' as a way to indicate that you
    want to see the root directory (since None means "use self.where").
  (common_template_data): Generate the right URL for changing roots.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@843 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-07 15:40:22 +00:00
cmpilato
242b41d9c1 Fix Bug #949445 (premature <pre> tags in large files)
* viewcvs/lib/viewcvs.py
  (MarkupPipeWrapper): Rewrite this class so that it actually works.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@842 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-07 15:23:23 +00:00
cmpilato
459675943c Close Bug #847437.
* viewcvs/website/index.html
  Say that we require 1.5.2, not 1.5 (which eliminates the need to
  point out the MySQL dependency).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@841 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-06 21:38:35 +00:00
cmpilato
97d9b20adf Get support for the 'show_all_dir_logs' option (specifically, the
"don't show all dir logs") working the svn_ra layer.  In fact, this
sucker is now more accurate as far as revision choices go than the
'svn' module.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.__init__): Deal with None paths, and ensure leading slashes.
  (LogCollector.add_log): Uncomment and fix path filtering code.
  (_fetch_log): Remove.
  (SubversionRepository.filelog): Move contents of _fetch_log into
    here, and then do something that in unheard of -- CALL
    SVN_CLIENT_LOG WITH THE PARAMS IN THE RIGHT ORDER!


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@840 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-06 17:00:28 +00:00
cmpilato
c20560b1fc Add basic support for Subversion directory log viewing in ViewCVS.
NOTE: This work is not yet finished for the 'svn_ra' vclib module.

* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.__init__): Add fs_ptr and filter_path arguments.
  (NodeHistory.add_history): If filtering, only add the history item
    if the path truly change in that revision.
  (_get_history): Add 'options' argument, and use it to decide if we
    need to filter out bubble-up-only directory logs, as well as
    whether or not to cross copies.
  (_fetch_log): Was fetch_log.  Add 'options' argument, passed to
    _get_history.
  (SubversionRepository.filelog): Update call to _fetch_log.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (_compare_paths): New path comparison function (ported from
    Subversion's C-composed svn_path_compare_paths)
  (LogCollector): New class for doing what the old inline _log_cb
    function did.
  (_fetch_log): Was fetch_log.  Add 'options' argument.  Now use the
    new LogCollector class.
  (SubversionRepository.filelog): Update call to _fetch_log.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Don't set 'cross_copies' as an attribute of
    the repository any more.  We use the vclib interface options
    params.
  (view_log): Re-work this sucker to handle requests for directory
    logs in Subversion.  Also, pass the cross_copy option here.
  (view_directory): Set the rev_href for Subversion directories to the
    log view href.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@839 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-28 16:21:51 +00:00
cmpilato
d0a62c7520 Try to get the query.cgi script working again. Unfortunately, I'm not
setup to test it at all. :-(

* viewcvs/lib/query.py
  (main): Populate the 'docroot' data dictionary item.

* viewcvs/templates/query.ezt
  Stop trying (and failing) to use the common header include ... I
  don't have the energy to make this thing work with that right now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@838 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-28 15:53:39 +00:00
cmpilato
1d6743ab98 * viewcvs/templates/revision.ezt
Re-add the "previous" and "next" buttons on the revision view.
  Patch (mostly) by Guy Maor <guy@extreme-da.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@837 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-28 14:53:22 +00:00
cmpilato
5995f83c4c Some more ViewCVS fixes and tweaks.
* viewcvs/templates/diff.ezt
  Setup template defines before include header.ezt.

* viewcvs/lib/viewcvs.py
  (view_revision_svn): Add 'rev' to the diff_href.

* viewcvs/templates/dir_alternate.ezt
  Fix the filename links to go to the log view again (apparently I
  accidentally clobbered these recently, though I must say, the
  navigation seems entirely unintuitive to me this way...).

* viewcvs/templates/revision.ezt
  Tweak the display of the log message a little big.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@836 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-24 17:38:31 +00:00
cmpilato
da21434ef0 Some bug fixes as suggested (in great detail, just short of a patch)
by Dirk Lemstra <dirk.lemstra@atosorigin.com>.  Also, add some stuff
to the generally-available-to-all-templates dataset.  And finally,
re-work all the templates for consistent look and feel.

I can die now.

* viewcvs/lib/viewcvs.py
  (common_template_data): Expose the 'where', 'roottype', and
    'rootname' Request members, and the 'nav_path', to all views.
    Also, do the root selection stuffs ('roots', 'change_root_action',
    'change_root_hidden_values').
  (nav_header_data): No longer explicitly add 'nav_path' to the data
    dictionary.
  (_dir_url): For Subversion, supply the revision number to the
    generated links.
  (view_directory): Include the revision when generating log view
    URLs.  Also, expose a 'tree_rev_href' data item for linking to the
    revision view.  No longer explicitly add 'roottype', 'where', and
    'current_root' to the data dictionary.  No longer do the root
    selection stuff here, either.
  (view_log): No longer explicitly add 'roottype', 'where', and
    'current_root' to the data dictionary.
  (human_readable_diff): No longer explicitly add 'where' to the data
    dictionary.
  (view_markup, view_revision): No longer explicitly add 'roottype' to
    the data dictionary.

* viewcvs/website/upgrading.html
  Document the changes.

* viewcvs/website/help_rootview.html
  Add a missing "<br>".

* viewcvs/templates/annotate.ezt
* viewcvs/templates/graph.ezt
* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
* viewcvs/templates/markup.ezt
* viewcvs/templates/query.ezt
* viewcvs/templates/revision.ezt
* viewcvs/templates/include/dir_header.ezt
* viewcvs/templates/include/footer.ezt
* viewcvs/templates/include/header.ezt
  Beat the heck outta these templates until they all reference
  header.ezt and footer.ezt (except for error.ezt), and they all
  present a basically consistent interface across all views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@835 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-22 15:40:01 +00:00
cmpilato
c94bb1347f * viewcvs/tparse/tparsemodule.cpp
Fix all instances of "if(!rv) { Py_DECREF(rv); }" mishap.  We should
  decrement the reference count for the value only if it is *not*
  NULL.  Erik Huelsmann oopsed.  I oopsed more for not reviewing the
  patch before application.  James Henstridge <james@daa.com.au> wins
  for paying attention.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@834 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 15:48:48 +00:00
cmpilato
0f09f6c241 Templatize the annotate view!
* viewcvs/lib/viewcvs.py
  (view_annotate): Now use blame.BlameSource() class for doing annotations.

* viewcvs/lib/blame.py
  (BlameSource, BlameSequencingError): New classes.
  (make_html): Re-work to use the use BlameSource code.

* viewcvs/lib/config.py
  (Config.set_defaults): No longer set self.templates.footer.

* viewcvs/viewcvs.conf.dist
  (templates.footer): Removed.

* viewcvs/templates/annotate.ezt
  Re-work this template to make use of the newly exposed blame data,
  and the fabulous new EZT assignment commands!

* viewcvs/website/upgrading.html
  Document this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@833 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 05:08:12 +00:00
cmpilato
9c5c43b625 Implement an assignment mechanism in EZT, a new [define variable][end]
construct.  Patch by James Henstridge <james@daa.com.au>, tweaked to
conform with Greg Stein's review, and stripped of the template changes
that made use of the new functionality by C. Michael Pilato (that's me).

* viewcvs/lib/ezt.py
  import cStringIO, and failing that, import StringIO.
  (_block_cmd_specs): Add 'define' to the list of block specs.
  (Template.generate): Init defines member.
  (Template._parse): Don't prepare references for 'define' commands.
  (Template._cmd_define): New.
  (_get_value): Look for items in the defines dictionary before
    falling back to the data dictionary.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@832 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 03:41:34 +00:00
cmpilato
5bd3435a05 Fix the default value for the footer template location. Patch by James
Henstridge <james@daa.com.au>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@831 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 03:11:03 +00:00
cmpilato
a8c5db6248 Templatize the markup view.
* viewcvs/lib/viewcvs.py
  (html_footer): Remove.
  (view_annotate): Generate the footer data -- the only remaining
    place where template usage is impure...
  (retry_read): New.
  (copy_stream): Rename 'fp' to 'src', and add an optional 'dst'
    parameter.  Move reading code into retry_read().
  (markup_stream_default, markup_stream_enscript): Remove.
  (markup_stream_python): Return a MarkupBuffer instance.
  (markup_stream_python): Return a MarkupPHP instance.
  (MarkupBuffer, MarkupPipeWrapper, MarkupEnscript, MarkupPHP): New
    classes for implementing file-like markup objects.
  (view_markup): Use new Markup classes.
  (generate_tarball): Don't trap an unused status code.

* viewcvs/templates/markup.ezt
  Reference the new [markup] dictionary object, and include the footer.ezt.

* viewcvs/templates/include/header.ezt
  White background, please.

* viewcvs/website/upgrading.html
  Note the new [markup] variable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@830 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 16:40:12 +00:00
cmpilato
d103342f27 * viewcvs/viewcvs.conf.dist
(options.cross_copies): Make this default to 1 now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@829 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 14:41:35 +00:00
cmpilato
fed9fcc893 Extend Sink and parsers to pass more of rcs admin data. Patch by
Erik Huelsmann <e.huelsmann@gmx.net>.

* viewcvs/lib/vclib/ccvs/rcsparse/common.py
  (Sink.set_expansion): New member function. Called to pass
   default expansion mode.
  (Sink.set_locking): New member function. Function is called
   to signal strict locking.
  (Sink.set_locker): New member function. Set locker for a given revision.
  (_Parser.parse_rcs_admin): parse 'access', 'expand', 'locks' and
   'strict' token values passing the result(s) into the sink.

* viewcvs/lib/vclib/ccvs/rcsparse/default.py
  (Parser.parse_rcs_admin): parse 'access', 'expand', 'locks' and
   'strict' token values passing the result(s) into the sink.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@828 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 14:32:54 +00:00
cmpilato
a1aa2423d3 Stop potential memory leak by DECREF-ing the return value from
PyObject_CallMethod.  Patch by Erik Huelsmann <wiskid@gmx.net>.

* viewcvs/tparse/tparsemodule.cpp
  Catch return value from PyObject_CallMethod and DECREF when appropriate.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@827 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 14:28:15 +00:00
cmpilato
f2c4a87740 * viewcvs/viewcvs.conf.dist
(footer): Update the default location for footer.ezt (now in the
    include/ subdir).

* viewcvs/website/upgrading.html
  Add a note about rearranged template locations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@826 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 21:23:02 +00:00
cmpilato
cf04879462 Oops! Missed an update of a relocated template.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@825 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 20:37:59 +00:00
cmpilato
ba43e61754 Re-arrange the templates directory a bit.
* viewcvs/templates/dir_footer.ezt
* viewcvs/templates/dir_header.ezt
* viewcvs/templates/footer.ezt
* viewcvs/templates/header.ezt
  Move all of these...

* viewcvs/templates/include/dir_footer.ezt
* viewcvs/templates/include/dir_header.ezt
* viewcvs/templates/include/footer.ezt
* viewcvs/templates/include/header.ezt
  ...to here.

* viewcvs/templates/annotate.ezt
* viewcvs/templates/diff.ezt
* viewcvs/templates/dir_alternate.ezt
* viewcvs/templates/directory.ezt
* viewcvs/templates/graph.ezt
* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
* viewcvs/templates/markup.ezt
* viewcvs/templates/query.ezt
  And then update the [include] items in these files to note the new
  locations of the aforementioned relocated templates.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@824 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 05:57:57 +00:00
cmpilato
1b8e7c9aa5 Do some work to expose Subversion directory commit info (logs,
revision, authors), cleanup some unnecessary data dictionary cruft,
and rework the default directory templates a bit.

* viewcvs/lib/viewcvs.py
  (view_directory): Do the Right Thing for Subversion directory log
    messages.  Merge the 'cvs' and 'state' data fields for CVS.
    Populate rev_href for Subversion directories.

* viewcvs/templates/directory.ezt
* viewcvs/templates/dir_alternate.ezt
  Track data dictionary changes, and tweak the templates to always
  show name, rev, author, date -- now only log is conditional on
  show_logs (go figure).  Also, core the common header and footer
  parts of these files into...

* viewcvs/templates/dir_header.ezt
* viewcvs/templates/dir_footer.ezt
  ...these new include files.

* viewcvs/website/upgrading.html
  Update with notations about these changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@823 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 05:27:55 +00:00
cmpilato
f9b6bd3f05 Some tarball-generation fixes. Thanks to Ulrich Goertz <debian@g0ertz.de>
for whipping me into action.

* viewcvs/lib/viewcvs.py
  (_strip_suffix): If the "suffix" is the whole last path component,
    remove that component altogether (rather than leaving an
    empty-string component after the strip)
  (generate_tarball): Include timestamps for directories now.  For
    CVS, directory timestamps will be the youngest of the dates for
    files in that directory.  For Subversion, same routine except that
    files and subdirs datestamps count.
  (download_tarball): Don't include in a tarball all the empty
    directories between the root of the repository at the directory
    being tarballed.  Just stick the tarballed directory into the top
    of the tarball, either by its own name (if we know it) or by the
    configured name of that repository root (if the top-most directory
    is the to-be-tarballed directory).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@822 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-13 21:59:52 +00:00
cmpilato
f0ae4c61f9 Fix some line-length > 80 columnsness.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@821 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-13 21:59:24 +00:00
cmpilato
04426fdf30 * viewcvs/tparse/tparse.cpp
* viewcvs/tparse/tparse.h
* viewcvs/tparse/tparsemodule.cpp
* viewcvs/tparse/tparsemodule.h
  Massive tparse reindenting, reformatting, and spacing /
  capitalization fixes in messages.  Patch by Max Bowsher
  <maxb@ukf.net> (tweaked a little by cmpilato to ensure lines < 80
  characters).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@820 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-06 02:52:08 +00:00
cmpilato
aa65061e43 * viewcvs/lib/viewcvs.py
(Request.run_viewcvs): Look in the Attic/ for files in CVS URLs, and
    redirect on a 'hit'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@819 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-31 21:56:22 +00:00
cmpilato
8b230d035a Patch by Max Bowsher <maxb@ukf.net> and Erik Huelsmann <e.huelsmann@gmx.net>.
* tparse/tparse.cpp
  (TokenParser::get): Write one less byte in case of
    @-sign-is-last-byte-in-buffer: the byte will be transferred to the
    start of the newly filled buffer.
  (tparseParser::parse_rcs_tree): Use correct pointer when
    constructing linked list.

* tparse/tparsemodule.cpp
  (PythonSink::define_revision): Don't leak PyString objects.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@818 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-30 14:21:25 +00:00
cmpilato
e2e32dcc0d Fix some memory leaks in the TParse code. Patch by Erik Huelsmann
<e.huelsmann@gmx.net>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@817 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-29 15:59:17 +00:00
cmpilato
a5cf1fe9c9 * viewcvs/lib/viewcvs.py
(view_revision_svn): Fix a missing assignment that rendered a call
    to html_time() rather pointless.  Noticed by Lele Gaifax.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@816 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-27 20:25:54 +00:00
cmpilato
f948f2db3f Get 'forbidden' module support mostly working for Subversion.
* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Move the forbidden path check until after a
    root-as-url-component redirect.
  (view_directory): Break out the forbidden path
    check so that Subversion and CVS paths get checked.
  (generate_tarball): Break out the forbidden path
    check so that Subversion and CVS paths get checked.  Also, fix
    usage of an uninstantiated variable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@815 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-26 14:59:32 +00:00
cmpilato
56a4d4652b * lib/vclib/ccvs/rcsparse/common.py
(_Parser.parse_rcs_tree): Add notation about spec violation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@814 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-18 20:45:33 +00:00
cmpilato
8a38080b25 * viewcvs/lib/vclib/svn/__init__.py
(_unparse_action): Remove this unused function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@813 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-18 20:41:09 +00:00
cmpilato
1bfa20c8be * viewcvs/lib/vclib/ccvs/rcsparse/common.py
(_Parser.parse_rcs_tree): Support author which contain spaces.  It's
    a Windows CVS thing ... *shrug*.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@812 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-15 20:39:43 +00:00
cmpilato
8a8a587963 Subversion revisions might not have dates attached to them, and
ViewCVS assume otherwise.  Fix that (as best as can be expected).

Bug reported by Alejandro Ramirez <alejandro.ramirez@artmediacompany.com>.

* viewcvs/lib/vclib/svn/__init__.py
  (_datestr_to_date): Protect against None datestrings by return "now"
    when there's no valid to use.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (_datestr_to_date): New (copied from the 'svn' module).
  (LastHistoryCollector._log_cb, get_logs): Use new _datestr_to_date()

* viewcvs/lib/viewcvs.py
  (view_markup, view_directory, view_log, view_revision_svn,
   view_diff, make_time_string): Watch out for missing dates.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@811 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-10 15:54:53 +00:00
cmpilato
b3e22e74e2 * viewcvs/lib/vclib/svn/__init__.py
(SubversionRepository.__init__): Carefully track how stuff is
    initialized so the __del__() method doesn't do bad stuff.
  (SubversionRepository.__del__): Only de-init stuff that got init-ed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@810 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-09 16:26:16 +00:00
cmpilato
0b91db3a1b * viewcvs/lib/viewcvs.py
(view_log): Initialize the entry.branch_point and entry.next_main
    values to None, common to all VC systems.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@809 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-09 16:25:54 +00:00
cmpilato
ea1274a8b8 Fix markup-view <img> source URLs to contain the revision of the
resource.  Reported by Roland Schwingel <Roland.Schwingel@onevision.de>.

* viewcvs/lib/viewcvs.py
  (view_markup): Add the revision to the URL for image-type markup views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@808 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-08 16:49:37 +00:00
cmpilato
fe97494fd0 Fix copyfrom links in the Subversion log view.
Patch mostly by Eike Bernhardt <eike-usenet@unorganized.net>.

* viewcvs/lib/viewcvs.py
  (Request.get_link): Don't lose the rev= parameter when building
    log-view URLs.
  (view_log): Include the copyfrom revision in the copyfrom URL.

* viewcvs/templates/log_table.ezt
* viewcvs/templates/log.ezt
  Don't tack on a revision bookmark to the copyfrom URL.  It's not
  likely to exist, and is now unnecessary anyway.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@807 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-08 16:41:37 +00:00
cmpilato
d57c96259e * viewcvs/lib/ezt.py
Import LongType from types, too.
  (_get_value): Handle conversion of LongType as well.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@806 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-02-20 18:20:59 +00:00
cmpilato
68bd35d7e1 * viewcvs/lib/viewcvs.py
(view_log): Populate the 'copy_rev' member.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@805 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-02-17 15:58:16 +00:00
cmpilato
1fc3dcf7a4 * lib/viewcvs.py
(_re_validate_number): Add '~' as an acceptable character in a CVS
    symbol.  CVS, after all, does allow such things.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@804 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-02-06 19:17:04 +00:00
cmpilato
5f5d0140de * viewcvs/lib/vclib/bincvs/__init__.py
(_parse_co_header): Stop using variables that don't exist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@803 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-29 16:07:18 +00:00
rey4
3690e0b386 Fix problem with cvsdb and bincvs.fetch_log
* lib/vclib/bincvs/__init__.py
  (fetch_log):
    fix arg list

* lib/rlog.py
  (GetRLogData)
    take repository object as argument instead of cfg object

* lib/cvsdb.py
  (GetCommitListFromRCSFile):
    take repository object as argument instead of repository path

* tools/cvsdbadmin
  (CommandUpdate, CommandRebuild)
    create BinCVSRepository objects to pass to cvsdb functions

* tools/loginfo-handler
  (CommitFromFileData, GetUnrecordedCommitList)
    take repository object as arguments instead of repository path

  (ProcessLoginfo)
    create BinCVSRepository objects to pass to cvsdb functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@802 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-26 01:25:47 +00:00
rey4
f9cdf6b8ca Fix bug in svn_ra module
* lib/vclib/svn_ra/__init__.py
  (fetch_log):
    fix date conversion


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@801 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 23:09:59 +00:00
rey4
b5ffa5d06c Fix another bug in CVSNT workaround
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    fix _file_log call


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@800 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 22:58:41 +00:00
rey4
b01c037437 Get svn_ra module working again
* lib\vclib\svn_ra\__init__.py
  (created_rev):
    new function

  (LogEntry):
    removed

  (fetch_log):
    create Revision objects instead of LogEntries, and simplify return
    value

  (get_logs):
    set DirEntry.log_error property

  (SubversionRepository.listdir):
    add options argument to match rest of vclib library

  (SubversionRepository.dirlogs, filelog):
    add new vclib methods


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@799 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:29:00 +00:00
rey4
b826424b50 Get ccvs module in working state, and add "use_rcsparse" option to use
it instead of bincvs. It works for log pages, directory pages, markup
pages, checkouts, and tarball downloads, but not for diffs because vclib
doesn't currently have an interface for diffing.

* viewcvs.conf.dist
  (use_rcsparse):
    new option

* lib/config.py
  (Config.set_defaults):
    make use_rcsparse off by default

* lib/viewcvs.py
  (Request.run_viewcvs)
    import ccvs module instead of bincvs if use_rcsparse is enabled

  (markup_stream_enscript):
    check for eof() method on file objects before calling

* lib/vclib/bincvs/__init__.py
  (CVSRepository, BinCVSRepository):
    separate new base class CVSRepository out of BinCVSRepository.
    The new base class is shared with the ccvs module

  (BinCVSRepository.filelog, _file_log):
    move calls to rcs utilities out of _file_log() function and into the
    filelog() method. This way _file_log() can be shared with the ccvs
    module

  (Revision.__init__):
    add default argument values to simplify some calls in the ccvs module

  (_get_logs, _log_path):
    move some functionality out of _get_logs() into new _log_path()
    function, which is shared with ccvs

* lib/vclib/ccvs/__init__.py
  Lots of kludges added to this module to get it running again and taking
  advantage of functionality already implemented in bincvs. It's not
  pretty, but at least it works and is no longer out of date.

  (CCVSRepository, CVSRepository):
    delete old CVSRepository class, create new CCVSRepository class
    implementing the current vclib api

  (MatchingSink):
    new sink superclass

  (InfoSink):
    updated to work with tags and default branches instead of always
    finding latest trunk revisions. Also changed to work with DirEntry
    objects

  (TreeSink):
    updated to work with Revision objects

  (StreamText.next_revision, StreamText):
    remove "next_revision" debugging method and all references to it

  (COSink):
    reimplement with a simpler algorithm

* lib/vclib/ccvs/rcsparse/common.py
  (Sink.admin_completed):
    new callback

  (_Parser.parse):
    call new callback


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@798 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:25:30 +00:00
rey4
c78051dd63 Put underscores in names of internal bincvs functions
* lib/vclib/bincvs/__init__.py
  (lots of functions)
    rename


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@797 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:06:53 +00:00
rey4
0ed400de63 Tweak vclib DirEntry and Revision objects.
- Revision class is now defined in vclib
- DirEntry class has new log_error boolean member to replace use of
  bincvs._FILE_HAD_ERROR constant.
- In CVS, DirEntry.state string member is replaced by boolean DirEntry.dead

* lib/vclib/__init__.py
  (Repository.dirlogs):
    add documentation

  (Revision):
    new class

* lib/vclib/bincvs/__init__.py
  (Revision):
    inherit from new vclib.Revision class

  (get_logs, _FILE_HAD_ERROR):
    stop using _FILE_HAD_ERROR constant

  (parse_log_entry, get_logs):
    use "dead" properties instead of "state" properties on Revision and
    DirEntry objects

  (_newest_file):
    bugfix, call _check_path() to make sure returned file is accessible

* lib/rlog.py
  (GetRLogData):
    use Revision.dead member instead of Revision.state

* lib/vclib/svn/__init__.py
  (Revision, LogEntry):
    rename LogEntry class to Revision and inherit from vclib.Revision

  (NodeHistory.add_history):
    trim beginning slashes from subversion paths passed to this callback

  (_log_helper):
    call new Revision constructor

  (fetch_log):
    simplify return values

  (get_logs):
    set DirEntry.log_error member

  (SubversionRepository.filelog):
    update for changed fetch_log function, remove some kludges

* lib/viewcvs.py
  (Request.run_viewcvs, bincvs):
    import bincvs module as neccessary instead of importing globally

  (view_markup, sort_file_data, view_directory, view_log,
   generate_tarball):
    update to deal with changed DirEntry and Revision members


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@796 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:05:08 +00:00
rey4
3623c5476b Add new repository methods to vclib.
* lib/vclib/__init__.py
  (Repository):
    update docstrings

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.listdir):
    add options argument

  (BinCVSRepository.openfile):
    fix bug in cvsnt workaround

  (BinCVSRepository.dirlogs, BinCVSRepository.filelog):
    new methods

  (_sort_tags):
    removed

  (get_logs):
    simplify arguments and return value

* lib/vclib/svn/__init__.py
  (SubversionRepository.listdir):
    add options argument

  (SubversionRepository.dirlogs, SubversionRepository.filelog):
    new methods

* lib/viewcvs.py
  (view_markup, view_log):
    use new repos.filelog() method

  (icmp):
    new function

  (view_directory, generate_tarball):
    use new repos.dirlogs() method

  (read_log):
    removed

  (download_tarball):
    update call to generate_tarball


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@795 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 18:37:42 +00:00
rey4
b8f73030d6 Merge generate_tarball_cvs and generate_tarball_svn functions.
* lib/viewcvs.py
  (generate_tarball, generate_tarball_cvs, generate_tarball_svn):
    combine svn and cvs functions into a new function

  (download_tarball):
    call new generate_tarball function

* lib/vclib/svn/__init__.py
  (StreamPipe.read):
    support calls that don't specify length


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@794 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 04:53:09 +00:00
rey4
8b7b732983 Refactoring and rearranging in the bincvs module.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository, DirEntry):
    move these class definitions to top of file

  (rcs_popen, BinCVSRepository.rcs_popen):
    make standalone rcs_popen function into a repository method

  (BinCVSRepository._newest_file, _newest_file):
    make _newest_file method into standalone function

  (path_ends_in):
    move to bottom of file

  (BinCVSRepository.openfile, file_log, get_logs, fetch_log):
    update calls to rcs_popen, _newest_file

* lib/viewcvs.py
  (view_diff, generate_tarball_cvs(out):
    update calls to rcs_popen


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@793 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 03:46:30 +00:00
rey4
5154ff3d3e Some refactoring in BinCVS module.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile, parse_co_header):
    move co parsing code out of openfile and into new parse_co_header
    function

  (BinCVSRepository._getrcsname, BinCVSRepository.itemtype):
    remove _getrcsname() method, replace call in itemtype()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@792 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 02:49:44 +00:00
rey4
9ec0064115 Simplify CVSNT workaround in BinCVSRepository.openfile using new file_log
function.

* lib/vclib/bincvs/__init__.py
  (Revision.__init__):
    add new "dead" boolean member. it would be nice to start using this in
    the other parts of the code instead of the "state" string member

  (match_revs_tags):
    set new "undead" properties pointing to previous non-dead revisions

  (file_log):
    bugfix, had been using invalid exception type

  (BinCVSRepository.openfile):
    reimplement CVSNT workaround in terms of file_log()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@791 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 02:20:24 +00:00
rey4
3fa077ff75 Move bulk of read_log function out of viewcvs.py and into the bincvs
module.

* lib/vclib/bincvs/__init__.py
  (file_log):
    new function mostly made up of code cut from read_log

* lib/viewcvs.py
  (read_log):
    call file_log function

  (view_markup, view_log):
    update calls to read_log


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@790 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 01:48:59 +00:00
rey4
ac551b0fa9 fix broken link on subversion log page
* lib/viewcvs.py
  (view_log):
    fix links to revision pages


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@789 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 22:56:09 +00:00
rey4
05888638d0 Make view/download links on log and markup pages simpler and more uniform.
I didn't like a number of things about previous interface, like how it:
 - inconsistently made some links pop up and others open in the same window
 - used inconsistent terminology, "view" links lead to markup pages in some
   cases and direct downloads in others
 - omitted useful links, there were no direct download links for images and
   no markup or "as text" links for "nonviewable" files (like text files
   that ending in .doc)
 - inserted extraneous punctuation, in lines like
   "Revision 1.1 - , (view/download)"

There's some more information about this change posted on the dev list:
http://mailman.lyra.org/pipermail/viewcvs-dev/2004-January/001337.html


* lib/viewcvs.py:
  (view_markup, view_log):
    set new template variables that have the same names and functions on
    all pages: "view_href", "download_href", and "download_text_href"

* templates/log.ezt
* templates/log_table.ezt
* templates/include/branch.ezt
* templates/markup.ezt
    use new template variables and get rid of pop-up links

* templates/dir_alternate.ezt
* templates/directory.ezt
    get rid of pop-up links

* website/upgrading.html
    describe changed variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@788 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 22:50:26 +00:00
rey4
3d9843aba9 Remove duplicate code from CVS and Subversion implementations of view_log
* lib/viewcvs.py
  (augment_entry, view_log_cvs, view_log_svn):
    removed

  (view_log)
    add functionality from removed functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@787 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 05:25:31 +00:00
rey4
e5588cbba1 Move all the code that manipulates CVS revision numbers out of viewcvs.py
and into the bincvs module, unfortunately rewriting most of it in the
process. I thought I finished this before, but some code in view_markup and
augment_entry slipped below my radar.

The main difference between the new code and the old code is that the old
code used string representations of revision numbers and manipulated them
with string operations and regular expressions while the new code converts
all revision numbers into tuples of integers and manipulates them in that
form.

This change also restores some minor ViewCVS 0.9.2 behaviors that I
inadvertently changed before:

- "Branch" fields on log pages list "MAIN" tags instead of skipping them
- The "Default branch" field on the top of log pages lists all names for a
  default branch instead of picking one randomly
- Viewing a directory with "only_with_tag=HEAD" shows default branch
  revisions, not just trunk revisions

* lib/vclib/bincvs/__init__.py
  (LogEntry, LogHeader, LogError, TagInfo):
    removed classes

  (Revision):
    new class, replaces LogEntry

  (Tag):
    new class, replaces TagInfo

  (match_rev_tags, add_tag, remove_tag):
    new functions for manipulating revisions and tags

  (_revision_tuple, _tag_tuple, _dict_list_add):
    new internal functions

  (parse_log_header):
    return multiple values directly instead of packing them into a
    LogHeader object

  (parse_log_entry, _sort_tags, BinCVSRepository.openfile):
    use Revision and Tag classes instead of LogEntry and TagInfo classes

  (get_logs):
    fix handling of HEAD tag

  (fetch_log):
    stop returning "head" field from rlog, it's not useful for anything

* lib/viewcvs.py
  (prep_tags, logsort_date_cmp, logsort_rev_cmp)
    tweaked to work with bincvs.Tag and bincvs.Revision objects

  (find_first_rev):
    removed

  (view_markup, augment_entry):
    change to deal with Revision and Tag objects, remove some revision
    number computation

  (read_log):
    don't do revision/tag matching here, instead call match_revs_tags
    update filtering code and some comments

  (view_log_cvs):
    fix default branch code to display all known branch names

* lib/rlog.py
  (GetRLogData):
    update for changed bincvs.fetch_log


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@786 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 00:50:17 +00:00
cmpilato
b69d1b42fe * lib/viewcvs.py
(view_directory): Check "file.log is not None" instead of just
    "file.log".  This is one aspect of Python I find a bit stupid.
    Also, don't build cvsgraph href's for Subversion views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@785 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-20 19:34:36 +00:00
cmpilato
fdafc736d1 * lib/vclib/svn/__init__.py
(created_rev): New.

* lib/viewcvs.py
  (view_directory): Set 'tree_rev' to the results of created_rev()
    called on the current directory.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@784 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-19 21:42:33 +00:00
cmpilato
403d5c8f73 * viewcvs/lib/viewcvs.py
(view_diff): Catch Subversion FS_NOT_FOUND errors from
    diffobj.get_pipe() so we can return a '400 Bad Request'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@783 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-12 10:39:10 +00:00
rey4
fd97298424 Fix bug #858414 "ValueError: unconverted data remains: 'UTC'" reported
by Jordan Russell

* lib/compat.py
  (cvs_strptime):
    stop trying to pass time zone information to strptime. Apparently
    the glibc implementation of this function doesn't support it.
    Instead just replace the returned is_dst value with 0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@782 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-12 00:22:35 +00:00
rey4
c4d2c8e0a8 Minor fix in link constructing function. Doesn't have any effects
currently visible to users

* lib/viewcvs.py
  (Request.get_link):
    prevent tarball links from having their 'only_with_tag' parameters
    overwritten with the current sticky value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@781 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-11 00:38:39 +00:00
rey4
0d905fe2d0 Temporary workaround for another CVSNT bug. The problem was reported
in issue #829519 "Viewing removed file causes pyhton exception" by
Hartmut Honisch.

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    work around cvsnt's co not producing any output when we request
    a dead revision


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@780 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-11 00:18:20 +00:00
rey4
6fccdc0195 Fix bug #849834 "Download tarball doesn't respect tag selected"
reported by Aaron Linville.

* lib/viewcvs.py
  (Request.get_link):
    add "only_with_tag" parameters to tarball download links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@779 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 12:21:53 +00:00
rey4
22a713c5d6 Fix bug #845957 "exception when viewing a revision without log"
reported by Hernan Martinez Foffani.

* lib/viewcvs.py
  (view_markup):
    set default value for "tag" template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@778 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 12:12:20 +00:00
rey4
d7d0a03ecc Fixed bug #844810 reported by Jordan Russell. It was caused by my recent
tinkering in the get_logs() function. I made the incorrect assumption
that rcs files used branch numbers with 0's in them (like 1.2.0.3) when
no changes had yet been made on the branch, and branch numbers without
0's like (1.2.3) for branches that did contain changes. But this appears
to have been based on an optional convention that not all cvs versions
follow. The assumption was only used to avoid some unneccessary iterations
of a while loop and the code is actually a little simpler without it.

* lib/vclib/bincvs/__init__.py

  (TagInfo.__init__):
    remove _zero_branch member

  (TagInfo.matches_rev):
    stop using _zero_branch value. the behavior of the this method
    is now different than before

  (get_logs):
    fix to work with new matches_rev definition

* lib/viewcvs.py
  (read_log):
    simplify an if statement using tag.holds_rev()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@777 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 11:50:44 +00:00
rey4
e891a6f0ca Remove workaround for Mod_Python bug fixed in new version 3.0.4
* lib/sapi.py:
  (ModPythonServer.getenv):
    Farewell SCRIPT_NAME bug, we hardly knew ye.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@776 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 07:53:42 +00:00
rey4
99a59b5032 Ahhh, the joys of using an interpreted language...
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    Fix errors in a raise statement


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@775 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 07:48:11 +00:00
rey4
4ddb87c838 Fix DST issue, bug #800741. Thanks to James Conley for the bug report and to
Anthon van der Neut for the patch.

* lib/compat.py
  (cvs_strptime):
    explicitly specify UTC time zone in the strptime function call
    that parses timestamps produced by RCS utilities. This causes
    the "isdst" field of the returned time tuple to be set to "0"
    instead of "-1", meaning "no" instead of "maybe."


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@774 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 06:07:36 +00:00
cmpilato
f95418732a * viewcvs/lib/vclib/svn/__init__.py
(LogEntry.__init__, get_logs): Use string representations of
    Subversion revisions here (for consistency with CVS).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@773 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-02 00:47:29 +00:00
rey4
ed885369ff update windows readme
* windows/README:
    add some subversion information and update known issues section


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@772 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-11-04 04:54:28 +00:00
rey4
3255fef447 Improve rlog error handling
* lib/vclib/bincvs/__init__.py:
  (parse_log_header):
    separate line numbers from file names in rlog error messages, also
    try to deal with missing "rlog: " prefixes in rlog error messages

  (get_logs):
    recover gracefully when rlog has a fatal parsing error and skips
    remaining files


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@771 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-11-04 04:52:08 +00:00
cmpilato
dbe55837bb * viewcvs/lib/ezt.py
Remove HTML-speak throughout.  This module is quite useful for much
  more than just HTML.  Also:
  (Template.__init__): Add 'compress_whitespace' parameter (defaulting
    to 1) to control whether or not runs of whitespace are compressed.
  (Template._parse): Only compress whitespace if the
    compress_whitespace variable is non-zero.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@770 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-29 02:01:37 +00:00
rey4
b63ed80ac7 * viewcvs.conf.dist
(php_exe_path):
    add another example path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@769 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-28 01:52:25 +00:00
rey4
755f7ac666 Update php colorizing code.
* viewcvs.conf.dist
  (use_php, php_exe_path):
    new options for php highlighting

* lib/config.py
  (Config.set_defaults):
    set defaults for new options

* lib/viewcvs.py
  (markup_stream_php):
    use new php option, and colorize using php's -s argument instead
    of invoking the php interpreter, building a big string and
    calling highlight_string()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@768 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-28 01:46:59 +00:00
rey4
c4f253f187 Check for execute permission on directories in _check_path. This is
another fix suggested by Anthon van der Neut in bug #817757

* lib/vclib/bincvs/__init__.py
  (_check_path):
    check for execute permission on directories when we fall back to
    os.access()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@767 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 19:46:31 +00:00
rey4
6f4440191e Fix bug #817757, "unaccessible directories displayed" submitted by
Anthon van der Neut using the fix that he suggested. This change
also seems to fix another bug, #509961

* lib/vclib/bincvs/__init__.py
  (_check_path):
    fix check of os.access() return value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@766 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 19:30:52 +00:00
rey4
7994db2d37 fix improperly escaped urls on query page, bug #529888 reported
by Franz H�pfinger.

* lib/query.py
  (build_commit)
    add call to urllib.quote


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@765 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 17:47:30 +00:00
rey4
055799e9f9 another change to make query page work from source directory
without installation

* lib/cvsdb.py
    fix path to viewcvs.conf


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@764 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 17:34:34 +00:00
rey4
e27958e70a make query page work straight from the source directory without
installation

* www/cgi/query.cgi
    fix path to lib directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@763 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 17:28:30 +00:00
gstein
4c82431592 Simplify some boolean ezt data values.
* lib/viewcvs.py:
  (view_markup): replace ezt.boolean(0) with None
  (view_directory): replace some Python ternary idioms (yuck) with a call
    to ezt.boolean() which does the nifty magic for us anyways.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@762 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 06:40:46 +00:00
rey4
c611d05862 * lib/viewcvs.py
(sort_file_data):
    fix sorting by name for files with no revision info


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@761 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 04:24:37 +00:00
rey4
e4d2fd765d * lib/viewcvs.py
(Request.get_link):
    remove trailing slashes from revision page links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@760 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 23:48:19 +00:00
rey4
3f2d834184 add forward.gif and back.gif to apache_icons.py. these icons are used
by the new subversion revision page

* tools/bin2inline_py.py:
   added two new icons

* lib/apache_icons.py:
    regenerated


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@759 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 23:44:49 +00:00
rey4
52a55617da Rearrange view_directory function, moving logic to the top and template
filling code to the bottom. Add a few comments too.

* lib/viewcvs.py
  (view_directory):
    move some code around


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@758 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 22:57:30 +00:00
rey4
8f92ee55ab Merge view_directory_cvs and view_directory_svn functions. Had to add
a lot of kludgy request.roottype == 'cvs' checks, but at least this
way there's a lot less duplicate code.

* viewcvs.py
  (view_directory_cvs, view_directory_svn):
    removed, code moved into view_directory

  (view_directory):
    no longer calls view_directory_cvs and view_directory_svn


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@757 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 22:08:47 +00:00
rey4
f1057adb51 * website/upgrading.html
update for new template changes


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@756 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 04:40:43 +00:00
rey4
a478890739 Restore "this entry is unreadable" error messages that got mistakenly
suppressed in revision 1.205 of viewcvs.py.

* lib/viewcvs.py:
  (view_directory_cvs):
    stop skipping unreadable rows. also simplify row.name initialization
    by omitting trailing slashes for directory names

  (view_directory_svn):
    omit trailing slashes from directory names

* templates/directory.ezt
* templates/dir_alternate.ezt
    add trailing slashes to directory names


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@755 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 04:17:06 +00:00
rey4
a34029940f Move cvs tag sorting code out of view_directory_cvs and into vclib.
* lib/vclib/bincvs/__init__.py
  (_sort_tags):
    new function to alltags dictionary

  (get_logs):
    assign found tags to repos object instead of returning
    alltags dictionary

* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
  (get_logs):
    stop returning alltags dictionary

* lib/viewcvs.py
  (view_directory_cvs, view_directory_svn):
    updated to work with changed get_logs functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@754 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 03:33:47 +00:00
rey4
d11e6490ba Simplify some logic in view_directory_cvs. Except for the num_files
count (which was incorrect before), the new code should be equivalent
to the old code.

* lib/viewcvs.py
  (view_directory_cvs):
    simplify some parts, mainly by grouping together assignments of
    row properties


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@753 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 02:54:48 +00:00
cmpilato
551a38195c * viewcvs/lib/viewcvs.py
(view_revision_svn): Calculate links to the previous and next
    revisions, as well as a jump-box for whatever revision you so
    desire.

* viewcvs/templates/revision.ezt
  Add UI for navigating to previous and next revisions, for jumping to
  any particular revision you like.

* viewcvs/lib/vclib/svn/__init__.py
  (date_from_rev, fetch_log): Stop recalculating the youngest rev.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@752 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 19:27:02 +00:00
rey4
6aab83621c * lib/vclib/bincvs/__init__.py
(BinCVSRepository.openfile):
    fix NameError that occurs when raising an exception


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@751 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 19:06:00 +00:00
cmpilato
1f61819995 Committing some highly experimental code for allowing ViewCVS on one
machine to communicate with Subversion repositories via the Subversion
client bindings -- meaning your Subversion repository can live on an
entirely different computer.  Because of the experimental nature, I'm
leaving this feature undocumented (no remarks about using URLs in
viewcvs.conf.dist, basically).

* viewcvs/lib/vclib/svn_ra/__init__.py
  The new module.

* viewcvs/lib/viewcvs.py
  (_re_rewrite_url): Add a bunch of URL schemas that Subversion
    supports to this regexp.
  (Request.run_viewcvs): If a Subversion repository URL is given as
    the root, use the 'svn_ra' module instead of the direct-access
    'svn' one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@750 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 18:31:27 +00:00
cmpilato
d1f125f837 Rename some not-meant-for-public-consumption functions.
* viewcvs/lib/vclib/svn/__init__.py
  (_fs_path_join): Was fs_path_join.
  (_log_helper): Was log_helper.
  (_get_last_history_rev): Was get_last_history_rev.
  (_get_history): Was get_history.
  (fetch_log): Update calls to _log_helper and _get_history.
  (get_logs): Update calls to _fs_path_join and _get_last_history_rev.
  (SubversionRepository.openfile): Update call to _get_last_history_rev.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@749 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 09:48:32 +00:00
rey4
4b2021fa21 Add optional "list_attic" argument to the bincvs listdir function. Also
fix tarball generation (it was broken by the previous commit)

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.listdir):
    add ability include Attic in returned listing

  (CVSDirEntry):
    new DirEntry subclass with additional "in_attic" member

* lib/viewcvs.py
  (view_directory_cvs):
    update to take advantage of the new listdir functionality

  (generate_tarball_cvs, generate_tarball_svn):
    update for changed listdir() and get_logs() vclib functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@748 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 05:13:38 +00:00
rey4
6e00b5d388 Change get_logs functions to add their information directly to
DirEntry objects instead of returning dictionaries of LogEntry
objects. Also make some tweaks to the code that parses rlog output.

* lib/vclib/bincvs/__init__.py
  (parse_log_header):
    stop stripping ",v" suffixes off of filenames, fix error message
    parser to work with windows paths, assign more sensible default
    field values, and change a comment

  (path_ends_in):
    new function

  (get_logs):
    take list of DirEntries as argument and populate it with data
    instead of returning a separate dictionary, also add some
    extra error checking

* lib/vclib/svn/__init__.py
  (get_logs):
    take list of DirEntries as argument just like in bincvs. also
    remove another unneccessary svn_fs_is_file call

* lib/viewcvs.py:
  (sort_file_data):
    change to use the new DirEntry properties

  (view_directory_cvs, view_directory_svn):
    update to work with changed get_logs functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@747 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 02:52:05 +00:00
rey4
c575c4d821 Factor permissions-checking code out of BinCVSRepository.listdir and into
a new _check_path function. Also take the opportunity to write an alternate
implementation that works correctly on windows.

* lib/vclib/bincvs/__init__.py
  (_check_path):
    added

  (BinCVSRepository.listdir):
    shortened


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@746 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 00:03:48 +00:00
rey4
3fc688319f move get_last_modified() into vclib as BinCVSRepository._newest_file()
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository._newest_file):
    new function, cut and paste of get_last_modified

* lib/viewcvs.py
  (get_last_modified):
    removed

  (view_directory_cvs):
    use repos._newest_file function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@745 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-23 20:36:40 +00:00
uid99421
c0a6d838c6 * templates/revision.ezt:
add the standard page header to the new revision page


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@744 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-23 19:23:26 +00:00
uid99421
2bd228c4ee Moved all string processing of CVS revision numbers into a new class
called TagInfo in an attempt to make tag-matching code more readable.

* lib/vclib/bincvs/__init__.py
  (TagInfo):
    new class

  (get_logs):
    change to use TagInfo

* lib/viewcvs.py
  (find_first_rev):
    new function

  (read_log, view_directory_cvs, view_log_cvs):
    change to use Taginfo and find_first_rev

  (CVSBranch):
    died and reincarnated as TagInfo


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@743 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-23 18:59:06 +00:00
cmpilato
e7be5b1f0a * lib/vclib/svn/__init__.py
(get_revision_info): Update call to RevisionChangeCollector().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@742 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 19:46:28 +00:00
cmpilato
a33f547c1e * viewcvs/lib/viewcvs.py
(view_revision_svn): Oops.  Fix the prev and diff_href calculations.

* viewcvs/templates/revision.ezt
  Fix some logic to always populate the right number of cells.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@741 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 18:35:56 +00:00
cmpilato
9d5d4170f9 More work on the cool new revision view.
* viewcvs/lib/vclib/svn/__init__.py
  (LogEntry.__init__): Remove 'other_paths' parameter and support.
  (ChangedPathEntry): Remove.
  (ChangedPath, get_revision_info): New.
  (log_helper): Don't do changed-path or action stuffs.  Update call
    to LogEntry().
  (get_logs): Update call to LogEntry().

* viewcvs/lib/viewcvs.py
  (view_log_svn): Remove support for 'other_paths' support.
  (view_revision): Move svn-specific stuff to new view_revision_svn()
  (view_revision_svn): New.

* viewcvs/templates/revision.ezt
  Make this template actually do something useful.

* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
  Remove display of "other_paths" from Subversion logs.  Make revision
  numbers into links to the revision view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@740 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 18:23:01 +00:00
rey4
1e0d4e3cff combine get_logs() and process_rlog_output() functions, also trim
trailing whitespace

* lib/vclib/bincvs/__init__.py
  (process_rlog_output, get_logs):
    removed process_rlog_output, moved code into get_logs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@739 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 03:40:07 +00:00
rey4
069265c023 * lib/viewcvs.py
(view_directory, view_directory_cvs, view_directory_svn):
    move some common code in view_directory_cvs and
    view_directory_svn into view_directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@738 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 21:17:29 +00:00
cmpilato
45629a7dde Begin implementing the new 'revision' view.
* viewcvs/lib/viewcvs.py
  (Request.get_link): Add code to generate the new revision info links.
  (view_revision): New.
  (_views): Alphabetically sort the views here, and add the new 'rev' view.

* viewcvs/viewcvs.conf.dist
  (templates.revision): New.

* viewcvs/templates/revision.ezt
  New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@737 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 20:04:30 +00:00
rey4
c1785db585 Remove dead code from vclib.
* lib/vclib/__init__.py
  (Repository.getitem, Repository.getfiles, Repository.getsubdirs,
   Revision, Repository._getvf_files, Repository._getvf_subdirs,
   Versfile, Versdir, Versitem, Repository._getvf_info,
   Repository._getvf_tree, Repository._getvf_properties,
   Repository._getvf_cofile):
    removed

* lib/vclib/svn/__init__.py
  (SubversionRepository.getitem, SubversionRepository._getvf_files,
   SubversionRepository._getvf_subdirs,
   SubversionRepository._getvf_info,
   SubversionRepository._getvf_tree,
   SubversionRepository._getvf_properties,
   SubversionRepository._getvf_cofile):
    removed

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.getitem, BinCVSRepository._getvf_files,
   BinCVSRepository._getvf_subdirs,
   BinCVSRepository._getvf_info,
   BinCVSRepository._getvf_tree,
   BinCVSRepository._getvf_properties,
   BinCVSRepository._getvf_cofile):
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@736 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 19:54:27 +00:00
cmpilato
e367c87dfe * viewcvs/lib/vclib/bincvs/__init__.py
(get_logs): Copy the input 'files' array so we aren't deleting data
    from the passed-in thing.  Caller might want to keep using that
    stuff, ya know?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@735 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 18:58:32 +00:00
rey4
ff2cf94151 * lib/vclib/svn/__init__.py
(SubversionRepository.listdir)
    implement using fs library functions instead of the vclib
    getitem() interface


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@734 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 18:54:23 +00:00
rey4
111a9b823b * lib/viewcvs.py
(generate_tarball_svn):
    use repos.listdir() interface instead of repos.getitem() interface


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@733 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 18:28:55 +00:00
rey4
1dc358fc1d Move get_file_data and get_file_data_svn functions into vclib.
* lib/viewcvs.py
  (DirEntry, get_file_data_svn, get_file_data):
    removed

  (view_directory_cvs, view_directory_svn, generate_tarball_cvs):
    call repos.listdir instead of get_file_data

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.listdir):
    added, cut and paste of get_file_data

* lib/vclib/svn/__init__.py
  (SubversionRepository.listdir)
    added, cut and paste of get_file_data_svn

* lib/vclib/__init__.py
  (DirEntry)
    added, cut and paste

  (Repository.listdir)
    added abstract member function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@732 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 14:35:47 +00:00
rey4
f2cadab08a Store directory listing entries in objects instead of tuples
* lib/viewcvs.py
  (_UNREADABLE_MARKER):
    removed

  (DirEntry):
    new class to replace directory entry tuples

  (get_file_data_svn, get_file_data):
    take repository object and directory path as arguments instead of
    taking the entire Request object. And return DirEntry instances
    instead of tuples

  (get_file_tests):
    removed, code moved into get_file_data

  (get_last_modified, sort_file_data, view_directory_cvs,
   view_directory_svn, search_files, generate_tarball_cvs):
    work with DirEntry instances instead of tuples

  (search_files):
    change the way this is called and remove cvs-specific code so
    subversion listings could potentially have regular expression
    searching

  (download_tarball, generate_tarball_cvs, generate_tarball_svn):
    change the way two recursive parameters are used to make it
    easier to call vclib-style functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@731 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 05:42:12 +00:00
rey4
cfbf622b27 Move the process_checkout function into vclib.
* lib/viewcvs.py
  (process_checkout):
    removed, functionality moved into vclib

  (view_markup, view_checkout, search_files):
    call vclib.Repository.openfile instead of process_checkout

  (Request.run_viewcvs):
    pass rcs path option values to CVS repository constructor

* lib/vclib/__init__.py
  (Repository.openfile):
    new abstract function

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    added

  (BinCVSRepository.__init__):
    added rcs_paths member to hold rcs config values

* lib/vclib/svn/__init__.py
  (SubversionRepository.openfile):
    added

  (get_file_contents):
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@730 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-20 03:53:23 +00:00
rey4
131904872c Stop looking up "action" values for subversion log entries. C. Mike
pointed out that will ultimately allow us to get rid of an inefficient
call to svn_fs_paths_changed().

* lib/vclib/svn/__init__.py
  (LogEntry.__init__, log_helper, get_logs):
    no longer set LogEntry.action member

* templates/log.ezt
* templates/log_table.ezt
    stop trying to read LogEntry.action member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@729 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-17 17:56:44 +00:00
cmpilato
4e5303978a Expose the actions for "other changed paths".
* viewcvs/lib/vclib/svn/__init__.py
  (ChangedPathEntry.__init__): Add 'action' parameter.
  (_unparse_action): New helper (with code previously in log_helper()).
  (log_helper): Now call _unparse_action() to get the action string
    for the path.  But now also call it for the other paths, passing
    the result to the updated ChangedPathEntry.__init__() function.

* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
  Now show the type of change that happened for "the other paths", and
  don't make paths that were deleted into hyperlinks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@728 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-16 14:41:10 +00:00
cmpilato
751b031192 Some pool usage fixes suggested by Greg Stein.
* viewcvs/lib/vclib/svn/__init__.py
  (get_last_history_rev): Add 'pool' argument; use it instead of the
    repository object's pool.
  (get_logs): Make this sucker us an iteration subpool.  Update call
    to get_last_history_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@727 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-16 06:34:52 +00:00
rey4
c7c9807517 Removed show_changed_paths option. It was originally added as a way to
to disable a buggy and inefficient subversion feature. But it's no
longer neccessary with C. Mike's recent improvements to the subversion
module.

* viewcvs.conf.dist
  (show_changed_paths):
    removed option

* lib/config.py
  (Config.set_defaults)
    removed default assignment

* lib/viewcvs.py
  (run_viewcvs):
    stop passing option value to repository object

* lib/vclib/svn/__init__.py
  (log_helper, fetch_log):
    stop passing option value to log_helper function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@726 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 20:33:04 +00:00
rey4
9970242b67 fix some links on log pages
* lib/vclib/svn/__init__.py
  (_trim_path):
    new function to take leading slashes off paths

  (log_helper):
    remove leading slashes from paths that get used by templates


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@725 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 20:12:29 +00:00
cmpilato
603181493b * viewcvs/lib/viewcvs.py
(view_markup): Ensure that the 'prev' data member always exists.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@724 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 19:29:40 +00:00
rey4
c1f7b71c81 get standalone server to work from development tree
* standalone.py
  (global code):
    remove os.chdir() call and set viewcvs.g_install_dir variable so
    the templates and configuration file can be found


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@723 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 17:39:43 +00:00
rey4
e159806814 * lib/viewcvs.py
(handle_config):
    when viewcvs is run without being installed first, look for a
    viewcvs.conf file in the root of tree instead of in the current
    directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@722 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 17:27:17 +00:00
cmpilato
c8bc2d4832 * viewcvs/lib/vclib/svn/__init__.py
(log_helper): Stop skipping over revisions in which the target path
    didn't actually change.  If we decide to re-add this feature, we
    need to do it in viewcvs.py itself (because other code, like
    view_markup(), is depending on getting real values for all
    relevant revisions.
  (get_last_history_rev): New.
  (get_logs): Move this function down in the file, and now call
    get_last_history_rev() instead of fs.node_created_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@721 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 17:24:40 +00:00
cmpilato
9a8d5d115b Whip 'select for diffs', 'diff to previous', and 'diff to selected'
into shape for Subversion.

* viewcvs/lib/viewcvs.py
  (view_log): Grab the path of a version selected for diffs from the
    query data, and stash it in the data dictionary.

* viewcvs/templates/log_table.ezt
* viewcvs/templates/log.ezt
  Fix the 'diff to previous', 'diff to selected', and 'select for
  diff' links for Subversion.  Also, don't display the various "branch
  point" and "next main" diff links for Subversion.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@720 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 16:42:02 +00:00
cmpilato
1ab8cfbd92 Purge semi-colons from the ends of statements (in one case, moving it into a
string constant as an HTML entity terminator.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@719 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-14 15:53:42 +00:00
cmpilato
e83cf53244 * viewcvs/lib/viewcvs.py
(read_log): Word-capitalize the "Tag Not Found" status line.
  (view_diff): Add 400 status to the exceptions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@718 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-14 15:35:23 +00:00
cmpilato
078c625f09 * viewcvs/lib/viewcvs.py
(get_file_data_svn): Use request.full_name, not just full_name,
    since the latter doesn't exist in the scope.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@717 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-13 18:56:20 +00:00
cmpilato
ad3eade9ac * viewcvs/lib/viewcvs.py
(_validate_param): Return "400 Bad Request" when invalid parameters
    are passed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@716 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-13 18:18:01 +00:00
cmpilato
fec722653e * lib/vclib/svn/__init__.py
(NodeHistory): New collector class.
  (get_history): Use svn_repos_history() now instead of directly using
    the fs.history interface.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@715 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-04 22:13:10 +00:00
rey4
22aeba1b38 * templates/log_table.ezt: sync up with log.ezt 1.26
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@714 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-03 22:10:19 +00:00
cmpilato
4f46a705e2 Some fix-em-ups to the new history-using ViewCVS code. Thanks to Greg
Stein and Russell Yanofsky for review and suggestions.

* lib/vclib/svn/__init__.py
  (log_helper): Add 'pool' argument, and use it instead of
    svnrepos.pool for allocations.  Also, calculate the action and
    copy_rev/copy_path fields in the log entries.
  (fetch_log): Use an iteration subpool when looping over history items.

* templates/log.ezt
  Eliminate an unnecessary "if-any" check (since "is" does this work
  for us in this case).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@713 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-30 13:58:44 +00:00
cmpilato
f808704efe * viewcvs/lib/vclib/svn/__init__.py
(log_helper): Populate the 'action' attribute of the LogEntry.

* viewcvs/templates/log.ezt
  Expect human-readable strings for the action type (instead of the
    single-character abbreviations).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@712 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 14:29:07 +00:00
cmpilato
594baf20b8 Mm... Steinian code review is good for the soul. And the project,
too.

* viewcvs/lib/vclib/svn/__init__.py
  (date_from_rev): Remove a semicolon (it's a Python no-no).
  (get_history): Remove an errant space, and take advantage of
    Python's kewl tuple support to avoid a temp variable and simplify
    the read.
  (log_helper): Promote to a "real" function, adding some params and
    returning a real value.
  (fetch_log): Move the sub-function log_helper out.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@711 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 14:13:57 +00:00
cmpilato
7eae388966 Make "diff to previous" for across Subversion copies work.
* viewcvs/lib/viewcvs.py
  (_legal_params): Allow 'p1' and 'p2' query args.
  (view_log_svn): Populate prev_path entry members.
  (view_diff): Handle the 'p1' and 'p2' query string items.  Update
    call to vclib.svn.do_diff().

* viewcvs/templates/log.ezt
  Update "diff to previous" links to include prev_path.

* viewcvs/lib/vclib/svn/__init__.py
  (do_diff): Add (and use) 'path2' argument.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@710 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 02:58:59 +00:00
cmpilato
9632aa3bfc Teach ViewCVS how to follow copy history in Subversion repositories
(optionally, turned off by default).  No diffs across paths yet, but
that's coming soon(ish)!

* viewcvs/lib/vclib/svn/__init__.py
  (LogReceiver): Buh-bye.
  (get_history): New.
  (fetch_log): Use get_history() instead of the svn_repos_get_logs interface.

* viewcvs/lib/config.py
  (Config.set_defaults): Add default for 'cross_copies' option.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Set the 'cross_copies' SubversionRepository
    attribute based on the config option of the same name.

* viewcvs/viewcvs.conf.dist
  (cross_copies): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@709 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 01:34:33 +00:00
gstein
60fbba9322 re-add CGI scripts with exec permission
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@708 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-18 22:18:28 +00:00
gstein
d340b5bfc5 remove these CGI scripts temporarily
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@707 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-18 22:17:50 +00:00
gstein
7183660985 Restore ViewCVS' ability to work straight from the development tree.
* lib/viewcvs.py:
  (g_install_dir): from the CGI, the conf is a couple levels up (now)
    rather than just one.
  (view_directory_cvs): row.name must be set for all row types since it
    will be displayed as part of the error lines. move the assignment
    further up in the file.

* www/cgi/viewcvs.cgi:
  (__main__): the lib is a couple levels up from the CGI (now)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@706 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-18 22:16:04 +00:00
cmpilato
c77b65be9d * templates/dir_alternate.ezt
* templates/directory.ezt
* templates/markup.ezt
* templates/include/branch.ezt
  s/resizeable/resizable/.  This fixes Bug issue #756811.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@705 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-24 05:20:55 +00:00
cmpilato
5e834c47e7 Fix directory templates to properly handle missing graph_href's (like,
for example, which using Subversion).  This fixes #Bugs item #793866,
reported by Timothee Besset.

* templates/dir_alternate.ezt
* templates/directory.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@704 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-24 05:06:41 +00:00
rey4
f6b2ba3649 Fixed bug introduced in rcsdiff_date_reformat by previous commit which
was noticed by Greg Stein <gstein@lyra.org>.

* lib/viewcvs.py (rcs_date_reformat): restored call to make_time_string()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@703 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-22 21:56:31 +00:00
rey4
844a8c1269 fix ValueError exception on diff page
* lib/compat.py (cvs_strptime): make compatibility function throw a
    ValueError when time is not in expected format, so it is more
    like the native function

* lib/viewcvs.py (rcs_date_reformat): catch ValueError exception


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@702 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-22 17:55:39 +00:00
rey4
8e19ed6b2c fix exception when svn root not found
* lib/viewcvs.py: fix misspelled variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@701 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-21 01:45:50 +00:00
rey4
bdc40661f6 fixed mod_python bug reported by David Oxley
<David.Oxley@workplace-systems.plc.uk> on Subversion dev list

* lib/sapi.py (ModPythonServer.getenv): derive SCRIPT_NAME from apache
    request instead of using mod_python's value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@700 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-18 15:01:36 +00:00
rey4
1ce3cc2174 Fixed bug in html form that was reported by John Hall
<john-news1@cambridgetechgroup.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@699 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-10 01:25:44 +00:00
rey4
7296228e72 fixed template variable bug #781130 on query page. reported by Michael
Pechner (mpechner).

* lib/query.py (main): set 'icons' parameter in template data


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@698 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-05 01:02:23 +00:00
rey4
a06053167b fixes for python 1.5 compatibility
* lib/popen.py
    use string functions instead of methods

* lib/viewcvs.py
    use apply() function instead of **arg calling syntax


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@697 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-04 17:42:21 +00:00
rey4
1437a7e4fe prevent exception when use_localtime is set and rcsdiff produces wrongly
formatted dates. Bug reported by zindine <zindine at easynet.fr> who
encountered this using cvsnt's rcsdiff.

* lib/compat.py (cvs_strptime): changed to return None when the date
  doesn't match, instead of throwing an exception

* lib/viewcvs.py (rcsdiff_date_reformat, human_readable_diff): changed
  to display unaltered date string returned by rcsdiff when it can't
  be parsed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@696 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-29 11:09:11 +00:00
rey4
59563e8dfe changed "Running Windows" logo to ViewCVS blimp as suggested by
Bo Berglund <bo.berglund@telia.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@695 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-29 02:59:32 +00:00
rey4
c9fbb0ec71 put cvs_roots and svn_roots on a single line as requested by
Bo Berglund <bo.berglund@telia.com> to help simplify his
windows installer


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@694 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-29 02:57:51 +00:00
rey4
79309e3025 fixed html error
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@693 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-28 23:47:04 +00:00
rey4
66bb812aeb * lib/viewcvs.py (common_template_data): new function to set a few variables
common to all templates

  (Request.__init__): moved icon and docroot initialization into
  common_template_data

  (html_footer, view_directory, view_log, view_markup, view_checkout,
   view_cvsgraph, human_readable_diff): changed to use common_template_data

* templates/dir_alternate.ezt:
  templates/directory.ezt:
  templates/graph.ezt:
  templates/header.ezt:
  templates/log.ezt:
  templates/log_table.ezt:
  templates/query.ezt: renamed docroot and icon variables

* website/upgrading.html: updated description of changed template variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@692 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-25 05:34:11 +00:00
rey4
25bb91db25 fix for bug #509705, Directory view of branch skips files
based on patch from Steve Lamm (slamm)

* lib/vclib/bincvs/__init__.py (parse_log_entry): fixed to work with
  versions of RCS that add extra dashed separator lines


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@691 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 21:53:20 +00:00
rey4
5d4c447dd4 added "icons" and "docroot" options to control the locations of
static files

* viewcvs.conf.dist, lib/config.py: added new options

* templates/dir_alternate.ezt:
* templates/directory.ezt:
* templates/header.ezt:
* templates/log.ezt:
* templates/log_table.ezt:
* templates/query.ezt:
* lib/viewcvs.py (Request.__init__):
  new "request.docroot" and "request.icons" template variables

* standalone.py (serve): standalone server must use default locations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@690 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 20:37:39 +00:00
rey4
5cf473d5a1 enscript "couldn't open input filter" issue happens on windows xp too
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@689 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 19:56:07 +00:00
rey4
cf9aa07cdb fixed docstring
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@688 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 19:53:59 +00:00
rey4
0999369756 changed to exit silently on "cvs import" instead of crashing
* tools/loginfo-handler (HeuristicArgParse, CvsNtArgParse): added tests
  to detect command line parameters ending in "- Imported sources'"

  (debug, warning, error): changed these functions to write to standard out
  instead of standard error


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@687 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 08:48:40 +00:00
rey4
c9dbb2c933 fixed bug #488302, missing tag information
* lib/viewcvs.py (read_log, view_log_cvs, class CVSBranch): rewrote code
  that correlates CVS tags with revisions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@686 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 08:03:25 +00:00
rey4
9009ce845a fixed bug #460835, "Too many connections in cvsdbadmin update"
* lib/cvsdb.py (ConnectDatabase): now returns an existing database
  connection instead of always creating a new one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@685 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 00:26:33 +00:00
cmpilato
dc2b8063ee * viewcvs/lib/config.py
* viewcvs/viewcvs.conf.dist
  Make the 'show_changed_paths' option default to 0.  We should
  generally avoid a policy of checking in code that, by default,
  SEGFAULTs.  Further, showing changed paths in Subversion is a large
  deviation of the manner in which CVS behaves, and I'd like to keep
  the two displaying as similarly as possible in the default setup.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@684 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-22 14:17:38 +00:00
rey4
4c281fc21b Fixed log retrieving code to work correctly when get_changed_paths is
true and a directory containing the file being displayed has been copied

* vclib/svn/__init__.py (LogReceiver.__init__): added a new member
  called "node_id" and changed parameters passed to constructor

  (LogReceiver.receive): now compares each changed file in a revision
  with the file being displayed using file revision identifers rather
  than pathnames. Also removed some leftover debugging code

  (fetch_log): adjusted arguments passed to LogReceiver constructor


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@683 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-11 22:05:41 +00:00
rey4
456ece022a Documented template changes. Should be complete, but needs to be made
more readable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@682 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-09 08:55:49 +00:00
cmpilato
69e5862d59 * viewcvs/lib/viewcvs.py
(markup_stream): Get log message and size display as part of the
    markup output working for Subversion.

* viewcvs/templates/markup.ezt
  Add display of file size for Subversion repositories, and make the
    'changes since' line CVS-only.

* viewcvs/lib/vclib/svn/__init__.py
  (StreamPipe.read, StreamPipe.readline): Don't try to read if EOF
    has been hit.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@681 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-07 14:43:50 +00:00
rey4
6800f02ab0 various minor fixes
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@680 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 17:13:21 +00:00
rey4
94102ae7ae updated alternate template files
* dir_alternate.ezt: updated with recent changes to directory.ezt

* log_table.ezt: updated with recent changes to log.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@679 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 16:52:31 +00:00
rey4
eb16ebf2ce removed empty column from directory information table and added missing
</tr> closing tag


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@678 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 16:51:08 +00:00
rey4
07a0d6e387 made standalone server work with cvsnt and rcs when it is run on windows
without a configuration file

* lib/config.py (Config.load_config): added conf_path member to hold the
  path to viewcvs.conf, or None if there is no configuration file

* standalone.py (serve): if there is no configuration file on windows, it
  will test for the presence of cvsnt and if the test fails, it will fall
  back to rcs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@677 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 16:44:25 +00:00
rey4
a071956110 Added some new fields to the Subversion log view and fixed the
download/view/markup links for old revisions of copied files.

The new fields are "Other changed files" which is a list of links to other
files changed in the same revision, "Copied from" which is displayed for
file revisions that are the result of a copy operations, and "Filename"
which is displayed for older file revisions which precede a copy operation.

* viewcvs.conf.dist
* lib/config.py (set_defaults): added "show_changed_paths" option to determine
  whether or not to retrieve and display the new information

* lib/viewcvs.py (run_viewcvs): now passes show_changed_paths option to
  newly created subversion repository objects

  (view_log_svn): changed the way download/view/markup links are generated
  and added code to generate links for new fields

* templates/log.ezt: template additions

* lib/vclib/svn/__init__.py (LogEntry.__init__): added extra arguments for new
  fields

  (ChangedPathEntry): new class to hold information about the changed paths
  associated with a revision

  (LogReceiver.__init__): added some new members to hold more state for the
  callback function

  (LogReceiver.receive): added some code to crawl through the "paths" hash
  and save useful information

  (get_logs): changed to work with new LogReciever constructor

  (fetch_log): changed call to repos.svn_repos_get_logs() to pass true for the
  "discover_changed_paths" argument. moved fs.file_length() call into
  LogReceiver.__init__


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@676 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-03 06:27:52 +00:00
rey4
c6ddff38ef Added some new fields to the Subversion log view and fixed the
download/view/markup links for old revisions of copied files.

The new fields are "Other changed files" which is a list of links to other
files changed in the same revision, "Copied from" which is displayed for
file revisions that are the result of a copy operations, and "Filename"
which is displayed for older file revisions which precede a copy operation.

* viewcvs.conf.dist
* lib/config.py (set_defaults): added "show_changed_paths" option to determine
  whether or not to retrieve and display the new information

* lib/viewcvs.py (run_viewcvs): now passes show_changed_paths option to
  newly created subversion repository objects

  (view_log_svn): changed the way download/view/markup links are generated
  and added code to generate links for new fields

* templates/log.ezt: template additions

* lib/vclib/svn/__init__.py (LogEntry.__init__): added extra arguments for new
  fields

  (ChangedPathEntry): new class to hold information about the changed paths
  associated with a revision

  (LogReceiver.__init__): added some new members to hold more state for the
  callback function

  (LogReceiver.receive): added some code to crawl through the "paths" hash
  and save useful information

  (get_logs): changed to work with new LogReciever constructor

  (fetch_log): changed call to repos.svn_repos_get_logs() to pass true for the
  "discover_changed_paths" argument. moved fs.file_length() call into
  LogReceiver.__init__


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@675 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-03 06:20:24 +00:00
rey4
8d21b07bc2 removed some false advertising
* viewcvs.conf.dist: removed comment about CVSNT handling UTF-16 text
  better than the RCS utilities. This is irrelevant since CVSNT
  converts text to UTF-8 before storing it in the repository file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@674 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 06:49:59 +00:00
rey4
0df99f1010 updated documentation to say that CVSNT can be used instead of RCS
* windows/README
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@673 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 05:42:47 +00:00
rey4
d228ab0ce2 removed some lines of code that don't do anything...
* standalone.py (ViewCVS_Handler.run_viewcvs): ...from this function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@672 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 05:23:52 +00:00
rey4
2e3d56772a standalone server had been setting the SCRIPT_NAME in a nonstandard way
which was incompatible with the url escaping changes I made in viewcvs.py
a little earlier today. now it is set correctly.

* standalone.py (ViewCVS_Handler.run_viewcvs): changed the way SCRIPT_NAME
  value is determined


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@671 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 05:16:06 +00:00
rey4
fe67803feb fixed some variable misspellings
* lib/viewcvs.py (Request.run_viewcvs): errors were in this function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@670 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 04:56:48 +00:00
rey4
df7db58a04 changes to allow viewcvs to use CVSNT instead of the RCS utilities to
get information from CVS repositories

* viewcvs.conf.dist
* lib/config.py (Config.set_defaults): new "cvsnt_exe_path" option
  that can be set to the path of the cvsnt executable. If it is
  set, cvsnt gets invoked instead of the rcs utilities

* lib/vclib/bincvs/__init__.py (rcs_popen): new wrapper for popen that decides
  what program to execute based on the "rcs_paths" and "cvsnt_exe_path"
  options.

  (get_logs, fetch_logs): changed to use rcs_popen function instead of
  popen.popen

* lib/viewcvs.py (process_checkout, view_diff, generate_tarball_cvs): changed
  to use bincvs.rcs_popen instead of popen.popen

  (view_directory_cvs, generate_tarball_cvs): updated call to bincvs.get_logs

  (read_log): updated call to bincvs.fetch_log

* lib/rlog.py (GetRLogData): updated call to bincvs.fetch_log


general.cvsnt_exe_path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@669 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 04:49:16 +00:00
rey4
8675e8cad0 some minor fixes
* lib/viewcvs.py (_URL_SAFE_CHARS, Request.get_url, prep_tags,
  view_directory, view_log, human_readable_diff): added
  URL escaping

* (Request.run_viewcvs, _strip_suffix): changed fake-suffix code to actually
  interpret the fake suffixes instead of just stripping them off


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@668 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 01:28:09 +00:00
rey4
61406314a9 Changes intended to simplify handling URLs in ViewCVS. Nearly all
links between ViewCVS pages are now constructed by a new Request
method called "get_link," and all URL parsing happens in another new
Request method called "run_viewcvs."

I also added support for a new optional parameter called "view." It
provides a more uniform way of linking to ViewCVS pages, so you can
say

  /viewcvs/dir/file.txt?view=log
  /viewcvs/dir/file.txt?view=co
  /viewcvs/dir/file.txt?view=annotate
  /viewcvs/dir/file.txt?view=markup

instead of

  /viewcvs/dir/file.txt
  /viewcvs/*checkout*/dir/file.txt
  /viewcvs/dir/file.txt?annotate=head
  /viewcvs/dir/file.txt?rev=HEAD&content-type=text/vnd.viewcvs-markup

Changes which are not backwards compatible had to be made to some
template files. Old templates will not work with the new code.


* templates/include/branch_form.ezt:
* templates/include/diff_form.ezt:
* templates/include/paging.ezt:
* templates/include/sort.ezt:
* templates/diff.ezt:
  changed to use form action and hidden fields provided by the script

* templates/directory.ezt: got rid of relative urls, changed to use
  form action and hidden fields provided by the script

* templates/graph.ezt: changed to take image path from the script

* templates/header.ezt: got rid of "qquery" variable

* templates/log.ezt: changed the way diff and annotate links get
  constructed

* lib/viewcvs.py (Request.__init__): moved out url parsing stuff into
  new "run_viewcvs" method.

  (Request.run_viewcvs): new Request method to hold all url parsing
  code and replace the global function with the same name.

  (Request.get_url, Request.get_link): new methods to construct urls
  for ViewCVS pages. Most of the hyperlinks that appear in generated
  pages are now made by these functions.

  (get_up_path): turned off special handling of attic directory for
  subversion, switched names of regular expressions

  (_legal_params, _validate_param, _validate_root): added new 'view'
  parameter, turned off separate validation for root parameter

  (_re_validate_revnum): allow empty string to be specified as a
  revision number. needed to prevent validation error when doing a
  regular expression search on the cvs trunk (which sets
  only_with_tag to "")

  (_strip_suffix, _repos_pathtype): added some new helper functions

  (sticky_query, toggle_query, download_url): removed these functions,
  Request.get_url() is now used instead.

  (clickable_path, prep_tags, augment_entry): changed signatures and
  implementations to use Request.get_url

  (is_viewable, is_viewable_image): changed is_viewable() to
  is_viewable_image() to avoid overlap in functionality with is_text()

  (nav_header_data): got rid of 'qquery' template parameter, changed
  'file_url' to use an absolute pathname instead of a relative one

  (view_auto): new function that marks up the current file if it is
  viewable, otherwise downloads it. called when a user clicks on the
  revision numbers in directory listings.

  (view_markup, markup_stream): renamed markup_stream to view_markup
  and changed signature

  (get_file_data_svn): no longer tries to generate physical pathnames
  for subversion files since the values it did generate were
  meaningless and were ignored anyway.

  (get_file_data): changed docstring

  (prepare_hidden_values): changed signature

  (view_directory, view_directory_cvs, view_directory_svn): factored
  out some of the common parts of view_directory_cvs and
  view_directory_svn functions into a new function called
  view_directory. implementations were also changed to use new get_url
  and get_link functions

  (view_log, view_log_cvs, view_log_svn): ditto

  (process_checkout): changed signature and moved in support for
  subversion

  (view_checkout, search_files): changed implementations to deal with
  new url handling, and the changes to process_checkout.

  (view_annotate, human_readable_diff, download_tarball): changed to
  use new url methods

  (view_cvsgraph): changed signature to be consistent with
  view_checkout, view_annotate, view_markup, etc. Added new template
  parameter 'imagesrc' so the graph url doesn't have to
  be hardcoded in the template.

  (cvsgraph_image, view_cvsgraph_image): renamed cvsgraph_image to
  view_cvsgraph_image and changed its signature (also for consistency
  with the other view_* functions).

  (_views, _view_codes): new dictionary objects mapping "view"
  parameter values to functions that produce various viewcvs pages.

  (handle_config): got rid of global "default_settings" dictionary

  (run_viewcvs): replaced by Request.run_viewcvs

  (main): now calls Request.run_viewcvs()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@667 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-01 08:35:28 +00:00
rey4
4a3ac177ee just changed tabs to spaces.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@666 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-27 22:45:03 +00:00
cmpilato
0a88d6f1a6 * viewcvs/lib/vclib/svn/__init__.py
(get_logs, fetch_log): Add file sizes to file LogEntry() items.

* viewcvs/templates/log.ezt
  Add file size display for Subversion repositories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@665 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-26 19:54:13 +00:00
cmpilato
dd34c9fd4c Implement templatized error messages. Thanks to Russell Yanofsky
<rey4@columbia.edu> for bringing sanity to my morning with his fix of
the "isinstance()" usage.

* viewcvs/lib/config.py
  (set_defaults): Add new default value for self.templates.error.

* viewcvs/viewcvs.conf.dist
  (error): New configuration variable for specifying the error template.

* viewcvs/templates/error.ezt
  New default error template.

* viewcvs/lib/debug.py
  (ViewCVSException.__init__): Lose the 'description' member.
  (PrintException): Now prints exception data passed in (doesn't do
    the sys.exc_info() call itself any more).
  (GetExceptionData): New generic exception data harvester for use
    with templatized output.

* viewcvs/lib/viewcvs.py
  (view_error): New error printer that tries to use the error template
    before falling back to direct output.

* viewcvs/lib/query.py
  Update calls to debug.PrintException() to get the exception data
  from debug.GetExceptionData()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@664 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-26 18:18:41 +00:00
rey4
d30f21f382 bugfix in PrintException. code was checking to see the exception type
was an instance of ViewCVSException instead of the exception object.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@663 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-26 17:07:10 +00:00
cmpilato
f6a150d62b Fix a template bug reported by Branden Robinson <branden@deadbeast.net>.
* templates/include/branch_form.ezt
* templates/include/diff_form.ezt
* templates/include/sort.ezt
  Use an action="" value in these forms that can deal with both states
    of the root_as_url_component option.

* lib/viewcvs.py
  (view_log_cvs, view_log_svn): Add 'current_root' to the data
    dictionary.  This is "just because", not really related to the bugfix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@662 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-25 20:32:03 +00:00
cmpilato
fc69db201e * viewcvs-install
Fix the final instructions to point to the updated location of
    viewcvs.cgi (now in www/cgi/ instead of just cgi/)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@661 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-25 20:29:03 +00:00
cmpilato
1f7b439cb0 Fix the example used to demonstrate working Subversion bindings.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@660 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-16 18:19:04 +00:00
rey4
3b02f55c88 Changed windows implementation of popen() to call CreateProcess with a "nul"
file handle instead of no handle at all when discarding the child process's
standard error output. Without this change, some versions of RCS crash when
they try to print warning messages.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@659 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-09 23:20:00 +00:00
rey4
0626128b12 - changed recommended python distribution and rcs binaries
- got rid of references to binaries folder
- changed spacing in a few places


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@658 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-08 19:46:30 +00:00
rey4
b762466add * www/cgi/viewcvs.cgi, www/cgi/query.cgi, www/viewcvs-strace.sh,
cgi/viewcvs.cgi, cgi/query.cgi, cgi/viewcvs-strace.sh
  - moved stub scripts from cgi/ to www/cgi/

* cgi/granny.cgi
  - deleted since annotate functionality is already intergrated into
    viewcvs

* cvsgraph.conf.dist, viewcvs.conf.dist,
  cgi/cvsgraph.conf.dist, cgi/viewcvs.conf.dist
  - moved configuration files from cgi/ to project root

* www/mod_python/.htaccess, www/mod_python/query.py, www/mod_python/viewcvs.py,
  windows/htaccess.mod_python, windows/query.py windows/viewcvs.py
  - moved mod_python files from windows/ to www/mod_python/

* www/asp/query.asp, www/asp/viewcvs.asp,
  windows/query.asp, windows/viewcvs.asp
  - moved asp files from windows/ to www/asp/

* viewcvs-install
  - updated installer to deal with all the moved files

* INSTALL windows/README website/upgrading.html
  - updated documentation with new file locations and mod_python information


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@657 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-03 06:24:59 +00:00
rey4
b0178f0511 bugfix in PrintException()
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@656 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 18:53:12 +00:00
rey4
76657fb8ad - fixed incorrect path in ASP installation instructions
- updated mod_python installation instructions (the new version has a
  windows installer)
- added a link for help troubleshooting mod_python
- deleted information about old enscript bugs, and added information about
  a new enscript problem.
- added URL for CvsGraph building instructions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@655 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 05:14:50 +00:00
rey4
d35d170619 explicitly set mod_python's default content-type to text/html to prevent
it from automatically deducing different values


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@654 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:42:30 +00:00
rey4
f62fc9bd69 * lib/win32popen.py:
- removed nonblocking implementation of win32popen.MakeSpyPipe(). It added
    unnecessary complexity and had a flaw which made it inefficient to boot.

* lib/popen.py:
  - changes to work with new win32popen.CreatePipe() signature


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@653 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:40:44 +00:00
rey4
9c77b6eb7d fixed pipe_cmds() to work with mod_python on unix
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@652 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:05:00 +00:00
rey4
da232542ef Updated instructions for new versions of enscript and rcs tools. Also fixed
some typos and grammatical errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@651 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-27 02:47:33 +00:00
rey4
870580afb4 cvs ci standalone.py lib/sapi.py
* lib/sapi.py standalone.py
  changed sapi implementations of header() methods to accept status arguments
  set to None


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@650 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-27 02:46:53 +00:00
cmpilato
946a206b08 Add tarball support for Subversion repositories. Patch by Ben Collins
<bcollins@debian.org>, modified a little bit by cmpilato.

* lib/viewcvs.py
  (generate_tarball_cvs): Was generate_tarball().
  (view_directory_svn): Add linkage for tarball download().
  (generate_tarball_svn): New.
  (download_tarball): Now call either generate_tarball_svn and
    generate_tarball_cvs, depending on the root type.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@649 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-25 18:10:18 +00:00
cmpilato
d6806afe25 Track rename of Subversion binding module util->core.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@648 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-22 16:14:53 +00:00
cmpilato
38a02d75ea (view_log_svn): Protect against NULL log messages in Subversion
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@647 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-04-29 20:38:35 +00:00
cmpilato
5473b5d8d4 No longer display "Changes since" for non-CVS repositories
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@646 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-04-29 20:32:51 +00:00
cmpilato
aa32130d2e * lib/vclib/__init__.py
(InvalidRevision): New exception.

* lib/vclib/svn/__init__.py
  (date_from_rev, fetch_log, SubversionRepository.__init__): Raise new
    InvalidRevision exception where applicable.

* lib/viewcvs.py
  (Request.__init__, view_diff): Catch the new InvalidRevision
    exception from the vclib for Subversion actions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@645 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-04-16 16:00:30 +00:00
cmpilato
1fbc1eeb13 Add myself and Russell to the Who list (with gstein's blessing).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@644 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-20 17:23:03 +00:00
cmpilato
00de9ce28f Let the Subversion integration breathe the fresh air.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@643 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-20 16:29:38 +00:00
rey4
459ed3fea3 * lib/sapi.py
- Filled in ModPythonServer and AspServer header() methods to make use of
      the new http 'status' parameter. Also, changed CgiServer's header()
      method to ignore the status parameter under IIS to prevent the server
      from discarding the ViewCVS output and instead sending a static error
      page.
    - ModPythonFile and AspFile classes have been eliminated and replaced
      with a more generic File class. All server classes have new write()
      and flush() methods.
    - Common code from AspServer and ModPythonServer has been moved into
      a base class called ThreadedServer. AspProxy is renamed to
      ThreadedServerProxy.
    - All server classes now inherit from a new base class called Server
      which contains the small amount of code common to all of them.
    - added fix_iis_path_info() function, renamed IIS_FixURL() to
      fix_iis_url()
    - renamed getFile() methods to file()

* lib/viewcvs.py
    - Eliminated global server variable. Changed some scattered
      server.escape() calls into cgi.escape() calls. Got around other uses
      of the variable by adding a server member to the Request class.
    - Deleted gstein's strongly worded comment about the quality of the sapi
      hack :)
    - Page-global 'g_name_printed' is now passed as a normal parameter
      called 'name_printed' to the augment_entry() function
    - Got rid of some confusing string manipulation in human_readable_diff()
    - added 'server' parameter to viewcvs.main() to avoid relying on the
      sapi.server global variable

* cgi/viewcvs.cgi, windows/viewcvs.py, windows/viewcvs.asp
    - Added 'server' parameter to viewcvs.main() calls

* standalone.py:
    - Changed StandaloneServer.header() method to accept http status code
    - Added 'server' parameter to viewcvs.main() call

* lib/query.py
    - added 'server' parameter to query.main() to avoid relying on the
      sapi.server global variable
    - got rid of global 'server' variable and page-global 'viewcvs_link'
      variable, instead those values are passed as function parameters

* cgi/query.cgi, windows/query.py, windows/query.asp
    - Added 'server' parameter to query.main() calls

* lib/debug.py
    - Changed PrintStackTrace(), PrintException(), and DumpChildren() not to
      rely on global sapi.server variable and to use new server.write()
      method

* lib/popen.py
    - changed server.getFile() calls to server.file()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@642 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-12 23:08:09 +00:00
cmpilato
c74fa8eb35 * lib/vclib/svn/__init__.py
(itemtype): Make this more efficient (and more correct).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@641 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 23:42:03 +00:00
cmpilato
69383e0c33 Protect against silly user-entered data in the diff forms.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@640 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 23:38:01 +00:00
gstein
f30b808cc7 Restore the ability for errors to generate non-200 responses. This was
broken when sapi was introduced.

* lib/debug.py:
  - import 'sys' at the global level since it is fast enough, and we
    also want to be able to grab the exc_info() without any imports
  (ViewCVSException.__init__): rename var to 'status' as it represents
    the HTTP Response Status rather than an "http code"
  (ViewCVSException.__str__): revamp the output a bit for cleaner
    display within a traceback.
  (PrintException): grab the exception early, so that other code can't
    overwrite it. if necessary, pass an HTTP response to
    server.header(). tweak a bit of the exc_info() result handling.
    tweak the generated output.

* lib/sapi.py:
  (CgiServer.header): take and output an HTTP response status.
  (AspServer.header): take an HTTP response status. don't worry about
    returning 0/1 from the call (the result is unused)
  (ModPythonServer.header): take an HTTP response status. drop the
    return value.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@639 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 23:11:57 +00:00
gstein
d51c87a71a Various fixes and improvements.
* lib/config.py:
  (_parse_roots): get rid of a string method usage.

* lib/popen.py:
  (pipe_cmds): stop using the += syntax (not compatible with 1.5.2)

* lib/sapi.py:
  (CgiServer.__init__): use os.environ, not os.getenv()
  (IIS_FixURL): stop using the += syntax

* lib/viewcvs.py:
  - note: these changes look big, but are small. use 'cvs diff -b' to
    see the real change without the reindentation.
  (markup_stream_python): record a note about some future work
  (run_viewcvs): new function which holds the guts of ViewCVS. this
    used to be main() a long while back before that got monkeyed. this
    is really just a reindent.
  (main): hold the exception handling logic. tweak then the t_start
    and t_end calls are made, relative to the try/finally.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@638 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 20:43:06 +00:00
gstein
14c0409e77 handy script for tracing ViewCVS's syscalls
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@637 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 20:35:23 +00:00
rey4
690e7b6e8f installation now prompts to delete .py or .pyc files that don't belong
in install folders


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@636 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-03 09:57:06 +00:00
rey4
418e33776e Restored the line that deletes the return of exc_info() in PrintException(). Also added a try/finally block to make the exception-printer exception-safe.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@635 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-28 01:08:10 +00:00
cmpilato
b62f0bf4c5 Expose the filename to the log templates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@634 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 23:03:21 +00:00
cmpilato
0c0999a9c7 Fix a little CVS/Subversion discrepency (and in the process, fix the
nav_path so that the Attic is optionally displayed based on the
hideattic CGI param).

* viewcvs/lib/viewcvs.py
  (_re_up_attic_path, get_up_path): New.  Change all other users of
    _re_up_path to call this function instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@633 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 22:44:47 +00:00
gstein
6227db7a91 Various small changes:
- fix syntax to be Python 1.5.2 compatible
  - no += operator
  - no "value in dict" operations
- remove a,b=c,d types of assignments; there is no reason to do tuple
  packing/unpacking; just use two assignments
- rename ViewcvsException to ViewCVSException; leave in a grandfather
- couple style nits


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@632 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 21:34:57 +00:00
cmpilato
fa4ad62287 Just some 80-column formatting changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@631 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 21:26:11 +00:00
gstein
9c346b051f Ensure that we open ,v files in binary mode.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@630 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-26 02:31:31 +00:00
rey4
4e9a300681 fixed interpretation of win32file.ReadFile() return value
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@629 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-26 01:39:51 +00:00
timcera
e0f09153bb Changed the length of dir and file VARCHAR fields from 128 to 255. I felt
this was the best (and easiest) change compared to changing the type
because of the possible introduction of subtle differences in the treatment
of VARCHAR and TEXT.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@628 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-22 03:52:14 +00:00
rey4
c8d318c670 replaced += operation with call to list extend method for pre-2.0 python compatibility
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@627 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-20 10:43:11 +00:00
rey4
b85fb5485e fix enscript documentation
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@626 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-20 10:22:03 +00:00
rey4
a79f56d178 bugfix: enabled display of pipe_cmds error streams in debug mode
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@625 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-20 10:21:08 +00:00
rey4
4e2aa11281 changed installer to not install windows-only files on unix!
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@624 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 23:24:29 +00:00
rey4
74b01543ae Updated with new locations of asp and mod_python files
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@623 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 22:51:27 +00:00
rey4
82729d4181 simplified apache handler using execfile()
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@622 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 06:23:32 +00:00
rey4
e586a6785b Now adds "_page" suffix to module_name once instead of twice
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@621 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:39:00 +00:00
rey4
90c060be4c - moved global g_name_printed variable into server.pageGlobals
- fixed scoping problem in Request.__init__()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@620 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:35:41 +00:00
rey4
358a5c2aa5 got rid of unneccessary imports
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@619 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:33:07 +00:00
rey4
c95a191275 replaced prints with writes
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@618 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:31:35 +00:00
rey4
72c395bc35 moved ASP and mod_python folders out of "cgi" directory
and into the "windows" area. Updated windows readme with
the new locations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@617 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:29:21 +00:00
rey4
69b548a1b3 important bugfix for loginfo handler, didn't handle multidigit version numbers
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@616 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:56:35 +00:00
rey4
2cb8aa851b added environment variable dump
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@615 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:56:12 +00:00
rey4
e6d529b874 renamed variable
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@614 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:55:42 +00:00
rey4
5786f0958c commited Ivo Roessling's bugfix
http://mailman.lyra.org/pipermail/viewcvs/2003q1/001622.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@613 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:55:26 +00:00
rey4
27be5778fc fix for mod_python
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@612 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:55:04 +00:00
rey4
5a7ae45fa1 minor changes to sapi interface for mod_python support
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@611 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:54:41 +00:00
rey4
1d1816cc8c added the new mod_python files
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@610 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:54:21 +00:00
rey4
c23a80b4fe removed bit about mxDateTime and updated information about loginfo handler
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@609 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:53:44 +00:00
rey4
6037eefa8c added a new 0.9 section with blurb about UTC times in database
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@608 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:53:00 +00:00
rey4
6ab242782a removed bit about mxDateTime
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@607 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:52:26 +00:00
rey4
c878d98e57 readme from third release
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@606 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:49:24 +00:00
rey4
3127bf9af6 readme from second release
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@605 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:48:11 +00:00
rey4
db8777345b There are a few significant changes to the loginfo handler script.
1) There's a new way to pass it parameters. You can write:

  ALL <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv}

instead of:

  ALL (echo %{sVv}; cat) | <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler

although for backwards compatibility, the old invokation still works. The
reason for the change is to make life easier for windows users who do not
typically have cat and a unix-style echo command installed on their machines.

2) It now sort of supports spaces in file names. Current versions of CVS pass
loginfo parameters in a space-separated string without bothering to escape the
spaces that can occur in filenames within the string. This can make it
impossible to unambiguously parse, so a heuristic is used to guess which spaces
are meant to be separators and which are part of file names. (See the
documentation string for the HeuristicArgParse() function for a description of
how it works). The heuristic should be pretty reliable when spaces are used in
filenames AND directory names, extremely reliable when spaces are allowed in
EITHER filenames OR directory names, and completely reliable in the
unambiguous case when there are no spaces in path names.

There is a completely different situation with CVSNT. CVSNT does escape spaces
and special characters with backslashes so no heuristic is needed. A separate
parsing routine is used for this case.

3) By default the loginfo handler will run the CVSNT parsing routine on windows
and the heuristic parsing routine on all other platforms. But since CVSNT has
been backported to Unix, there may be some people who need to override the
default. This can be done by tacking on a second parameter:

  ALL <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv} <arg2>

where <arg2> is either "cvs", "cvsnt", or "brokencvsnt". "brokencvsnt" is for
some semi-recent versions of CVSNT which mistakenly escaped filenames twice.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@604 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 03:09:17 +00:00
rey4
dea026e417 - changed some popen calls to discard warnings from RCS utilities that occur
when reading CVSNT RCS files with nonstandard fields


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@603 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:59:58 +00:00
rey4
2f8d06bd7c - added C++ formatting for .hpp extension
- changed some popen calls to discard warnings from RCS utilities that occur
  when reading CVSNT RCS files with nonstandard fields
- caused exit after tarball generation to prevent html from being appended
  to the end of the tarball


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@602 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:59:25 +00:00
rey4
d8b66eebde - fixed debug.PrintStackTrace() function
- updated child process tracker to use the sapi.server.pageGlobals dictionary


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@601 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:58:04 +00:00
rey4
8ad4c2657e - now converts path names to a canonical format with the os.path.normcase()
function before sending them to the database to avoid the problems with
  multiple path spellings on windows


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@600 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:57:21 +00:00
rey4
6659847cb7 - removed unneccesary cvsroot path manipulation
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@599 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:56:33 +00:00
rey4
b7877e0d0c - removed hardcoded links in query page
- replaced cvsroot_name_from_path() function with a lookup table


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@598 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:56:11 +00:00
rey4
561a2074d3 - removed hardcoded links in query page
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@597 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:55:40 +00:00
rey4
0ecbd1d45d - added sapi.server.pageGlobals dictionary to hold values and objects that
need to be kept for the duration of a page load


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@596 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:54:53 +00:00
rey4
6b47a6c80f - explicitly set text and binary modes on calls to popen
- replaced some convoluted time converting code with a call to compat.timegm()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@595 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 10:10:43 +00:00
rey4
bed66c3ea8 now replaces forward slashes in windows paths with backslashes before
passing them to the database. also changed loginfo-handler to print
errors to the standard error stream instead of the standard out so
messages can get forwarded to the CVS client.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@594 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 10:05:00 +00:00
rey4
458cfb4785 removed this unused copy of popen.py (more recent version is lib/popen.py)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@593 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 10:00:13 +00:00
rey4
f6f2654281 - modified popen module to work on windows
- added debugging mode for popen which can display the input and
  output from child processes (only works on windows for now)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@592 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:57:46 +00:00
rey4
99b5381080 - updated to use new sapi module
- added support for php colorizing (using the colorizing capabilities of the
  php interpreter)
- replaced error() function with a ViewCVS exception class
- added explicit text 't' and binary 'b' mode flags to popen calls


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@591 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:50:44 +00:00
rey4
e808ff8ce9 - updated to use new sapi module
- now can display local times if the use_localtime configuration option
  is set


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@590 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:49:00 +00:00
rey4
e7cb800f6d added new sapi module which abstracts away differences between the different
server environments that ViewCVS runs on (CGI, ASP, standalone)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@589 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:48:05 +00:00
rey4
007ea0d99d - got rid of mxDateTime dependency
- made database store times in UTC by default instead of using
  the local timezone of the machine running ViewCVS. For backwards
  compatibility a global variable dbi.dbi_utc_time can be set to
  zero to use old behavior
- fixed use of some nonexistent constants in cvsdb.py
- allow forward slashes in directory and repository conditions
  of database searches regardless of the default path separator
  used by the underlying os


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@588 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:33:12 +00:00
rey4
2b2f676ee3 worked around lack of working popen2.Popen3 class on windows
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@587 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:21:08 +00:00
rey4
2a8a87b1a6 updated to cope with colons and backslashes in windows paths
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@586 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:17:55 +00:00
rey4
c10162e3da updated installer for windows compatibility
- escaped backslashes in regular expressions
- added viewcvs.asp and query.asp to FILE_INFO_LIST
- set default install path to "Program Files" directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@585 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:16:09 +00:00
rey4
ac310d82cb fixed line endings
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@584 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-08 01:15:07 +00:00
timcera
595556b544 Need to set CVSROOT in order for spawned RCS utilities to correctly
expand $CVSHeader$.  See patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=636331&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@583 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-01 05:42:29 +00:00
timcera
bd78d04280 Bolding revision number. See patch
http://sourceforge.net/tracker/index.php?func=detail&aid=621979&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@582 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-01 05:02:09 +00:00
timcera
59c63fab78 Added some filetypes to enscript's colorization list. Filetypes and enscript
settings used from
http://sourceforge.net/tracker/index.php?func=detail&aid=571973&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@581 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-31 03:00:59 +00:00
cmpilato
a25b7cc8ba (view_directory_svn): pass diffoptions as a list instead of a string
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@580 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-27 17:36:29 +00:00
cmpilato
fa05f953c2 (view_directory_svn): allow empty log messages
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@579 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-27 16:36:00 +00:00
cmpilato
5eca0694fb Track changes in the Subversion bindings; use top-level svn modules
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@578 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-21 21:30:17 +00:00
pefu
8730954b1e Clarified usage text and removed one trailing blank
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@577 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-28 10:14:30 +00:00
cmpilato
932aa382f0 * viewcvs/lib/vclib/svn/__init__.py
(date_from_rev): New.

* viewcvs/lib/viewcvs.py
  (_re_extract_rev): Fix this regexp to allow Subversion-style
    revision numbers, too.
  (view_diff): Fix Subversion diff labels to have datestamps and revisions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@576 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-13 19:01:02 +00:00
cmpilato
5a5450e4c9 Implement alternative URL scheme, and make Subversion a little more
public.  Miscellaneous Subversion bug fixes, too.

* viewcvs/lib/config.py
  (Config.set_defaults): Add default state for 'root_as_url_component'
    option.  Remove "CVS" from the 'general/address' and
    'general/main_title' default values.

* viewcvs/cgi/viewcvs.conf.dist
  Lots of documentation changes in here.
  (root_as_url_component, svn_roots, svn_parent_path): New options.
  (address, main_title): Lose the "CVS" in the value.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Handle the new 'root_as_url_component' option.
  (list_roots): New.
  (clickable_path, download_url): Take any embedded roots into account
    during href generation.
  (view_diff): Fix the revision parsing here.  I dunno why I ever made
    this code CVS-specific in the first place...
  (view_log_svn): Populate 'roottype' data member.
  (view_log_cvs): Was view_log().  Populate 'roottype' data member.
  (view_directory_cvs, view_directory_svn): Use new list_roots()
    helper.  Also, calculate 'nav_path' unconditionally (it may be
    None, but it will at least be defined so templates can use it).
  (main): Update call to view_log_cvs().

* templates/directory.ezt
* templates/dir_alternate.ezt
  Take 'embedded_root' into account for href generation.

* templates/log.ezt
  Do some "CVS" vs. "Subversion" string changing.  Disable "annotate"
  link for Subversion.

* templates/log_table.ezt
  Disable "annotate" link for Subversion.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@575 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-12 02:02:52 +00:00
cmpilato
1e1b541063 track API rename
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@574 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-10 19:34:25 +00:00
cmpilato
794354e63a * viewcvs/templates/directory.ezt
* viewcvs/templates/dir_alternate.ezt
  Make the [hide] link conditional on the presence of the
    'attic_showing' data member. Also, treat the directory named 'Attic'
    special only for cvs roottypes.

* viewcvs/lib/viewcvs.py
  (view_directory_cvs): Setup the new 'attic_showing' data member.
  (view_directory_svn): Don't bother with the 'hide_attic_href' and
    'show_attic_href' data members.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@573 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-11-15 00:11:57 +00:00
timcera
6f118cda72 Code block removed that was supposed to handle some redirection issues
but failed under certain conditions (SERVER_URL not defined) and the
redirection problems are handles elsewhere in the code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@572 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-22 03:01:53 +00:00
cmpilato
dabbdbd23c * lib/vclib/bincvs/__init__.py
Make BinCVSRepository a subclass of vclib.Repository.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@571 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-14 23:58:41 +00:00
gstein
f3ca7b9118 entity-escape some ampersand that go into the URLs on the page
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@570 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 23:14:23 +00:00
gstein
43c6a836e4 Fix the URL construction to use entities for the ampersands.
Submitted by: Ville Skytt� <scop@users.sourceforge.net>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@569 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 23:08:52 +00:00
gstein
53913a48d1 Fixes bug #536141 and #536144, submitted by Franz H�pfinger.
Escape the paths generated by clickable_path() and download_url()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@568 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 22:10:01 +00:00
gstein
42f004c911 Minor cleanups.
- remove the revision_symbolic_name since it was bogus and unused
- quote the outer table attributes for xhtml compat
- remove the unused usedlog
- change the line number formatting to simplify the width usage
  (through the '*' format character) and to make the name= anchor
  surround the actual number rather than empty space.
- use '*' for author formatting, too
- remove the '.diff' from the URLs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@567 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 00:53:14 +00:00
gstein
8ec28642ba * lib/viewcvs.py (prepare_hidden_values): tweak the <input> tag to
make it xhtml compatible.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@566 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 00:18:39 +00:00
gstein
08a5af8aef Recognize cvsweb's custom MIME type. This allows people to upgrade
their cvsweb installation to ViewCVS and still have old URLs do the
right thing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@565 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 00:14:57 +00:00
gstein
c82276049a Various changes:
- remove diff_font_face/size options and move the font stuff from code
  to the diff.ezt template
- move error() back to viewcvs.py and have config.py raise an
  exception (so config doesn't have to know about CGI stuff)
- revamp SVN parent path stuff to avoid catch-all try/except

* cgi/viewcvs.conf.dist: remove the diff_font_face and diff_font_size
    options. These are now part of the diff.ezt template.
    COMPAT BUSTER

* templates/diff.ezt: need to apply font changes since the EZT
    references no longer include them.

* lib/viewcvs.py:
  (error): moved (back) here from config.py
  (DiffSource._get_row): stop inserting HTML into the values; leave
    that for the template to do however it wants
  (handle_config): catching all exceptions is very, very dangerous.
    rework this code to avoid exceptions thru the use of
    os.path.exists() and wrap an OSError exception catcher around the
    small little bit that might throw it.

* lib/config.py:
  (error): shifted back to viewcvs.py
  (_parse_roots): shifted below the "important" part of this file,
    which is the config stuff. changed the error handling to throw an
    exception rather than call error()
  (MalformedRoot): new exception. note that ViewCVS includes code for
    catching exceptions and pretty-printing them to an HTML page, so
    we don't need a specific catch of this exception.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@564 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-09 04:04:03 +00:00
gstein
ddd22c15b5 A new utility module to compute sets of changed files inside a loginfo
handler. It properly deals with spaces in the paths and the filenames.
See the internal doc for more information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@563 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-09 01:47:43 +00:00
gstein
37e1e3aa93 Fix up some of the imports. Some were not needed. Also avoided the
importing of bare names, so that references are vclib.FOO (more
obvious where FOO came from). Also fixed references to the
RCSStopParser name, which were unqualified (and would have failed).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@562 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-09 01:46:56 +00:00
cmpilato
97b7b4863b * viewcvs/lib/viewcvs.py
(handle_config): Oops.  Little fix for skipping non-repos dirs in
    the parent path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@561 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-04 22:17:36 +00:00
cmpilato
b6e6db84c8 Implement a new svn_parent_path configuration variable.
* viewcvs/lib/config.py
  (Config.set_defaults): Add default value for 'svn_parent_path'.

* viewcvs/lib/viewcvs.py
  (handle_config): So special handling for 'svn_parent_path'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@560 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-04 20:52:11 +00:00
cmpilato
341f1e8fe4 Hehheh...do some cleaning up, properly shutting down the repository
and terminating the APR stuffs.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Update call to SubversionRepository.__init__().

* viewcvs/lib/vclib/svn/__init__.py
  (SubversionRepository.__init__): No longer take pool argument; do
    all the APR init stuffs inside this constructor.
  (SubversionRepository.__del__): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@559 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-03 15:06:35 +00:00
cmpilato
8fdacfb716 Finish getting that enscript stuff working for Subversion, and
implement rudimentary directory version jumping.

* viewcvs/lib/vclib/svn/__init__.py
  (date_from_rev): New.
  (StreamPipe): new class.
  (get_file_contents): now returns StreamPipe object.

* viewcvs/templates/directory.ezt
  Get some subversion directory-revision-jumping UI action on.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Allow 'HEAD' as incoming 'rev' option.
  (view_checkout): Use new get_file_contents() return.
  (view_directory_svn): Populate new 'roottype', 'tree_rev' and
    'jump_rev' data members.
  (view_directory_cvs): Populate new 'roottype' data member.

* viewcvs/lib/config.py
  (set_defaults): Stop using real default values for cvs_roots and
    default_root.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@558 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-02 20:00:27 +00:00
cmpilato
749762bb37 * viewcvs/lib/viewcvs.py
(markup_stream): Only do log-reading for CVS right now.
  (view_log_svn): Fix the view link, and fix the selected rev comparison.
  (view_checkout): Try to get some enscript-y action going on here.
  (view_diff): Clarify a comment just a bit.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@557 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-02 17:32:38 +00:00
gstein
94ce93766d comment nit
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@556 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-01 21:14:57 +00:00
cmpilato
1c6914a304 * viewcvs/lib/viewcvs.py
(view_log_svn): Get "select for diffs" working.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@555 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-01 20:00:18 +00:00
cmpilato
0b682e93b2 Get some basic diff functionality working for Subversion.
* viewcvs/lib/vclib/svn/__init__.py
  (do_diff): New.

* viewcvs/lib/viewcvs.py
  (view_checkout): Be a little smarter with mime types.
  (view_diff_svn): Can this function (buh-bye).
  (view_diff): Get initial Subversion diff support in here.  Also,
    remove the cvs_filename parameter -- this path can be retrieved
    from the request object.
  (main): Update call to view_diff_svn and view_diff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@554 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-01 19:20:37 +00:00
cmpilato
6760cc1c62 Address Issue #584803.
* viewcvs/lib/viewcvs.py
  (search_files): Skip unversioned files.  Thanks to David Resnick and
    Steve Frampton for noticing the problem.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@553 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-27 15:25:55 +00:00
cmpilato
b5d5e9d245 * viewcvs/lib/viewcvs.py
(handle_config): Use '' instead of None for the default value of
    "search".  A bug in urlencode() requires it.
  (view_diff_svn): New placeholder function.
  (Request.__init__, human_readable_diff): No longer chop the '.diff'
    off of the path.
  (main): Reorg the code here a bit.  I'm pretty sure I didn't
    actually change the logic outside of adding: redirect on file
    paths that have the extra '.diff' tacked on, and call the
    view_diff_svn stub at the right time.

* templates/log.ezt
* templates/log_table.ezt
* templates/include/diff_form.ezt
  Stop tacking that confounded ".diff" onto the diff queries.  The
  presence of r1 and r2 are enough to do the job.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@552 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-27 14:53:31 +00:00
cmpilato
d4271f954c * lib/viewcvs.py
(view_log_svn): New hacked-up half-hearted attempted at getting
    Subversion file revision history output.  Boy, if only those
    who've gone before me had documented the cryptic template data
    items, this kind of guesswork and weak deduction would be
    unnecessary... :-)
  (main): Do different stuff if 'rev' or checkout magic exists on a
    Subversion root request.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@551 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-23 17:01:23 +00:00
cmpilato
fefafefa2f * viewcvs/lib/vclib/svn/__init__.py
(LogReceiver.receiver): Add 'paths' argument (unused).
  (fetch_logs): _repos.get_logs is now _repos.svn_repos_get_logs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@550 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-20 20:53:51 +00:00
cmpilato
c73e1cd5a4 * viewcvs/lib/vclib/svn/__init__.py
(_datestr_to_date, _fs_rev_props): New helpers.
  (LogEntry): Edit some comments.
  (LogReceiver): New.
  (get_logs): Use new helpers.
  (fetch_log, get_file_contents): New.
  (SubversionRepository.__init__): Store the repos item as a member.

* viewcvs/lib/viewcvs.py
  (main, view_checkout): Add crap-O Subversion file dump support (this
    is rather temporary, methinks).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@549 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-19 19:28:22 +00:00
cmpilato
87285b75f1 Fix datestamps and sorting for Subversion items.
* viewcvs/lib/vclib/svn/__init__.py
  (get_logs): Use the correct datestamp for Subversion tree items.

* viewcvs/lib/viewcvs.py
  (sort_file_data): Rename internal routine file_sort_cmp() to
    file_sort_cmp_cvs(), and add new file_sort_cmp_svn().  Add
    'roottype' argument to trigger which of those sort routines gets
     used.
  (view_directory_cvs): Update call to sort_file_data().
  (view_directory_svn): Update call to sort_file_data(), and populate
    the row data a little differently.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@548 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-10 17:15:08 +00:00
cmpilato
ab3b8795e3 Continue Subversion integration. Can now view trees (at any revision,
with minor browser Location bar hackery).

* viewcvs/lib/viewcvs.py
  (Request.__init__): Recognize 'rev' CGI field for Subversion roots.
  (sort_file_data): New, with file_sort_cmp() broken out from view_directory.
  (get_file_data_svn, view_directory_svn): New Subversions-specific functions
  (view_directory_cvs): Was view_directory.  Now uses sort_file_data() helper.
  (main): Use the appropriate view_directory_* function per roottype.

* viewcvs/lib/vclib/svn/__init__.py
  (LogEntry): New class (stolen with mods from bincvs)
  (get_logs): New.
  (SubversionRepository): Declare as a subclass of vclib.Repository.
  (SubversionRepository.__init__): Add optional 'rev' argument.  Also,
    make 'basepath' before trying to use it.
  (SubversionRepository._getvf_files, _getvf_subdirs): Fix references
    to 'pool', 'i' and 'thispath'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@547 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-10 14:02:27 +00:00
cmpilato
5b6234678b Begin adding Subversion config and query support. First step was to
rename the 'cvsroot' URL query item to 'root' (while still supporting
'cvsroot' as a valid token that just gets mapped to 'root' under the
hood) and to add support for an svn_roots configuration value (not
added to the default config file as part of this commit, though).

* viewcvs/lib/config.py
  (_parse_roots): New helper.
  (Config._force_multi_value): Add 'svn_roots'.
  (Config._process_section): Use new helper function to parse
    'cvs_roots' and 'svn_roots' configuration items.
  (Config.set_defaults): Initialize default svn_roots config item.

* viewcvs/lib/viewcvs.py
  (_sticky_vars, _legal_params): Rename 'cvs_root' to 'root'.
  (_validate_root): Was _validate_cvsroot.
  (Request.__init__): Patch 'cvsroot' query items to be 'root' items.
    Examine both CVS and Subversion root configurations and choose the
    appropriate repository.
  (view_directory): Show both Subversion and CVS roots in the templates.

* viewcvs/lib/query.py
  (build_commit): Use 'root' in the URL query portion instead of
  'cvsroot'.

* viewcvs/templates/directory.ezt
* viewcvs/templates/dir_alternate.ezt
  Replaces references to 'cvsroot' with 'root'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@546 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-06 20:36:58 +00:00
cmpilato
f8f6b1a69b Itty-bitty docstring fixes.
* viewcvs/lib/vclib/__init__.py
  (Repository._getvf_info): Fix typ-o.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository._getvf_info): Fix typ-o.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@545 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 20:14:32 +00:00
cmpilato
e7c52618b4 Initial implementation of Subversion vclib module.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@544 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 15:24:25 +00:00
gstein
79728fb463 Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@543 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:34:45 +00:00
gstein
4b21d7cb88 Rip out the rlog parser that was in this file. Leverage the parser
from vclib.bincvs instead, and apply a small compatibility layer over
the top of it. tests/testparse.py was used to verify that the new
parser/wrapper is equivalent.

[ things can be simplified further by changing the callers to not
  require the compat wrapper ]


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@542 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:18:30 +00:00
gstein
974eb42d02 This module is no longer needed. Use the vclib.ccvs.rcsparse module
instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@541 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:12:30 +00:00
gstein
44b8e40d50 Switch over to the vclib.ccvs.rcsparse package.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@540 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:11:42 +00:00
gstein
fd4f86f49d Fix up the time processing, based on time processing fixes from
elsewhere (stupid replicated code; will need to fix in future).

Note that we need the 'compat' module here. Also another fix for
later.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@539 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:11:09 +00:00
gstein
7472b19243 Another module that I used for testing a conversion of rlog.py. Just
checking in the code in case something similar may be useful in the
future.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@538 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:00:39 +00:00
gstein
5c4edd8cef Switch to the vclib.ccvs version of rcsparse. Some other assorted
testing tidbits.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@537 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 06:57:49 +00:00
pefu
11ca5c1a37 Bugfix: wrong exception in except clause. Thanks to C. Michael (Mike) Pilato.
He wrote:
> Quick introduction: Hi, I'm C. Michael (Mike) Pilato, a Subversion
> developer (and CollabNet-employed subordinate of Greg Stein) who's
> trying to add Subversion repository support to ViewCVS.  I'm also
> trying to learn Python as I go, so I'm begging for patch review.
>
> Anyways, I figured I'd start off with a little patch that fixes a bug
> I noticed when I (intentionally, I swear) misconfigured ViewCVS.
>
> * lib/viewcvs.py
>   (Request.__init__): bincvs's BinCVSRepository.__init__ actually
>       throws a vclib.ReposNotFound exception.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@536 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-01 11:34:02 +00:00
gstein
dca08bb674 Rename to "path_parts" to clarify that we're referring to a list of
path segments rather than a pathname string.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@535 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-07-18 02:27:21 +00:00
pefu
90db34f205 Inspired by Lucas Bruand email describing the CVSGrab project I
added a new subsection to the home page containing a compiled list of
Links.  This is somewhat redundant with the information contained
in the ViewCVS INSTALL file.  But on the other hand people might
not view the INSTALL file using a web browser, so this list of
links might become handy for all people who want to install
ViewCVS on an operating system which was not delivered with all
those tools preinstalled and who have to grab all those software
from the Net piece by piece.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@534 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-15 10:06:12 +00:00
pefu
d7e6668ef3 Bugfix: Apply SF patch #569246: standalone+enscript = zombies
Holger Hoffst�tte (h2o) wrote:
> When run in standalone mode, using enscript will leave
> zombie processes hanging around. These will not exit
> until the standalone.py process is restarted. The
> attached patch solves this by properly wait()ing for
> the child process. CGI mode is not affected by this,
> since the viewcvs process exits after every request
> anyway.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@533 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-15 09:56:03 +00:00
pefu
854656ea8b Added a link to the EMail explaining the disadvantages of CVS keywords.
...and argghhh... Protect the CVS keyword only used as an example herein.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@532 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-13 06:04:32 +00:00
pefu
bcf951e1b5 Document current policy for the use of CVS $-keyword macros within
the stayle guide paragraph.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@531 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-12 16:54:15 +00:00
pefu
7f580e36dd Fix Python 1.5.2 compatibility problem pointed out in
http://mailman.lyra.org/pipermail/viewcvs-dev/2002-June/000722.html
Unfortunately even the current Python documentation misses to point out,
that the function timegm() was added to the calendar module at a later
release. :-(  I will submit a patch to the Python documentation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@530 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-12 06:38:49 +00:00
lbruand
e944408e70 Small coding style fixes
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@529 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-11 21:27:06 +00:00
gstein
4a3bc3f33a Implement some fixes for recent changes.
* viewcvs.py (Request.__init__): when we switched to use vclib.bincvs,
    the path_parts erroneously contained a '.diff' extension. make
    sure to strip that (found by Peter Funk).

* vclib/__init__.py (class ReposNotFound): don't override the __init__
    the method. the base Exception class will handle the argument as a
    string, and print it out appropriately.
  (class ItemNotFound): clarify that this takes path_parts, then join
    them for the superclass.

* vclib/ccvs/__init__.py (CVSRepository.__init__): don't provide the
    path for the CVS repository (info leakage); just use the name.
  (CVSRepository._getpath): parts are passed, not a pathname; adjust
    variables to clarify this.
  (CVSRepository.getitem, CVSRepository.getitemtype): the ItemNotFound
    exception is defined to take path_parts, not a pathname.

* vclib/bincvs/__init__.py (BinCVSRepository.__init__): pass the name
    of the repository to the ReposNotFound exception.
  (BinCVSRepository.getitem, BinCVSRepository.getitemtype): the
    ItemNotFound exception is defined to take path_parts, not a
    pathname.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@528 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-11 19:32:03 +00:00
pefu
01d04c0397 This might be a clueless fix for the problem outlined in
http://mailman.lyra.org/pipermail/viewcvs-dev/2002-June/000725.html
But it works for me.  Diff display now works again.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@527 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-11 17:42:58 +00:00
lbruand
d857b82cac Modified ccvs so that it conforms to the new API by Greg.
Modified a bit the API also:
 * Added a Versitem class from which both Versfile and Versitem inherite.
 * Added a show_CVSROOT constructor parameter in the CVSRepository.

Now that I am looking over to this code after some time, There are number
of concerns/interrogation that are coming to my mind:
 - Why not go into some more abstraction/polymorphism with the items  ( e.g.
Versfiles and Versdirs):
	shouldn't Versitems  have only one common getitemlist methods ?
	that would return Versitems
( and not two "getsubdirs" and "getfiles" methods...)

 - Quite obviously there are cyclic references in this library.
     This will flaw garbage collection.
    e.g. Versfile points to Repository. and so on...
  According to me deleting a Repository should in turn, result in the destruction of
 its subitems.
 - Another point of concern, we will have to deal with is
multithreading...  One of the current problem of viewcvs is that it does not
have multithreading. ( being a cgi it's kind of normal)  Now, having
multithreading capabilities in vclib would definitely leverage the
difficulty of porting  viewcvs to a servlet-like behaviour. A servlet-like
behaviour would be a big win for speed, according to me.

 - A very important ( if not vital) feature is lacking:
    You cannot select a tag to view in the repository ...
 - There is a problem with subversion ( named svn, from now on...):
svn, as you probably know, represent the evolution of a file hierarchy over time and not the
 evolution of files in hierarchy ( as in CVS). This API does not work with this kind of behaviour.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@526 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-09 22:20:23 +00:00
pefu
7e2052b962 Apply SF patch #565579 by Bill Newcomb (nuke999):
Correct handling of daylight saving

Bill wrote:
> While installing ViewCVS to be used with our (large,
> old, many-branched) repository, we encountered problems
> while trying to build the checkin database.  We
> eventually traced the problems to a file that had a
> checkin on the first sunday of april, when daylight
> saving time begins in the us.  The time of the checkin
> was 02:24 UTC, which is a perfectly reasonable time
> (it's actually still saturday  PST), but feeding that
> time to timelocal will generate an uncaught exception
> in rlog.py.  timegm() has been part of calendar.py
> since at least python 1.5.2, so it seems like an easy
> choice to fix this so it's more robust.  The following
> patch allowed us to get everything converted and
> running, and we really like all the extra stuff that
> ViewCVS has vs. cvsweb.

> rcsparse.py has a similar problem that is apparently
> not exercised by ViewCVS but did trip me up when I
> tried to use it with Subversion's repository converter.
>  There don't appear to my (admittedly Python-naive)
> eyes to be any other places in ViewCVS that use
> timelocal, so I think this should do it.

This patch looks reasonable to me and didn't break anything here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@525 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-07 06:07:30 +00:00
pefu
d92ff2f95e People hacking on templates have difficulties to track down errors.
This is a minor improvement on ezt template syntax error reporting.
Added two examples of bad template syntax to doctest section of the
module docstring.  Added doc string to the exception classes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@524 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-06 13:05:57 +00:00
pefu
5a4a1b7216 Improved error reporting for a certain case of a malformed viewcvs.conf
configuration file.  That happened recently to some new user of ViewCVS.
Users unfamilar with Python have difficulties to interpret a Traceback
printout.

In order to implement this I decided to move the utility function
error() from module lib/viewcvs.py into the module lib/config.py and
import error() in viewcvs from module config.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@523 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-06 07:32:18 +00:00
pefu
2ed28fbc92 More detailed instructions how to implement access restrictions using Apache.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@522 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-06 06:22:00 +00:00
gstein
6925412e53 This commit contains three changes, which I couldn't split back apart
very easily (sorry):

1) use LogEntry for the fileinfo stuff
2) use bincvs.Repository for some basic functionality
3) update bincvs.__init__.py to the API that was checked in last week

* viewcvs.py

  (class Request): remember the split path parts. refine some of the
    error logic and messages. replace .cvsrep and .cvsroot with a
    Repository instance (and use .name and .rootpath instead).
  (_validate_cvsroot): refine the error message
  (clickable_path): use request.repos
  (view_directory, generate_tarball): use request.repos. use LogEntry
    for fileinfo.
  (file_sort_cmp): update for LogEntry
  (view_annotate, cvsgraph_image, viewcvs_graph, search_files,
      view_diff): use repos.rootpath rather than .cvsroot
  (main): tweak the ordering of some checks and dispatching. use the
    repos.itemtype() functionality to test for "is a directory".
    remove test for whether the CVS root exists -- it was done during
    the Request initialization.

* vclib/bincvs/__init__.py

  (_FILE_HAD_ERROR): copied over from viewcvs.py
  (class LogError): new class (unused so far) to represent an error.
  (process_rlog_output): use LogEntry for fileinfo rather than a tuple
  (class BinCVSRepository):
    - change the init to verify the root is a directory, and store the
      name and rootpath (rootpath used to be called basepath).
    - add new .getitem() and .itemtype() methods for retrieving and
      querying about items, respectively.
    - tweak _getpath() joining of paths so we don't have to worry
      about adding a separator onto .rootpath.
    - remove .getfile() (now part of getitem).
    - replace .getsubdirs() with ._getvf_subdirs().
    - replace .getfiles() with ._getvf_files().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@521 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-03 18:35:06 +00:00
gstein
2eb0e6d7b5 Update the API a bit.
* remove .getfile(), .getfiles(), .getsubdirs() from the Repository
  object. add .getitem() as a replacment for fetching items. add
  .itemtype() for determining the type of an item before retrieval.

* add the Versdir class for representing a directory within a
  versioning repository. it implements .getfiles() and .getsubdirs()
  methods for retriving information from within the directory.

* add ._getvf_files() and ._getvf_subdirs() to the Repository for use
  by the Versdir class instances.

* add FILE and DIR symbols for denoting the type of an object in the
  repository. set them as class attributes in Versdir or Versfile.

* add some exception classes for use by concrete vclib implementations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@520 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-30 22:21:54 +00:00
gstein
3c5cb27b94 Upgrade our parameter checking (to resolve CSS attacks) to a much
stricter validation suite.

The 'search' parameter is still not validated, but it is not enabled
by default, and it shouldn't be enabled except in very secure
situations.
(it should still be cgi-escaped at some point for proper display on
 the HTML page, but we don't need to worry about CSS attacks from that
 angle right now)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@519 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-24 07:08:34 +00:00
gstein
0ab5f2107e Problem found by Daniel Rall <dlr@collab.net>:
Netscape 4.x and early Mozillas would not send qvalues with their
    language tags. Even for a simple case (browser sends "en, ja" and
    we have en and ja available), we could produce unexpected (read:
    erroneous) results.

Thus, we now select from multiple matches based on the ordering of the
items in the Accept-Language: header.

I've also added more comments to this code since some of it is rather
opaque.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@518 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-23 19:13:40 +00:00
gstein
4ea09932a2 Only attempt to set paths in the Python source code. We don't want to
accidentally do this in a jpeg or whatever. (yah, unlikely, but it is
easy to say "just python source" since we already have the flag)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@517 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-22 09:01:14 +00:00
gstein
cf4f673448 Remove items that have been shifted over to vclib.bincvs
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@516 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-22 01:17:42 +00:00
gstein
e3a4336d40 Enable installation of entire trees so that we don't have to name all
the files individually.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@515 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-22 01:16:07 +00:00
gstein
f7fc5bb6f7 Various fixes to realign the functions from viewcvs back to their
original form, to tweak the imports, and to get the functions working
within their new context.

* realign parse_log_header() with the original from viewcvs.py. rather
  than updating a target object, the caller just grabs the relevant
  data from the returned LogHeader object.

* bring over various global constants for the parsing (e.g. _EOF_*)

* pass 'rcs_path' since cfg.general.rcs_path is not available

* add fetch_log() from viewcvs.py. only change is to pass rcs_path.

* change imports:
  - import 'vclib' rather than symbols from 'vclib'
  - import 'time' and 'compat' for some functions
  - don't import 'exceptions' since those are builtin anyways


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@514 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-21 22:47:16 +00:00
timcera
99ab86e91c Added redirection for bare script name that is missing the trailing '/'.
* Request class now tests for 'PATH_INFO', if None, then redirects URL.
  Required 'SERVER_URL' in order to not have the server remove the '/'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@513 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-17 17:42:12 +00:00
pefu
a9a59a9961 Tim Cera wrote:
>   Added UTC/localtime feature based on patch supplied by Guy Davis in
>   '[ 548889 ] Local time display option'.
[...]
I got CET displayed even for times in July, where it should read CEST
since we are 2 hours earlier here in summer instead of the usual 1 hour in
winter due to daylight saving time.  Hopefully I fixed this correctly.

Unfortunately nobody committed something into my CVS repository in those
nights where transitions from normal to daylight saving time and vice versa
happened.  So I didn't tested those particular nesty cases of time display.

BTW: I believe the whole idea of daylight savings time sucks...  but since
we have this everywhere here in the EU this is not going to change soon. :-(


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@512 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-06 06:43:39 +00:00
pefu
cb5c3b30d3 Added a new toggle to the Tkinter GUI to be able to test the
the new 'use_localtime' configuration option added by Tim Cera
yesterday (based on SF patch #548889 by Guy Davis).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@511 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-06 06:17:46 +00:00
timcera
ce16ab01b0 Added UTC/localtime feature based on patch supplied by Guy Davis in
'[ 548889 ] Local time display option'.
* Made a 'make_time_string' function that returns formatted date
  string in localtime or UTC, based on configuration choices.
* Added 'use_localtime' option in 'cgi/viewcvs.conf.dist' and
  'lib/config.py'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@510 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-06 02:05:25 +00:00
timcera
1b9de04258 * Added 'GNUmakefile' to enscript_filename so that enscript will color
GNUmakefiles.  See 'Feature Request' - '[ 551690 ] colorize GNUmakefile
  like makefile'.
* Moved '.for: fortran' in enscript_extensions to maintain sort order.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@509 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-05 12:03:55 +00:00
timcera
c01aa7d4fe For some reason, Python 1.5.2 would not accept a compiled pattern. Moved the
pattern text directly into the re.search.  This search is for nefarious
characters :-) that could be used in a CSS attack.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@508 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-30 19:39:51 +00:00
timcera
837c82f2f1 Changes to the onClick handlers. Patch from Ville Skytt� (scop).
Basically include a 'return false;' and replace 'about:blank's.
See [ 541050 ] Bad onclick handler implementation at
http://sourceforge.net/tracker/index.php?func=detail&aid=541050&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@507 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-27 20:24:12 +00:00
gstein
217169c9f8 Fix the style in these two files. Lots of white space was needed.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@506 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-26 08:51:05 +00:00
gstein
18b0f10c6e switch to a single, top-level makefile
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@505 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-26 08:01:41 +00:00
gstein
70d991b700 Big changes to the basic elem extraction tools.
* elx-common.c: new file for common file handling and token / symbol
    output.

* elx.h: expanded for new functions in elx-common.

* elx-java.c: switch to using a context for the files, and rely on the
    common functions to open/close and output stuff.

* elx-python.c: switch to using a context for the files, and rely on
    the common functions to open/close and output stuff. the
    identifier that we fetch is now null-term'd, so don't bother with
    a bunch of stuff to null-term it.

* scanner.c: null-term the identifier.

* elx_html.py: generate a full page, not just a body. use buffers to
    reference slices, rather than constructing slices. (and some test
    code to try binary files)

* add a couple .cvsignore files


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@504 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-26 08:00:53 +00:00
timcera
10ed9dbf05 Sorting not working right, but for different reasons.
* Did something about the 'None' values from fileinfo.  Now 'None' values
  are changed to _FILE_HAD_ERROR.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@503 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-18 02:54:21 +00:00
timcera
96300b1257 Sorting in the directory view under some situations would fail.
* Included patch from "[ 523275 ] Sorting bug fix (0.9.2)" from Jordan Russell
* Removed the substitution of "None" for "_FILE_HAD_ERROR" and changed
  tests appropriately.
* Moved section of code that sorts the filenames and changed logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@502 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-15 03:01:48 +00:00
lbruand
b7ced98ac2 debugged a checkout bug when a revision had a two-digit last number in a branch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@501 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-14 21:31:41 +00:00
lbruand
25b5885a6b A working version of vclib.ccvs. Need a lot of debugging. Writing a driver
(called bincvs) for vclib that uses rlog and co binary rcs commands.
Added a few tests scripts.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@500 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-13 09:43:22 +00:00
timcera
6777801f27 A very low tech approach at validating URL input. Greg wants
restriction of each variable to it's allowed set of values, but I
couldn't do that quickly.  This works and I think a little easier
to maintain.  If it is found lacking I can improve later.  If a re
search of value finds '\'|"|<|>' the (name, value) pair is not put
into query_dict.  I can't think of a ViewCVS created URL, except
for search, that would have any of those characters.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@499 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-01 01:32:16 +00:00
gstein
cdaba43ea1 I've been screwing around for *days* trying to tweak this darned Java
grammar. Forget it for now, and checkpoint what I've done.

The elx-python and elx-java programs produce "element" text files
which can then be consumed by elx_html.py to produce syntax-colored
HTML output. elx_page.sh is a little wrapper around that to produce a
full page.

The Python stuff seems quite fine, and is blazing fast (the scanner
runs over 100k lines/second). The Java grammar is horked, so it does
work (the Java scanner seems fine; just the grammar).

Lots more to do on this, but I'm out for the weekend, so this it's
time to check point this. Maybe someone will have better ideas on how
to fix the Java parser. Note that this stuff requires the 'msta' and
'shilka' programs from the 'cocom' toolkit.

I still need to package this up nicely (some copyright/license
notices, better makefiles, some minimal doc, etc). I also want to mess
around with profiling the syntax coloring. It appears to be a bit
slower than enscript right now, but it shouldn't be since we've
already parsed the file by that point (gonna try binary element files,
and some perf improvements to elx_html.py).

General theory: write elx-* for any language needing cross-referencing
capabilities (things that only need hiliting can continue to use
enscript). The elx-* programs can be implemented in any fashion, as
long as it produces the element description file. Python, Perl, pure
C, automated scanner/parser, whatever.

Future steps include using the element description file to get
function names, to index them, and to feed that into the HTML
generation. It would also be quite possible to feed the element
descriptions right into a database and query from there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@498 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-03-15 01:54:28 +00:00
pefu
c4942bf983 Russell Yanofsky (rey4@sourceforge.net) obviuosly spend a lot of time
porting ViewCVS to windows and added ASP support.  His patch #526282
is quite huge and this first step only commits the newfiles.tgz to CVS,
because this shouldn't break anything.  I will not commit the actual
patches contained in diff.txt until I've spend some time testing it here
with Linux because Russell wrote he didn't has the possibility to test
with Unix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@497 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-03-06 09:53:08 +00:00
pefu
fb897f7db8 As pointed out on the mailing list, the TCPServer class from the
Python standard library is missing a close_request method.  See
Lucas Bruands followup message in SF patch #522034 and Greg Steins
mail:
   http://mailman.lyra.org/pipermail/viewcvs-dev/2002-February/000562.html
Furthermore I added a try except IOError-clause to catch those
Broken Python exceptions, if someone hits the Stop-button of his
browser while retrieving a huge page.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@496 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-03-01 07:32:07 +00:00
pefu
2fbce441df Started spring cleanup... ;-) A lot more is missing here.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@495 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-28 17:59:12 +00:00
pefu
a80d3e8cb8 apply a slightly modified version of Lucas Brand patch #522034
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@494 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-28 17:53:00 +00:00
gstein
e47409ce23 Minor tweaks to get this stuff working.
* ccvs/__init__.py: the package is 'vclib' rather than 'versionlib'

* rcsparse/texttools.py: the string module is needed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@493 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-23 00:16:18 +00:00
akr
b80e352f5e Don't contain a forbidden module in a tarball.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@492 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-22 09:20:46 +00:00
pefu
10cf1131c5 Esben Haabendal Soerensen suggested on viewcvs-dev:
> Ville Skytt <ville.skytta@xemacs.org> writes:

> > I noticed some problems with the sunsite.dk ViewCVS setup
> > (cvs.xemacs.org in particular) that look like virtual host configuration
> > problems.
> >
> > I'm CC'ing viewcvs-dev in case someone there wants to look at the python
> > traceback.
> >
> > If the Host: header sent by a browser contains the port number (eg.
> > Host: cvs.xemacs.org:80), ViewCVS fails. If the :80 part is not in the
> > header, everything works fine. It looks like a problem specific to
> > sunsite.dk (for example http://cvs.open-bio.org/ doesn't have the same
> > problem and is running ViewCVS 0.9.2 too). To reproduce:

> I have fixed this problem.  It is necessary to add the special case
> with :80 appended.  So I now have:

> [vhosts]
> main = cvs.sunsite.dk, cvs.sunsite.dk:80
> xemacs = cvs.xemacs.org, cvs.xemacs.org:80

> In our viewcvs.conf.  My guess is that Sunsite.dk is not the first and
> will not be the last site to not think of this.  Perhaps future
> versions of ViewCVS could ignore port numbers if only one vhost
> matches the domain...

In fact I now simply ignore the port number in vhost lookup.
Please tell me if this is to harsh.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@491 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-20 07:11:48 +00:00
pefu
caed1bbc6f Improve misleading docstring (Thanks to Lucas Bruand for pointing this out).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@490 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-20 07:02:08 +00:00
lbruand
fca8276255 Memory leaks bugfix, by D. Berlin
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@489 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 20:22:11 +00:00
pefu
09aee9f2a8 I've tried to optimize Tims new prepare_hidden_values() function and
added a doc string.
I'm not really sure, whether the well known Python idiom to perform
string concatenation through list.append() will really pay off
here, since the list of hidden values is really short most of the time.
But I couldn't resist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@488 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:55:57 +00:00
pefu
1d1b308d87 During testing with standalone.py I got a lot of
annoying 301 redirection "errors".  I tracked them
down to missing trailing slashes.  This change adds
these slashes to the directory URLs.  I'm not sure
whether this is right cure for the problem.  Please
review and comment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@487 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:51:06 +00:00
pefu
f583f7fc50 Sync with Tims changes to directory.ezt
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@486 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:26:10 +00:00
pefu
53b39b5950 Modified the '-r' option to aid testing of ViewCVS with more than one
repository withut actually having to install ViewCVS.  I now usually
use ./standalone.py -g -r /cvs1 -r /cvs2 to test my uncommited hacks to
the ViewCVS sources.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@485 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:02:11 +00:00
timcera
10a05b47f1 I think this fixes the cvsroot= not being propogated correctly in
the URLs.  It also fixes a problem with directory.ezt not having
closed </form> tags under certain conditions.
  *) Abstracted out a prepare_hidden_values function to create the
     appropriate hidden values for a particular form.  Should have
     everything in _sticky_vars in the request object as a hidden
     value EXCEPT the value(s) set by the form.
  *) Edited directory.ezt to use the new system.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@484 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 10:52:23 +00:00
lbruand
ed3bf198b7 remove tparse/sink.py & testtp.py, now redundant
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@483 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 18:24:55 +00:00
lbruand
718b506a9f * Removed debugging statments from the (C++) Sink class.
* Changed INSTALL to reflect the move of rcsparse to lib/vclib/ccvs/rcsparse.
  * Now when tparse cannot import common.py, it fails.
  * Added check for sink being of common.Sink class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@482 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 18:19:12 +00:00
gstein
2acf85261a Some whitspace, spelling, and minor formatting tweaks. No functoinal
change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@481 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 13:37:46 +00:00
gstein
ff8d47b670 Shift around some more code. Remove duplicate Parser classes.
* __init__.py: revise the import tests to just end up with an exported
  function named "parse" to parse an RCS file. move the test/debug
  functions to the new debug.py module.

* common.py: add mising imports. move DebugSink and DumpSink classes
  to the new debug.py module. tweak the RCSExpected class a bit to
  call the init method for its parent. move the Parser class here,
  expecting subclasses to set the .stream_class attribute.

* default.py: toss the 'time' import and import 'common' as a module,
  rather than getting all symbols from it. clarify where the
  CHUNK_SIZE value comes from. use common._Parser, but leave the
  parse_rcs_admin() method until we fix the token parsing for proper
  ":" handling.

* texttools.py: use 'common' as a module, rather than grabbing
  symbols. clarify CHUNK_SIZE. use common._Parser

* debug.py: shift DebugSink, DumpSink, and some utility funcs here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@480 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 12:17:38 +00:00
gstein
455641bf37 Renamed these two files for clarity. No changes (those will come in a
separate commit, where we can actually see/record diffs more easily).

* pythparse.py was renamed to default.py: "pyth" is a funny
  abbreviation, "parse" is redundant with the "rcsparse" package name.
  this is intended as the default/fallback parser, so "default" is good.

* textparse.py was renamed to texttools.py: "text" is too generic.
  "texttools" describes the basis of the module better.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@479 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 10:53:38 +00:00
gstein
a86ad034e2 These files somehow got ^M characters into them, but were not being
subjected to proper newline translation. Removing the ^M characters so
that we can get some good diffs occurring, and to (hopefully) fix the
translation stuff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@478 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 08:31:36 +00:00
lbruand
928ffd54d6 Import of vclib
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@477 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-11 21:03:31 +00:00
lbruand
87f43f02d5 Support for parser exceptions RCS*
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@476 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-11 20:13:50 +00:00
lbruand
8eec37e768 Daniel Berlin's patch
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@475 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 17:32:27 +00:00
pefu
9843b1b890 Improved diagnostics, if modules are not availabe on a certain Python
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@474 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 08:26:54 +00:00
pefu
6c216e387e Fixed sequence in content listing. Added a note about
standalone -g requiring thread support and Tkinter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@473 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 07:39:10 +00:00
pefu
44918c941c Added a new section about Apache configuration
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@472 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 07:13:44 +00:00
timcera
314efa19da Added down.png and up.png for sorting on dir pages.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@471 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-07 13:21:21 +00:00
pefu
67de5edd63 Correct hasty checkin (URL path to icons went wrong)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@470 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-07 10:03:29 +00:00
pefu
1d120d8991 Inspired by Tim Ceras EMail this morning
( http://mailman.lyra.org/pipermail/viewcvs-dev/2002-February/000485.html )
I added sort direction toggles to the directory view.  It works.
But unfortunately the table header code in the template becomes very
bloated.  So I decided to put this only into dir_alternate.ezt for the
time being.  Please play around with it and review.  Putting
directory.ezt back into sync can be done later.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@469 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-07 09:08:50 +00:00
timcera
8b95292331 Hopefully adapts to enscript version 1.6.3 and later.
Shifted to the long options for enscript.  The short options are
either no longer tolerant of a missing ',' or they have changed.

Tested with enscript 1.6.2, so nothing has broken, but still need
verification that ViewCVS works with 1.6.3.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@468 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-05 22:55:03 +00:00
pefu
0988e943f6 see http://mailman.lyra.org/pipermail/viewcvs-dev/2002-February/000475.html
That's why I tried to improve diagnostics here


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@467 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-05 08:16:19 +00:00
pefu
30b78cf376 Added the recently added 'use_pagesize' option to the GUI
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@466 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-05 07:24:37 +00:00
pefu
2c9ccd262e Trying to keep this in sync with directory.ezt. :-(
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@465 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 07:40:21 +00:00
timcera
44651e5b2e * Fixed bug where a directory of only directories still had the search
files option.
  * Rearranged table to make 'Show all files' button lined up with the 'Show'
    button.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@464 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 04:08:51 +00:00
timcera
794a72f201 Added a page number to the page pick list.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@463 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 04:05:46 +00:00
timcera
705a54514e Corrected small errors noticed by pychecker.
* Multiple imports of the same module.
  * Module imported but never used.
  * Variables only used once.
  * Corrected deprecated modules.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@462 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 03:43:56 +00:00
timcera
8004d3ed59 Made common elements of the log templates into include files. Makes the
templates much easier to read and allows easier movement of the
elements around on the page.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@461 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 03:29:25 +00:00
timcera
d72922d81b This changes the behavoir of the View and Download links on log and log_table.
* For text files:
  'Download' opens download to file dialog box
  'View as Text' displays revision in new window
  'View as markup' displays enscript colored view with header information
  'View annotated' displays blame

* For gif, jpeg, and png:
  'View' displays graphic with header information similar to text markup

* For other binaries:
  'View/Download' will either view or download depending on browser's
   mime type / application settings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@460 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 03:02:17 +00:00
lbruand
6afc2fb4f1 return wrong value in tparse.cpp
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@459 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-30 18:27:34 +00:00
lbruand
05e605e3da Few modification and debugging...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@458 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-30 18:24:17 +00:00
gstein
3d6755bcde Fix construction of state token: it was always appending a space, when
it should do that only when multiple states are found.

Fix parsing of dates. Some CVS files have a two-digit year (e.g. 99).
So we try parsing a 2-digit year first; if that fails, then we try a
four digit year.

timelog.compare_fetch() now shows tparse generating the same output to
the sink.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@457 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-29 11:30:10 +00:00
gstein
b37103c4d7 Check in the mxTextTools-based parser that I implemented back in
November. The timelog.fetch_log2() timing dropped from .53 seconds for
my test input to .34 seconds. Overall stream speed dropped from .25
seconds to .10 seconds.

This also introduces an mget() method on the token stream so that the
parser can get multiple tokens in one shot, rather than needing to
call many times.

In timelog, I've added a new compare_many() for big verifications,
time_stream to time individual token streams, profile_stream for
profiling streams, and revised the time_fetch function to do multiple
fetches and to trim the exceptional cases off the ends before
reporting.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@456 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-29 10:08:46 +00:00
lbruand
2c245d2bdb CHANGES update
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@455 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-27 14:01:53 +00:00
lbruand
fdb39468d3 added INSTALL file and various small modif.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@454 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-27 13:57:29 +00:00
lbruand
a163e8b5b8 Initial revision of the C++ RCS parser.
VS: ----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@453 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-25 17:36:15 +00:00
timcera
a25b2de3f9 This corrects some problems with rcsdiff header processing.
* Symbolic constants for tests.
* Moved text to diff.ezt template.
* Used elif to clean up logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@452 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-24 02:17:53 +00:00
timcera
ed9d473ff1 * Added template components to templates/include.
* Added description of remaining install step at end of install.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@451 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-23 05:24:31 +00:00
timcera
d24e850723 Added complete processing of rcsdiff header.
* Binary files are treated appropriately, detecting if there are differences
  or not.  Should fix part of feature request '[ #497044 ] Hide Diffs for
  Binaries'.
* Detects whether diff is accessible to rcsdiff and whether diff is GNU diff.
  Might move a diff test to viewcvs-install.  Advantage to it being here is
  that it responds to the CGI environment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@450 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-23 05:05:18 +00:00
timcera
a30ae3877a Created template components and put in templates/include directory.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@449 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-23 04:18:26 +00:00
pefu
d54413e580 Don't complain about the release files kept in
/home/groups/v/vi/viewcvs/htdocs @ sf.net when doing a cvs update there


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@448 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-22 08:51:06 +00:00
pefu
8145be1151 Added a comment pointing out, that the -C option of enscript doesn'nt work
with HTML output.  TODO:  Invent a way to generate line numbers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@447 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-22 08:42:23 +00:00
pefu
40e4f03f27 Added a paragraph clarifying howto upgrade to the latest version with
skipping one or more releases inbetween.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@446 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-22 08:38:21 +00:00
timcera
477599ee40 * Used pychecker to identify unused variables.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@445 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-17 04:01:08 +00:00
timcera
1f72a98e9e * Fixed bug in search_files where every file was identified as 'text/plain'. This was from not removing the ',v' from the file name before it was tested by mimetypes.
* Made the test for text files much clearer to read.
* Added/changed comments in search_files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@444 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-17 03:52:20 +00:00
gstein
cd5fedd3dd update for 0.9.2
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@441 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-15 09:55:01 +00:00
gstein
dff5d57e76 describe the changes in 0.9.2
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@438 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-15 09:10:43 +00:00
gstein
c832f96e5b Fix a problem with diffs between revisions that have no changes. The
state was never getting set to "done" (== was used rather than =).
This also uncovered a problem where left_col and right_col were not
initialized before use, so get them set to empty values.

Reported by: Sam Mason <smason@mtc.ricardo.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@437 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-10 01:26:36 +00:00
akr
385c97ba04 redirect to Attic for diffs didn't work.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@436 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-05 05:40:09 +00:00
pefu
4fcf12e391 Richard Offer posted Patch [ #498165 ] listen on non loopback interfaces:
> The attached patch adds the ability for the standalone
> server to listen on interfaces other than the loopback
> (localhost).
>
>  usage:
>
>  ./standalone -h `hostname`
>
>  Will allow anyone not on the localmachine to still view
> the cvs repo, without requiring a full-blown web server
> be set up first.
>
>
>  Patch is against release 0.9.1

I must admit, that I personally don't fully understand, why this
should be required.  But after adding some additional lines to the
gui() function and to the option initialization I applied this patch.
I tested it here with the name of my notebook and didn't see any
difference.  So at least it didn't hurt. ;-)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@435 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-02 18:50:57 +00:00
timcera
16bcb9e218 Added paging capability.
* Added use_pagesize to viewcvs.conf.dist and config.py
  * Modified directory and log templates to have a <select>
    pulldown menu based on files for directory views and revs
    for file logs.  Also setup to make the current page the
    'selected' item in the pulldown.
  * Added paging function to viewcvs.py.  Called from
    view_directory and view_log.
  * Added two variables to the _sticky_vars, dir_pagestart and
    log_pagestart.  Couldn't use a single pagestart var because
    it stuck around between the directory and log pages.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@434 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-31 04:39:34 +00:00
gstein
f75d262553 I disagree that 0.10 is confusing, but I guess we *do* have to call
this thing 1.0 at some point :-)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@433 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 08:17:53 +00:00
gstein
49b970079c More info on making a release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@432 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 08:17:07 +00:00
gstein
b815e6ece7 update for 0.9.1
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@430 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 05:18:35 +00:00
gstein
c35dabcaeb Rolling 0.9.1
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@429 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 05:17:51 +00:00
gstein
f45b5f8d7f bleck... a debug statement was left in the code. all those people with
0.9 are going to see a really large /tmp/log file...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@428 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 05:15:47 +00:00
pefu
44528c0b7e quick backport to Python 1.5.2
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@427 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-24 11:38:30 +00:00
pefu
11f594b7ed Using 0.10 as a version number AFTER 0.9 is a really bad idea and
will cause a lot of confusion, because many people will think 0.10 < 0.9!

Since the main functionality of ViewCVS is mature, there is no need to
avoid bumping up the version up to 1.0-dev.  I do that right now.

Merry Xmas to all.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@426 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-23 15:54:18 +00:00
gstein
8a9719a5f8 we're developing 0.10 now...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@425 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-23 12:04:32 +00:00
182 changed files with 27132 additions and 9681 deletions

176
CHANGES
View File

@@ -1,3 +1,179 @@
Version 1.0.6 (released 16-Sep-2008)
* security fix: ignore arbitrary user-provided MIME types (issue #354)
* fix bug in regexp search filter when used with sticky tag (issue #346)
* fix bug in handling of certain 'co' output (issue #348)
* fix regexp search filter template bug
* fix annotate code syntax error
* fix mod_python import cycle (issue #369)
Version 1.0.5 (released 28-Feb-2008)
* security fix: omit commits of all-forbidden files from query results
* security fix: disallow direct URL navigation to hidden CVSROOT folder
* security fix: strip forbidden paths from revision view
* security fix: don't traverse log history thru forbidden locations
* security fix: honor forbiddenness via diff view path parameters
* new 'forbiddenre' regexp-based path authorization feature
* fix root name conflict resolution inconsistencies (issue #287)
* fix an oversight in the CVS 1.12.9 loginfo-handler support
* fix RSS feed content type to be more specific (issue #306)
* fix entity escaping problems in RSS feed data (issue #238)
* fix bug in tarball generation for remote Subversion repositories
* fix query interface file-count-limiting logic
* fix query results plus/minus count to ignore forbidden files
* fix blame error caused by 'svn' unable to create runtime config dir
Version 1.0.4 (released 10-Apr-2007)
* fix some markup bugs in query views (issue #266)
* fix loginfo-handler's support for CVS 1.12.9 (issues #151, #257)
* make viewvc-install able to run from an arbitrary location
* update viewvc-install's output for readability
* fix bug writing commits to non-MyISAM databases (issue #262)
* allow long paths in generated tarballs (issue #12)
* fix bug interpreting EZT substitute patterns
* fix broken markup view disablement
* fix broken directory view link generation in directory log view
* fix Windows-specific viewvc-install bugs
* fix broke query result links for Subversion deleted items (issue #296)
* fix some output XHTML validation buglets
* fix database query cache staleness problems (issue #180)
Version 1.0.3 (released 13-Oct-2006)
* fix bug in path shown for Subversion deleted-under-copy items (issue #265)
* security fix: declare charset for views to avoid IE UTF7 XSS attack
Version 1.0.2 (released 29-Sep-2006)
* minor documentation fixes
* fix Subversion annotate functionality on Windows (issue #18)
* fix annotate assertions on uncanonicalized #include paths (issue #208)
* make RSS URL method match the method used to generate it (issue #245)
* fix Subversion annotation to run non-interactively, preventing hangs
* fix bug in custom syntax highlighter fallback logic
* fix bug in PHP CGI hack to avoid force-cgi-redirect errors
Version 1.0.1 (released 20-Jul-2006)
* fix exception on log page when use_pagesize is enabled
* fix an XHTML validation bug in the footer template (issue #239)
* fix handling of single-component CVS revision numbers (issue #237)
* fix bug in download-as-text URL link generation (issue #241)
* fix query.cgi bug, missing 'rss_href' template data item (issue #249)
* no longer omit empty Subversion directories from tarballs (issue #250)
* use actual modification time for Subversion directories in tarballs
Version 1.0 (released 01-May-2006)
* add support for viewing Subversion repositories
* add support for running on MS Windows
* generate strict XHTML output
* add support for caching by sending "Last-Modified", "Expires",
"ETag", and "Cache-Control" headers
* add support for Mod_Python on Apache 2.x and ASP on IIS
* Several changes to standalone.py:
- -h commandline option to specify hostname for non local use.
- -r commandline option may be repeated to use more than repository
before actually installing ViewCVS.
- New GUI field to test paging.
* add new, better-integrated query interface
* add integrated RSS feeds
* add new "root_as_url_component" option to embed root names as
path components in ViewCVS URLs for a more natural URL scheme
in ViewCVS configurations with multiple repositories.
* add new "use_localtime" option to display local times instead of UTC times
* add new "root_parents" option to make it possible to add and
remove repositories without modifying the ViewCVS configuration
* add new "template_dir" option to facilitate switching between sets of
templates
* add new "sort_group_dirs" option to disable grouping of
directories in directory listings
* add new "port" option to connect to a MySQL database on a nonstandard port
* make "default_root" option optional. When no root is specified,
show a page listing all available repositories
* add "default_file_view" option to make it possible for relative
links and image paths in checked out HTML files to work without
the need for special /*checkout*/ prefixes in URLs. Deprecate
"checkout_magic" option and disable by default
* add "limit_changes" option to limit number of changed files shown per
commit by default in query results and in the Subversion revision view
* hide CVS "Attic" directories and add simple toggle for showing
dead files in directory listings
* show Unified, Context and Side-by-side diffs in HTML instead of
in bare text pages
* make View/Download links work the same for all file types
* add links to tip of selected branch on log page
* allow use of "Highlight" program for colorizing
* enable enscript colorizing for more file types
* add sorting arrows for directory views
* get rid of popup windows for checkout links
* obfuscate email addresses in html output by encoding @ symbol
with an HTML character reference
* add paging capability
* Improvements to templates
- add new template authoring guide
- increase coverage, use templates to produce HTML for diff pages,
markup pages, annotate pages, and error pages
- move more common page elements into includes
- add new template variables providing ViewCVS URLs for more
links between related pages and less URL generation inside
templates
* add new [define] EZT directive for assigning variables within templates
* add command line argument parsing to install script to allow
non-interactive installs
* add stricter parameter validation to lower likelihood of cross-site
scripting vulnerabilities
* add support for cvsweb's "mime_type=text/x-cvsweb-markup" URLs
* fix incompatibility with enscript 1.6.3
* fix bug in parsing FreeBSD rlog output
* work around rlog assumption all two digit years in RCS files are
relative to the year 1900.
* change loginfo-handler to cope with spaces in filenames and
support a simpler command line invocation from CVS
* make cvsdbadmin work properly when invoked on CVS subdirectory
paths instead of top-level CVS root paths
* show diff error when comparing two binary files
* make regular expression search skip binary files
* make regular expression search skip nonversioned files in CVS
directories instead of choking on them
* fix tarball generator so it doesn't include forbidden modules
* output "404 Not Found" errors instead of "403 Forbidden" errors
to not reveal whether forbidden paths exist
* fix sorting bug in directory view
* reset log and directory page numbers when leaving those pages
* reset sort direction in directory listing when clicking new columns
* fix "Accept-Language" handling for Netscape 4.x browsers
* fix file descriptor leak in standalone server
* clean up zombie processes from running enscript
* fix mysql "Too many connections" error in cvsdbadmin
* get rid of mxDateTime dependency for query database
* store query database times in UTC instead of local time
* fix daylight saving time bugs in various parts of the code
Version 0.9.4 (released 17-Aug-2005)
* security fix: omit forbidden/hidden modules from query results.
Version 0.9.3 (released 17-May-2005)
* security fix: disallow bad "content-type" input [CAN-2004-1062]
* security fix: disallow bad "sortby" and "cvsroot" input [CAN-2002-0771]
* security fix: omit forbidden/hidden modules from tarballs [CAN-2004-0915]
Version 0.9.2 (released 15-Jan-2002)
* fix redirects to Attic for diffs
* fix diffs that have no changes (causing an infinite loop)
Version 0.9.1 (released 26-Dec-2001)
* fix a problem with some syntax in ndiff.py which isn't compatible
with Python 1.5.2 (causing problems at install time)
* remove a debug statement left in the code which continues to
append lines to /tmp/log
Version 0.9 (released 23-Dec-2001)
* create templates for the rest of the pages: markup pages, graphs,

27
COMMITTERS Normal file
View File

@@ -0,0 +1,27 @@
The following people have commit access to the ViewVC sources.
Note that this is not a full list of ViewVC's authors, however --
for that, you'd need to look over the log messages to see all the
patch contributors.
If you have a question or comment, it's probably best to mail
dev@viewvc.tigris.org, rather than mailing any of these people
directly.
gstein Greg Stein <gstein@lyra.org>
jpaint Jay Painter <???>
akr Tanaka Akira <???>
timcera Tim Cera <???>
pefu Peter Funk <???>
lbruand Lucas Bruand <???>
cmpilato C. Michael Pilato <cmpilato@collab.net>
rey4 Russell Yanofsky <rey4@columbia.edu>
mharig Mark Harig <???>
northeye Takuo Kitame <???>
jamesh James Henstridge <???>
maxb Max Bowsher <maxb1@ukf.net>
eh Erik Hülsmann <e.huelsmann@gmx.net>
## Local Variables:
## coding:utf-8
## End:
## vim:encoding=utf8

615
INSTALL
View File

@@ -1,10 +1,12 @@
CONTENTS
--------
TO THE IMPATIENT
INSTALLING VIEWCVS
UPGRADING VIEWCVS
SECURITY INFORMATION
INSTALLING VIEWVC
APACHE CONFIGURATION
UPGRADING VIEWVC
SQL CHECKIN DATABASE
ENSCRIPT CONFIGURATION
ENABLING SYNTAX COLORATION
CVSGRAPH CONFIGURATION
IF YOU HAVE PROBLEMS...
@@ -13,227 +15,395 @@ TO THE IMPATIENT
----------------
Congratulations on getting this far. :-)
Prerequisites: Python 1.5 or later
(http://www.python.org/)
RCS, Revision Control System
(http://www.cs.purdue.edu/homes/trinkle/RCS/)
read-only, physical access to a CVS repository
(See http://www.cvshome.org/ for more information)
Required Software And Configuration Needed To Run ViewVC:
Optional: a web server capable of running CGI programs
(for example, Apache at http://httpd.apache.org/)
GNU-diff to replace broken diff implementations
(http://www.gnu.org/software/diffutils/diffutils.html)
MySQL to create and query a commit database
(http://www.mysql.com/)
(http://sourceforge.net/projects/mysql-python)
(and Python 1.5.2 or later)
Enscript to colorize code displayed from the CVS repository
(http://people.ssh.com/mtr/genscript/)
CvsGraph for a graphical representation of the CVS revisions
(http://www.akhphd.au.dk/~bertho/cvsgraph/)
For CVS Support:
GUI Operation:
* Python 1.5.2 or later
(http://www.python.org/)
* RCS, Revision Control System
(http://www.cs.purdue.edu/homes/trinkle/RCS/)
* GNU-diff to replace diff implementations without the -u option
(http://www.gnu.org/software/diffutils/diffutils.html)
* read-only, physical access to a CVS repository
(See http://www.cvshome.org/ for more information)
If you just want to see what your CVS repository looks like with
ViewCVS, type "./standalone.py -g -r /PATH/TO/CVS/ROOT". This
will start a tiny webserver serving at http://localhost:7467/.
For Subversion Support:
* Python 2.0 or later
(http://www.python.org/)
* Subversion, Version Control System, 1.2.0 or later
(binary installation and Python bindings)
(http://subversion.tigris.org/)
Optional:
* a web server capable of running CGI programs
(for example, Apache at http://httpd.apache.org/)
* MySQL 3.22 and MySQLdb 0.9.0 or later to create a commit database
(http://www.mysql.com/)
(http://sourceforge.net/projects/mysql-python)
* Enscript, code colorizer
(http://www.codento.com/people/mtr/genscript/)
* Highlight, code colorizer, 2.2.10 or later required, 2.4.5 or
later recommended for reliable line numbering
(http://www.andre-simon.de/)
* CvsGraph 1.5.0 or later, graphical CVS revision tree generator
(http://www.akhphd.au.dk/~bertho/cvsgraph/)
Quick sanity check:
If you just want to see what your repository looks like when seen
through ViewVC, type:
$ bin/standalone.py -r /PATH/TO/REPOSITORY
This will start a tiny ViewVC server at http://localhost:7467/viewvc/,
to which you can connect with your browser.
Standard operation:
To start installing right away (on UNIX): type "./viewcvs-install"
To start installing right away (on UNIX): type "./viewvc-install"
in the current directory and answer the prompts. When it
finishes, edit the file viewcvs.conf in the installation directory
to tell viewcvs the paths to your CVS repositories. Next,
configure your web server to run <INSTALL>/cgi/viewcvs.cgi, as
appropriate for your web server. The section `INSTALLING VIEWCVS'
below is still recommended reading.
finishes, edit the file viewvc.conf in the installation directory
to tell ViewVC the paths to your CVS and Subversion repositories.
Next, configure your web server (in the way appropriate to that browser)
to run <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi. The section
`INSTALLING VIEWVC' below is still recommended reading.
INSTALLING VIEWCVS
SECURITY INFORMATION
--------------------
ViewVC provides a feature which allows version controlled content to
be served to web browsers just like static web server content. So, if
you have a directory full of interrelated HTML files that is housed in
your version control repository, ViewVC can serve those files as HTML.
You'll see in your web browser what you'd see if the files were part
of your website, with working references to stylesheets and images and
links to other pages.
It is important to realize, however, that as useful as that feature
is, there is some risk security-wise in its use. Essentially, anyone
with commit access to the CVS or Subversion repositories served by
ViewVC has the ability to affect site content. If a discontented or
ignorant user commits malicious HTML to a version controlled file
(perhaps just by way of documenting examples of such), that malicious
HTML is effectively published and live on your ViewVC instance.
Visitors viewing those versioned controlled documents get the
malicious code, too, which might not be what the original author
intended.
If you wish to disable ViewVC's "checkout" view which implements this
feature, you can do so by editing lib/viewvc.py, and modifying the
function view_checkout() like so, adding the lines indicated:
def view_checkout(request):
>> raise debug.ViewVCException('Checkout view is disabled',
>> '403 Forbidden')
path, rev = _orig_path(request)
fp, revision = request.repos.openfile(path, rev)
INSTALLING VIEWVC
------------------
1) To get viewcvs.cgi to work, make sure that you have Python 1.5 or
greater installed and a webserver which is capable of executing
CGI scripts (either based on the .cgi extension, or by placing the
script within a specific directory).
NOTE: Windows users can refer to windows/README for Windows-specific
installation instructions.
You need to have RCS installed. Specifically, "rlog", "rcsdiff",
and "co". This script was tested against RedHat's rcs-5.7-10.rpm
1) To get viewvc.cgi to work, make sure that you have Python installed
and a webserver which is capable of executing CGI scripts (either
based on the .cgi extension, or by placing the script within a specific
directory).
Note, that the viewcvs.cgi script needs to have READ-ONLY, physical
access to the CVS repository (or a copy of it). Therefore, rsh/ssh or
pserver access to the repository will not work.
Note that to browse CVS repositories, the viewvc.cgi script needs to
have READ-ONLY, physical access to the repository (or a copy of it).
Therefore, rsh/ssh or pserver access to the repository will not work.
And you need to have the RCS utilities installed, specifically "rlog",
"rcsdiff", and "co".
For the more human readable diff formats you need a modern diff utility.
If you are using Linux, this is no problem. But on commercial unices
you might want to install GNU-diff to be able to use unified or
side-by-side diffs.
If you want to use cvsgraph, you have to obtain and install this
separately. See below. This was tested with cvsgraph-1.1.2.
For the checkin database to work, you will need MySQL >= 3.22,
and the Python DBAPI 2.0 module, MySQLdb. This was tested with
MySQLdb 0.9.1.
2) Installation is handled by the ./viewcvs-install script. Run this
2) Installation is handled by the ./viewvc-install script. Run this
script and you will be prompted for a installation root path.
The default is /usr/local/viewcvs-VERSION, where VERSION is
the version of this ViewCVS release. The installer sets the install
path in some of the files, and ViewCVS cannot be moved to a
The default is /usr/local/viewvc-VERSION, where VERSION is
the version of this ViewVC release. The installer sets the install
path in some of the files, and ViewVC cannot be moved to a
different path after the install.
Note: while 'root' is usually required to create /usr/local/viewcvs,
ViewCVS does not have to be installed as root, nor does it run as root.
It is just as valid to place ViewCVS in a home directory, too.
Note: while 'root' is usually required to create /usr/local/viewvc,
ViewVC does not have to be installed as root, nor does it run as root.
It is just as valid to place ViewVC in a home directory, too.
Note: viewcvs-install will create directories if needed. It will
Note: viewvc-install will create directories if needed. It will
prompt before overwriting files that may have been modified (such
as viewcvs.conf), thus making it safe to install over the top of
as viewvc.conf), thus making it safe to install over the top of
a previous installation. It will always overwrite program files,
however.
3) Edit <VIEWCVS_INSTALLATION_DIRECTORY>/viewcvs.conf for your specific
3) Edit <VIEWVC_INSTALLATION_DIRECTORY>/viewvc.conf for your specific
configuration. In particular, examine the following configuration options:
cvs_roots
cvs_roots (for CVS)
svn_roots (for Subversion)
root_parents (for CVS or Subversion)
default_root
root_as_url_component
rcs_path
mime_types_file
There are some other options that are usually nice to change. See
viewcvs.conf for more information. ViewCVS provides a working,
default look. However, if you want to customize the look of ViewCVS
then edit the files in <VIEWCVS_INSTALLATION_DIRECTORY>/templates.
viewvc.conf for more information. ViewVC provides a working,
default look. However, if you want to customize the look of ViewVC
then edit the files in <VIEWVC_INSTALLATION_DIRECTORY>/templates.
You need knowledge about HTML to edit the templates.
4) The CGI programs are in <VIEWCVS_INSTALLATION_DIRECTORY>/cgi/. You can
4) The CGI programs are in <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/. You can
symlink to this directory from somewhere in your published HTTP server
path if your webserver is configured to follow symbolic links. You can
also copy the installed <VIEWCVS_INSTALLATION_DIRECTORY>/cgi/*.cgi scripts
after the install (unlike the other files in ViewCVS, the CGI scripts can
be moved).
also copy the installed <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
scripts after the install (unlike the other files in ViewVC, the scripts
under bin/ can be moved).
If you are using Apache, then the ScriptAlias directive is very
useful for pointing directly to the viwecvs.cgi script.
If you are using Apache, then see below at the section titled
APACHE CONFIGURATION.
NOTE: for security reasons, it is not advisable to install ViewCVS
NOTE: for security reasons, it is not advisable to install ViewVC
directly into your published HTTP directory tree (due to the MySQL
passwords in viewcvs.conf).
passwords in viewvc.conf).
5) That's it for repository browsing. Instructions for getting the
SQL checkin database working are below.
That's it for repository browsing. Instructions for getting the SQL
checkin database working are below.
WARNING: ViewCVS has not been tested on web servers operating on the
Win32 platform.
APACHE CONFIGURATION
--------------------
1) Find out where the web server configuration file is kept. Typical
locations are /etc/httpd/httpd.conf, /etc/httpd/conf/httpd.conf,
and /etc/apache/httpd.conf. Depending on how apache was installed,
you may also look under /usr/local/etc or /etc/local. Use the vendor
documentation or the find utility if in doubt.
Either METHOD A:
2) The ScriptAlias directive is very useful for pointing
directly to the viewvc.cgi script. Simply insert a line containing
ScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi
into your httpd.conf file. Choose the location in httpd.conf where
also the other ScriptAlias lines reside. Some examples:
ScriptAlias /viewvc /usr/local/viewvc-1.0/bin/cgi/viewvc.cgi
ScriptAlias /query /usr/local/viewvc-1.0/bin/cgi/query.cgi
continue with step 3).
or alternatively METHOD B:
2) Copy the CGI scripts from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
to the /cgi-bin/ directory configured in your httpd.conf file.
continue with step 3).
and then there's METHOD C:
2) Copy the CGI scripts from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
to the directory of your choosing in the Document Root adding the following
apache directives for the directory in httpd.conf or an .htaccess file:
Options +ExecCGI
AddHandler cgi-script .cgi
(Note: For this to work mod_cgi has to be loaded. And for the .htaccess file
to be effective, "AllowOverride All" or "AllowOverride Options FileInfo"
need to have been specified for the directory.)
continue with step 3).
or if you've got Mod_Python installed you can use METHOD D:
2) Copy the Python scripts and .htaccess file from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/mod_python/
to a directory being served by apache.
In httpd.conf, make sure that "AllowOverride All" or at least
"AllowOverride FileInfo Options" are enabled for the directory
you copied the files to.
Note: If you are using Mod_Python under Apache 1.3 the tarball generation
and enscript colorizing features may not work because they use
multithreading. They do work fine with Apache 2.
continue with step 3).
3) Restart apache. The commands to do this vary. "httpd -k restart" and
"apache -k restart" are two common variants. On RedHat Linux it is
done using the command "/sbin/service httpd restart" and on SuSE Linux
it is done with "rcapache restart"
4) Optional: Add access control.
In your httpd.conf you can control access to certain modules by adding
directives like this:
<Location "<url to viewvc.cgi>/<modname_you_wish_to_access_ctl>">
AllowOverride None
AuthUserFile /path/to/passwd/file
AuthName "Client Access"
AuthType Basic
require valid-user
</Location>
WARNING: If you enable the "checkout_magic" or "allow_tar" options, you
will need to add additional location directives to prevent people
from sneaking in with URLs like:
http://<server_name>/viewvc/*checkout*/<module_name>
http://<server_name>/viewvc/~checkout~/<module_name>
http://<server_name>/viewvc/<module_name>.tar.gz?view=tar
5) Optional: Protect your ViewVC instance from server-whacking webcrawlers.
As ViewVC is a web-based application which each page containing various
links to other pages and views, you can expect your server's performance
to suffer if a webcrawler finds your ViewVC instance and begins
traversing those links. We highly recommend that you add your ViewVC
location to a site-wide robots.txt file. Visit the Wikipedia page
for Robots.txt (http://en.wikipedia.org/wiki/Robots.txt) for more
information.
UPGRADING VIEWCVS
UPGRADING VIEWVC
-----------------
Please read the file upgrading.html in the website subdirectory or
at <http://viewcvs.sourceforge.net/upgrading.html>.
Please read the file upgrading-howto.html in the docs/ subdirectory.
SQL CHECKIN DATABASE
--------------------
This feature is a clone of the Mozilla Project's Bonsai database. It
catalogs every commit in the CVS repository into a SQL database. In fact,
the databases are 100% compatible.
catalogs every commit in the CVS or Subversion repository into a SQL
database. In fact, the databases are 100% compatible.
Various queries can be performed on the database. After installing ViewCVS,
Various queries can be performed on the database. After installing ViewVC,
there are some additional steps required to get the database working.
1) You need MySQL >= 3.22, and the Python module MySQLdb 0.9.0 installed.
Python 1.5.2 is REQUIRED by MySQLdb, therefore to use this part of
ViewCVS you must be using Python 1.5.2. Additionally you will need the
mxDateTime extension. I've tested with version 1.3.0
1) You need MySQL and MySQLdb (a Python DBAPI 2.0 module) installed.
2) You need to create a MySQL user who has permission to create databases.
Optionally, you can create a second user with read-only access to the
database.
3) Run the <VIEWCVS_INSTALLATION_DIRECTORY>/make-database script. It will
3) Run the <VIEWVC_INSTALLATION_DIRECTORY>/bin/make-database script. It will
prompt you for your MySQL user, password, and the name of database you
want to create. The database name defaults to "ViewCVS". This script
want to create. The database name defaults to "ViewVC". This script
creates the database and sets up the empty tables. If you run this on a
existing ViewCVS database, you will lose all your data!
existing ViewVC database, you will lose all your data!
4) Edit your <VIEWCVS_INSTALLATION_DIRECTORY>/viewcvs.conf file.
4) Edit your <VIEWVC_INSTALLATION_DIRECTORY>/viewvc.conf file.
There is a [cvsdb] section. You will need to set:
enabled = 1 # Whether to enable query support in viewvc.cgi
host = # MySQL database server host
database_name = # the name of the database you created with
# make-database
user = # the read/write database user
port = # MySQL database server port (default is 3306)
database_name = # name of database you created with make-database
user = # read/write database user
passwd = # password for read/write database user
readonly_user = # the readonly database user -- it's pretty
# safe to use the read/write user here
readonly_passwd = # password for the readonly user
readonly_user = # read-only database user
readonly_passwd = # password for the read-only user
5) Two programs are provided for updating the checkin database,
cvsdbadmin and loginfo-handler. They serve two different purposes.
The cvsdbadmin program walks through your CVS repository and adds
every commit in every file. This is commonly used for initializing
the database from a repository which has been in use. The
loginfo-handler script is executed by the CVS server's CVSROOT/loginfo
system upon each commit. It makes real-time updates to the checkin
database as commits are made to the repository.
Note that it's pretty safe in this instance for your read-only user
and your read-write user to be the same.
To build a database of all the commits in the CVS repository /home/cvs,
invoke: "./cvsdbadmin rebuild /home/cvs". If you want to update
the checkin database, invoke: "./cvsdbadmin update /home/cvs". The
update mode checks to see if a commit is already in the database,
and only adds it if it is absent.
5) At this point, you need to tell your version control system(s) to
publish their commit information to the database. This is done
using utilities that ViewVC provides.
To get real-time updates, you'll want to checkout the CVSROOT module
from your CVS repository and edit CVSROOT/loginfo. Add the line:
To publish CVS commits into the database:
ALL (echo %{sVv}; cat) | <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler
Two programs are provided for updating the checkin database from
a CVS repository, cvsdbadmin and loginfo-handler. They serve
two different purposes. The cvsdbadmin program walks through
your CVS repository and adds every commit in every file. This
is commonly used for initializing the database from a repository
which has been in use. The loginfo-handler script is executed
by the CVS server's CVSROOT/loginfo system upon each commit. It
makes real-time updates to the checkin database as commits are
made to the repository.
If you have other scripts invoked by CVSROOT/loginfo, you will want
to make sure to change any running under the "DEFAULT" keyword to
"ALL" like the loginfo handler, and probably carefully read the
execution rules for CVSROOT/loginfo from the CVS manual.
To build a database of all the commits in the CVS repository
/home/cvs, invoke: "./cvsdbadmin rebuild /home/cvs". If you
want to update the checkin database, invoke: "./cvsdbadmin
update /home/cvs". The update mode checks to see if a commit is
already in the database, and only adds it if it is absent.
6) You may want to modify the HTML template file:
To get real-time updates, you'll want to checkout the CVSROOT
module from your CVS repository and edit CVSROOT/loginfo. For
folks running CVS 1.12 or better, add this line:
<VIEWCVS_INSTALLATION_DIRECTORY>/templates/query.ezt
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %p %{sVv}
This is used by the query.cgi script to generate part of its HTML output.
At some point the currently hardcoded table output will also vanish.
If you are running CVS 1.11 or earlier, you'll want a slightly
different command line in CVSROOT/loginfo:
7) You should be ready to go. Load up the query.cgi script and give
it a try.
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv}
If you have other scripts invoked by CVSROOT/loginfo, you will
want to make sure to change any running under the "DEFAULT"
keyword to "ALL" like the loginfo handler, and probably
carefully read the execution rules for CVSROOT/loginfo from the
CVS manual.
If you are running the Unix port of CVS-NT, the handler script
need to know about it. CVS-NT delivers commit information to
loginfo scripts differently than the way mainstream CVS does.
Your command line should look like this:
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv} cvsnt
To publish Subversion commits into the database:
To build a database of all the commits in the Subversion
repository /home/svn, invoke: "./svndbadmin rebuild /home/svn".
If you want to update the checkin database, invoke:
"./svndbadmin update /home/svn".
To get real time updates, you will need to add a post-commit
hook (for the repository example above, the script should go in
/home/svn/hooks/post-commit). The script should look something
like this:
#!/bin/sh
REPOS="$1"
REV="$2"
<VIEWVC_INSTALLATION_DIRECTORY>/bin/svndbadmin rebuild "$REPOS" "$REV"
If you allow revision property changes in your repository,
create a post-revprop-change hook script containing the same
commands as the post-commit one. This will make sure that the
checkin database stays consistent when you change the svn:log,
svn:author or svn:date revision properties.
You should be ready to go. Click one of the "Query revision history"
links in ViewVC directory listings and give it a try.
ENSCRIPT CONFIGURATION
----------------------
ENABLING SYNTAX COLORATION
--------------------------
Enscript is program that can colorize sourcecode of a lot of languages.
Linux distributions like for example SuSE Linux from at least 7.0
up to the recently released 7.3 already contain a precompiled and
configured enscript 1.6.2 package.
Enscript and Highlight are two programs that can colorize source code
for a lot of languages. ViewVC can be configured to use either one.
1) Download genscript from http://people.ssh.com/mtr/genscript/
1) Install Enscript or Highlight using your system's package manager
or downloading from the project home pages.
2) Configure and compile per instructions with enscript.
(I 've not done this, since I'm using the precompiled package
delivered with SuSE Linux)
2) Set either the 'use_enscript' or 'use_highlight' options in
viewvc.conf to 1.
3) Set the 'use_enscript' option in viewcvs.conf to 1.
3) You may also need to set 'enscript_path' or 'highlight_path' option
if the executables are not located on the system PATH.
4) That's it!
5) If you want to colorize exotic languages, you might have to
patch 'lib/viewcvs.py' and add a new highlighting file to enscript.
I've done this for Modula-2 and submitted the file to the
enscript maintainer long ago. If interested in this patch for
enscript mailto:pefu@sourceforge.net
That's it! Now when you view the contents of recognized filetypes in
ViewVC, you should see colorized syntax.
CVSGRAPH CONFIGURATION
@@ -243,88 +413,113 @@ CvsGraph is a program that can display a clickable, graphical tree
of files in a CVS repository.
WARNING: Under certain circumstances (many revisions of a file
or many branches or both) cvsgraph can generate very huge images.
or many branches or both) CvsGraph can generate very huge images.
Especially on thin clients these images may crash the Web-Browser.
Currently there is no known way to avoid this behavior of cvsgraph.
Currently there is no known way to avoid this behavior of CvsGraph.
So you have been warned!
Nevertheless cvsgraph can be quite helpful on repositories with
Nevertheless, CvsGraph can be quite helpful on repositories with
a reasonable number of revisions and branches.
1) Install viewcvs according to instructions in 'INSTALLING
VIEWCVS' section above. The installation directory is where
the 'viewcvs-install' script copied and configured the viewcvs
programs.
1) Install CvsGraph using your system's package manager or downloading
from the project home page.
2) Download CvsGraph from http://www.akhphd.au.dk/~bertho/cvsgraph/
2) Set the 'use_cvsgraph' options in viewvc.conf to 1.
3) Configure and compile per instructions with CvsGraph. I had
problems with 'configure' finding the gd library. Had to create
a link from libgd.so to libgd.do.4.0.0. On Solaris you might
want to edit the link command line and add the option -R if
you have you libraries at non-standard location.
3) You may also need to set the 'cvsgraph_path' option if the
CvsGraph executable is not located on the system PATH.
4) Place the 'cvsgraph' executable into a directory readable by the
userid running the web server. (default is '/usr/local/bin' if
you simply type 'make install' in the cvsgraph directory).
5) Check the setting of the 'cvsgraph_path' option in viewcvs.conf:
/usr/local/bin/ is most often NOT contained in $PATH of the
webserver process (e.g. Apache), so you will have to edit this.
Set the 'use_cvsgraph' option in viewcvs.conf to 1.
6) That's it!
7) There is a file <VIEWCVS_INSTALLATION_DIRECTORY>/cvsgraph.conf that
4) There is a file <VIEWVC_INSTALLATION_DIRECTORY>/cvsgraph.conf that
you may want to edit if desired to set color and font characteristics.
See the cvsgraph.conf documentation. No edits are required in
cvsgraph.conf for operation with viewcvs.
cvsgraph.conf for operation with ViewVC.
SUBVERSION INTEGRATION
----------------------
Unlike the CVS integration, which simply wraps the RCS and CVS utility
programs, the Subversion integration requires additional Python
libraries. To use ViewVC with Subversion, make sure you have both
Subversion itself and the Subversion Python bindings installed. See
Subversion's installation notes for more details on how to build and
install these items.
Generally speaking, you'll know when your installation of Subversion's
bindings has been successful if you can import the 'svn.core' module
from within your Python interpreter. Here's an example of doing so
which doubles as a quick way to check what version of the Subversion
Python binding you have:
% python
Python 2.2.2 (#1, Oct 29 2002, 02:47:30)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn.core import *
>>> "%s.%s.%s" % (SVN_VER_MAJOR, SVN_VER_MINOR, SVN_VER_PATCH)
'1.2.0'
>>>
Note that by default, Subversion installs its bindings in a location
that is not in Python's default module search path (for example, on
Linux systems the default is usually /usr/local/lib/svn-python). You
need to remedy this, either by adding this path to Python's module
search path, or by relocating the bindings to some place in that
search path.
For example, you might want to create .pth file in your Python
installation directory's site-packages area which tells Python where
to find additional modules (in this case, you Subversion Python
bindings). You would do this as follows (and as root):
$ echo "/path/to/svn/bindings" > /path/to/python/site-packages/svn.pth
(Though, obviously, with the correct paths specified.)
Configuration of the Subversion repositories happens in much the same
way as with CVS repositories, only with the 'svn_roots' configuration
variable instead of the 'cvs_roots' one.
IF YOU HAVE PROBLEMS ...
------------------------
If you've trouble to make viewcvs.cgi work:
If nothing seems to work:
=== If nothing seems to work:
* Check if you can execute CGI-scripts (Apache needs to have an
ScriptAlias /cgi-bin or cgi-script Handler defined). Try to
execute a simple CGI-script that often comes with the distribution
of the webserver; locate the logfiles and try to find hints which
explain the malfunction
o check if you can execute CGI-scripts (Apache needs to have an
ScriptAlias /cgi-bin or cgi-script Handler defined). Try to
execute a simple CGI-script that often comes with the distribution
of the webserver; locate the logfiles and try to find hints
which explain the malfunction
o view the entries in the webserver's error.log
* View the entries in the webserver's error.log
o make sure there is a trailing slash on the URL. for example:
If ViewVC seems to work but doesn't show the expected result (Typical
error: you can't see any files)
* Check whether the CGI-script has read-permissions to your
CVS-Repository. The CGI-script generally runs as the same user
that the web server does, often user 'nobody' or 'httpd'.
* Does ViewVC find your RCS utilities? (edit rcs_path)
If something else happens or you can't get it to work:
* Check the ViewVC home page:
http://viewvc.org/
* Review the ViewVC mailing list archive to see if somebody else had
the same problem, and it was solved:
http://viewvc.tigris.org/servlets/SummarizeList?listName=users
* Check the ViewVC issue database to see if the problem you are
seeing is the result of a known bug:
http://viewvc.tigris.org/issues/query.cgi
http://www.example.com/cgi-bin/viewcvs.cgi/
(ViewCVS should perform a redirection to ensure this, but a report
has indicated that it doesn't always do this... please send more
of these bug reports if you run into this)
=== If viewcvs seems to work but doesn't show the expected result
(Typical error: you can't see any files)
o check whether the CGI-script has read-permissions to your
CVS-Repository. The CGI-script often runs as the user 'nobody'
or 'httpd' ..
o does viewcvs find your RCS utilities? (edit rcs_path)
=== If something else happens or you can't get it to work:
o check the ViewCVS home page:
http://viewcvs.sourceforge.net/
o review the ViewCVS mailing list archive to see if somebody else had
the same problem, and it was solved:
http://mailman.lyra.org/pipermail/viewcvs/
o send mail to the ViewCVS mailing list: viewcvs@lyra.org
NOTE: make sure you provide an accurate description of the problem
and any relevant tracebacks or error logs.
* Send mail to the ViewVC mailing list, users@viewvc.tigris.org.
NOTE: make sure you provide an accurate description of the problem
-- including the version of ViewVC you are using -- and any
relevant tracebacks or error logs.

65
LICENSE.html Normal file
View File

@@ -0,0 +1,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>ViewVC: License v1</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<p>The following text constitutes the license agreement for the <a
href="http://www.viewvc.org/">ViewVC</a> software (formerly known
as ViewCVS). It is an agreement between <a
href="http://www.viewvc.org/who.html#sec-viewcvs-group">The ViewCVS
Group</a> and the users of ViewVC.</p>
<blockquote>
<p><strong>Copyright &copy; 1999-2008 The ViewCVS Group. All rights
reserved.</strong></p>
<p>By using ViewVC, you agree to the terms and conditions set forth
below:</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:</p>
<ol>
<li>Redistributions of source code must retain the above copyright
notice, this list of conditions and the following
disclaimer.</li>
<li>Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.</li>
</ol>
<p>THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.</p>
</blockquote>
<hr />
<p>The following changes have occured to this license over time:</p>
<ul>
<li>May 12, 2001 &mdash; copyright years updated</li>
<li>September 5, 2002 &mdash; copyright years updated</li>
<li>March 17, 2006 &mdash; software renamed from "ViewCVS"</li>
<li>April 10, 2007 &mdash; copyright years updated</li>
<li>February 22, 2008 &mdash; copyright years updated</li>
</ul>
</body>
</html>

5
README
View File

@@ -1,3 +1,6 @@
ViewCVS -- Viewing the content of CVS repositories with a Webbrowser.
ViewVC -- Viewing the content of CVS/SVN repositories with a Webbrowser.
Please read the file INSTALL for more information.
And see windows/README for more information on running ViewVC on
Microsoft Windows.

6
TODO
View File

@@ -32,7 +32,7 @@ TODO ITEMS
*) include a ConfigParser.py to help older Python installations
*) add a check for the rcs programs/paths to viewcvs-install. clarify the
*) add a check for the rcs programs/paths to viewvc-install. clarify the
dependency on RCS in the docs.
*) have a "check" mode that verifies binaries are available on rcs_path
@@ -46,8 +46,8 @@ KNOWN BUGS
is non existant.
*) With old repositories containing many branches, tags or thousands
or revisions, the cvsgraph feature becomes unusable (see INSTALL).
ViewCVS can't do much about this, but it might be possible to
or revisions, the cvsgraph feature becomes unusable (see INSTALL).
ViewVC can't do much about this, but it might be possible to
investigate the number of branches, tags and revision in advance
and disable the cvsgraph links, if the numbers exceed a certain
treshold.

61
bin/asp/query.asp Normal file
View File

@@ -0,0 +1,61 @@
<%@ LANGUAGE = Python %>
<%
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# query.asp: View CVS/SVN commit database by web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) query.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
if not LIBRARY_DIR in sys.path:
sys.path.insert(0, LIBRARY_DIR)
#########################################################################
import sapi
import viewvc
import query
server = sapi.AspServer(Server, Request, Response, Application)
try:
cfg = viewvc.load_config(CONF_PATHNAME, server)
query.main(server, cfg, "viewvc.asp")
finally:
s.close()
%>

65
bin/asp/viewvc.asp Normal file
View File

@@ -0,0 +1,65 @@
<%@ LANGUAGE = Python %>
<%
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
if not LIBRARY_DIR in sys.path:
sys.path.insert(0, LIBRARY_DIR)
#########################################################################
### add code for checking the load average
#########################################################################
# go do the work
import sapi
import viewvc
server = sapi.AspServer(Server, Request, Response, Application)
try:
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)
finally:
s.close()
%>

32
cgi/query.cgi → bin/cgi/query.cgi Executable file → Normal file
View File

@@ -1,24 +1,22 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# query.cgi: View CVS commit database by web browser
# query.cgi: View CVS/SVN commit database by web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewCVS app. It checks the load
# average, then loads the (precompiled) viewcvs.py file and runs it.
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
@@ -32,6 +30,7 @@
#
LIBRARY_DIR = None
CONF_PATHNAME = None
#########################################################################
#
@@ -39,13 +38,20 @@ LIBRARY_DIR = None
#
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['../lib'] # any other places to look?
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
#########################################################################
import query
query.run_cgi()
import sapi
import viewvc
import query
server = sapi.CgiServer()
cfg = viewvc.load_config(CONF_PATHNAME, server)
query.main(server, cfg, "viewvc.cgi")

8
bin/cgi/viewvc-strace.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# Set this script up with something like:
#
# ScriptAlias /viewvc-strace /home/gstein/src/viewvc/cgi/viewvc-strace.sh
#
thisdir="`dirname $0`"
exec strace -q -r -o /tmp/v-strace.log "${thisdir}/viewvc.cgi"

31
cgi/viewcvs.cgi → bin/cgi/viewvc.cgi Executable file → Normal file
View File

@@ -1,24 +1,22 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewcvs: View CVS repositories via a web browser
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewCVS app. It checks the load
# average, then loads the (precompiled) viewcvs.py file and runs it.
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
@@ -32,6 +30,7 @@
#
LIBRARY_DIR = None
CONF_PATHNAME = None
#########################################################################
#
@@ -39,11 +38,13 @@ LIBRARY_DIR = None
#
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['../lib'] # any other places to look?
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
#########################################################################
@@ -52,5 +53,9 @@ else:
#########################################################################
# go do the work
import viewcvs
viewcvs.run_cgi()
import sapi
import viewvc
server = sapi.CgiServer()
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)

157
bin/cvsdbadmin Executable file
View File

@@ -0,0 +1,157 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# administrative program for CVSdb; this is primarily
# used to add/rebuild CVS repositories to the database
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
# Adjust sys.path to include our library directory
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
#########################################################################
import os
import string
import cvsdb
import viewvc
import vclib.bincvs
def UpdateFile(db, repository, path, update):
try:
if update:
commit_list = cvsdb.GetUnrecordedCommitList(repository, path, db)
else:
commit_list = cvsdb.GetCommitListFromRCSFile(repository, path)
except cvsdb.error, e:
print '[ERROR] %s' % (e)
return
file = string.join(path, "/")
if update:
print '[%s [%d new commits]]' % (file, len(commit_list)),
else:
print '[%s [%d commits]]' % (file, len(commit_list)),
## add the commits into the database
for commit in commit_list:
db.AddCommit(commit)
sys.stdout.write('.')
sys.stdout.flush()
print
def RecurseUpdate(db, repository, directory, update):
for entry in repository.listdir(directory, None, {}):
path = directory + [entry.name]
if entry.errors:
continue
if entry.kind is vclib.DIR:
RecurseUpdate(db, repository, path, update)
continue
if entry.kind is vclib.FILE:
UpdateFile(db, repository, path, update)
def RootPath(path):
"""Break os path into cvs root path and other parts"""
root = os.path.abspath(path)
path_parts = []
p = root
while 1:
if os.path.exists(os.path.join(p, 'CVSROOT')):
root = p
print "Using repository root `%s'" % root
break
p, pdir = os.path.split(p)
if not pdir:
del path_parts[:]
print "Using repository root `%s'" % root
print "Warning: CVSROOT directory not found."
break
path_parts.append(pdir)
root = cvsdb.CleanRepository(root)
path_parts.reverse()
return root, path_parts
def usage():
print 'Usage: %s <command> [arguments]' % (sys.argv[0])
print 'Performs administrative functions for the CVSdb database'
print 'Commands:'
print ' rebuild <repository> rebuilds the CVSdb database'
print ' for all files in the repository'
print ' update <repository> updates the CVSdb database for'
print ' all unrecorded commits'
print
sys.exit(1)
## main
if __name__ == '__main__':
## check that a command was given
if len(sys.argv) <= 2:
usage()
## set the handler function for the command
command = sys.argv[1]
if string.lower(command) == 'rebuild':
update = 0
elif string.lower(command) == 'update':
update = 1
else:
print 'ERROR: unknown command %s' % (command)
usage()
# get repository path
root, path_parts = RootPath(sys.argv[2])
## run command
try:
## connect to the database we are updating
cfg = viewvc.load_config(CONF_PATHNAME)
db = cvsdb.ConnectDatabase(cfg)
repository = vclib.bincvs.BinCVSRepository(None, root, cfg.general)
RecurseUpdate(db, repository, path_parts, update)
except KeyboardInterrupt:
print
print '** break **'
sys.exit(0)

317
bin/loginfo-handler Executable file
View File

@@ -0,0 +1,317 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2007 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# updates SQL database with new commit records
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
# Adjust sys.path to include our library directory
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
#########################################################################
import os
import string
import getopt
import re
import cvsdb
import viewvc
import vclib.bincvs
DEBUG_FLAG = 0
## output functions
def debug(text):
if DEBUG_FLAG:
if type(text) != (type([])):
text = [text]
for line in text:
line = line.rstrip('\n\r')
print 'DEBUG(viewvc-loginfo):', line
def warning(text):
print 'WARNING(viewvc-loginfo):', text
def error(text):
print 'ERROR(viewvc-loginfo):', text
sys.exit(1)
_re_revisions = re.compile(
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision
r"(?:$| )" # space or end of string
)
def Cvs1Dot12ArgParse(args):
"""CVS 1.12 introduced a new loginfo format while provides the various
pieces of interesting version information to the handler script as
individual arguments instead of as a single string."""
if args[1] == '- New directory':
return None, None
elif args[1] == '- Imported sources':
return None, None
else:
directory = args.pop(0)
files = []
while len(args) >= 3:
files.append(args[0:3])
args = args[3:]
return directory, files
def HeuristicArgParse(s, repository):
"""Older versions of CVS (except for CVSNT) do not escape spaces in file
and directory names that are passed to the loginfo handler. Since the input
to loginfo is a space separated string, this can lead to ambiguities. This
function attempts to guess intelligently which spaces are separators and
which are part of file or directory names. It disambiguates spaces in
filenames from the separator spaces between files by assuming that every
space which is preceded by two well-formed revision numbers is in fact a
separator. It disambiguates the first separator space from spaces in the
directory name by choosing the longest possible directory name that
actually exists in the repository"""
if (s[-16:] == ' - New directory'
or s[:26] == ' - New directory,NONE,NONE'):
return None, None
if (s[-19:] == ' - Imported sources'
or s[-29:] == ' - Imported sources,NONE,NONE'):
return None, None
file_data_list = []
start = 0
while 1:
m = _re_revisions.search(s, start)
if start == 0:
if m is None:
error('Argument "%s" does not contain any revision numbers' \
% s)
directory, filename = FindLongestDirectory(s[:m.start()],
repository)
if directory is None:
error('Argument "%s" does not start with a valid directory' \
% s)
debug('Directory name is "%s"' % directory)
else:
if m is None:
warning('Failed to interpret past position %i in the loginfo '
'argument, leftover string is "%s"' \
% start, pos[start:])
filename = s[start:m.start()]
old_version, new_version = m.group('old', 'new')
file_data_list.append((filename, old_version, new_version))
debug('File "%s", old revision %s, new revision %s'
% (filename, old_version, new_version))
start = m.end()
if start == len(s): break
return directory, file_data_list
def FindLongestDirectory(s, repository):
"""Splits the first part of the argument string into a directory name
and a file name, either of which may contain spaces. Returns the longest
possible directory name that actually exists"""
parts = string.split(s, " ")
for i in range(len(parts)-1, 0, -1):
directory = string.join(parts[:i])
filename = string.join(parts[i:])
if os.path.isdir(os.path.join(repository, directory)):
return directory, filename
return None, None
_re_cvsnt_revisions = re.compile(
r"(?P<filename>.*)" # comma and first revision
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision
r"$" # end of string
)
def CvsNtArgParse(s, repository):
"""CVSNT escapes all spaces in filenames and directory names with
backslashes"""
if s[-18:] == r' -\ New\ directory':
return None, None
if s[-21:] == r' -\ Imported\ sources':
return None, None
file_data_list = []
directory, pos = NextFile(s)
debug('Directory name is "%s"' % directory)
while 1:
fileinfo, pos = NextFile(s, pos)
if fileinfo is None:
break
m = _re_cvsnt_revisions.match(fileinfo)
if m is None:
warning('Can\'t parse file information in "%s"' % fileinfo)
continue
file_data = m.group('filename', 'old', 'new')
file_data_list.append(file_data)
debug('File "%s", old revision %s, new revision %s' % file_data)
return directory, file_data_list
def NextFile(s, pos = 0):
escaped = 0
ret = ''
i = pos
while i < len(s):
c = s[i]
if escaped:
ret += c
escaped = 0
elif c == '\\':
escaped = 1
elif c == ' ':
return ret, i + 1
else:
ret += c
i += 1
return ret or None, i
def ProcessLoginfo(rootpath, directory, files):
cfg = viewvc.load_config(CONF_PATHNAME)
db = cvsdb.ConnectDatabase(cfg)
repository = vclib.bincvs.BinCVSRepository(None, rootpath, cfg.general)
# split up the directory components
dirpath = filter(None, string.split(os.path.normpath(directory), os.sep))
## build a list of Commit objects
commit_list = []
for filename, old_version, new_version in files:
filepath = dirpath + [filename]
## XXX: this is nasty: in the case of a removed file, we are not
## given enough information to find it in the rlog output!
## So instead, we rlog everything in the removed file, and
## add any commits not already in the database
if new_version == 'NONE':
commits = cvsdb.GetUnrecordedCommitList(repository, filepath, db)
else:
commits = cvsdb.GetCommitListFromRCSFile(repository, filepath,
new_version)
commit_list.extend(commits)
## add to the database
db.AddCommitList(commit_list)
## MAIN
if __name__ == '__main__':
## get the repository from the environment
try:
repository = os.environ['CVSROOT']
except KeyError:
error('CVSROOT not in environment')
debug('Repository name is "%s"' % repository)
## parse arguments
argc = len(sys.argv)
debug('Got %d arguments:' % (argc))
debug(map(lambda x: ' ' + x, sys.argv))
# if we have more than 3 arguments, we are likely using the
# newer loginfo format introduced in CVS 1.12:
#
# ALL <path>/bin/loginfo-handler %p %{sVv}
if argc > 3:
directory, files = Cvs1Dot12ArgParse(sys.argv[1:])
else:
if len(sys.argv) > 1:
# the first argument should contain file version information
arg = sys.argv[1]
else:
# if there are no arguments, read version information from
# first line of input like old versions of ViewCVS did
arg = string.rstrip(sys.stdin.readline())
if len(sys.argv) > 2:
# if there is a second argument it indicates which parser
# should be used to interpret the version information
if sys.argv[2] == 'cvs':
fun = HeuristicArgParse
elif sys.argv[2] == 'cvsnt':
fun = CvsNtArgParse
else:
error('Bad arguments')
else:
# if there is no second argument, guess which parser to use based
# on the operating system. Since CVSNT now runs on Windows and
# Linux, the guess isn't necessarily correct
if sys.platform == "win32":
fun = CvsNtArgParse
else:
fun = HeuristicArgParse
directory, files = fun(arg, repository)
debug('Discarded from stdin:')
debug(map(lambda x: ' ' + x, sys.stdin.readlines())) # consume stdin
repository = cvsdb.CleanRepository(repository)
debug('Repository: %s' % (repository))
debug('Directory: %s' % (directory))
debug('Files: %s' % (str(files)))
if files is None:
debug('Not a checkin, nothing to do')
else:
ProcessLoginfo(repository, directory, files)
sys.exit(0)

View File

@@ -1,15 +1,13 @@
#!/usr/bin/env python
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2007 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
@@ -17,17 +15,16 @@
# MySQL 3.22 or later
#
# -----------------------------------------------------------------------
#
import os, sys, string
import popen2
INTRO_TEXT = """\
This script creates the database and tables in MySQL used by the ViewCVS
This script creates the database and tables in MySQL used by the ViewVC
checkin database. You will be prompted for: database user, database user
password, and database name. This script will use mysql to create the
database for you. You will then need to set the appropriate parameters
in your viewcvs.conf file under the [cvsdb] section.
in your viewvc.conf file under the [cvsdb] section.
"""
DATABASE_SCRIPT="""\
@@ -38,11 +35,11 @@ USE <dbname>;
DROP TABLE IF EXISTS branches;
CREATE TABLE branches (
id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
id mediumint(9) NOT NULL auto_increment,
branch varchar(64) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE branch (branch)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS checkins;
CREATE TABLE checkins (
@@ -65,48 +62,48 @@ CREATE TABLE checkins (
KEY dirid (dirid),
KEY fileid (fileid),
KEY branchid (branchid)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS descs;
CREATE TABLE descs (
id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
id mediumint(9) NOT NULL auto_increment,
description text,
hash bigint(20) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY hash (hash)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS dirs;
CREATE TABLE dirs (
id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
dir varchar(128) binary DEFAULT '' NOT NULL,
id mediumint(9) NOT NULL auto_increment,
dir varchar(255) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE dir (dir)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS files;
CREATE TABLE files (
id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
file varchar(128) binary DEFAULT '' NOT NULL,
id mediumint(9) NOT NULL auto_increment,
file varchar(255) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE file (file)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS people;
CREATE TABLE people (
id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
id mediumint(9) NOT NULL auto_increment,
who varchar(32) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE who (who)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS repositories;
CREATE TABLE repositories (
id mediumint(9) DEFAULT '0' NOT NULL auto_increment,
id mediumint(9) NOT NULL auto_increment,
repository varchar(64) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE repository (repository)
);
) TYPE=MyISAM;
DROP TABLE IF EXISTS tags;
CREATE TABLE tags (
@@ -120,7 +117,7 @@ CREATE TABLE tags (
KEY dirid (dirid),
KEY fileid (fileid),
KEY branchid (branchid)
);
) TYPE=MyISAM;
"""
if __name__ == "__main__":
@@ -128,18 +125,25 @@ if __name__ == "__main__":
user = raw_input("MySQL User: ")
passwd = raw_input("MySQL Password: ")
dbase = raw_input("ViewCVS Database Name [default: ViewCVS]: ")
dbase = raw_input("ViewVC Database Name [default: ViewVC]: ")
if not dbase:
dbase = "ViewCVS"
dbase = "ViewVC"
cmd = "{ mysql --user=%s --password=%s ; } 2>&1" % (user, passwd)
dscript = string.replace(DATABASE_SCRIPT, "<dbname>", dbase)
pipes = popen2.Popen3(cmd)
pipes.tochild.write(dscript)
pipes.tochild.close()
print pipes.fromchild.read()
status = pipes.wait()
if sys.platform == "win32":
# popen2.Popen3 is not provided on windows
cmd = "mysql --user=%s --password=%s" % (user, passwd)
mysql = os.popen(cmd, "w")
mysql.write(dscript)
status = mysql.close()
else:
cmd = "{ mysql --user=%s --password=%s ; } 2>&1" % (user, passwd)
pipes = popen2.Popen3(cmd)
pipes.tochild.write(dscript)
pipes.tochild.close()
print pipes.fromchild.read()
status = pipes.wait()
if status:
print "[ERROR] the database did not create sucessfully."

3
bin/mod_python/.htaccess Normal file
View File

@@ -0,0 +1,3 @@
AddHandler python-program .py
PythonHandler handler
PythonDebug On

31
bin/mod_python/handler.py Normal file
View File

@@ -0,0 +1,31 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# Mod_Python handler based on mod_python.publisher
#
# -----------------------------------------------------------------------
from mod_python import apache
import os.path
def handler(req):
path, module_name = os.path.split(req.filename)
module_name, module_ext = os.path.splitext(module_name)
try:
module = apache.import_module(module_name, path=[path])
except ImportError:
raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
req.add_common_vars()
module.index(req)
return apache.OK

71
bin/mod_python/query.py Normal file
View File

@@ -0,0 +1,71 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# ViewVC: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
import sapi
import imp
# Import real ViewVC module
fp, pathname, description = imp.find_module('viewvc', [LIBRARY_DIR])
try:
viewvc = imp.load_module('viewvc', fp, pathname, description)
finally:
if fp:
fp.close()
# Import real ViewVC Query modules
fp, pathname, description = imp.find_module('query', [LIBRARY_DIR])
try:
query = imp.load_module('query', fp, pathname, description)
finally:
if fp:
fp.close()
cfg = viewvc.load_config(CONF_PATHNAME)
def index(req):
server = sapi.ModPythonServer(req)
try:
query.main(server, cfg, "viewvc.py")
finally:
server.close()

61
bin/mod_python/viewvc.py Normal file
View File

@@ -0,0 +1,61 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
import sapi
import imp
# Import real ViewVC module
fp, pathname, description = imp.find_module('viewvc', [LIBRARY_DIR])
try:
viewvc = imp.load_module('viewvc', fp, pathname, description)
finally:
if fp:
fp.close()
def index(req):
server = sapi.ModPythonServer(req)
cfg = viewvc.load_config(CONF_PATHNAME, server)
try:
viewvc.main(server, cfg)
finally:
server.close()

View File

@@ -1,27 +1,18 @@
#!/usr/bin/env python
# $Id$
# vim:sw=4:ts=4:et:nowrap
# [Emacs: -*- python -*-]
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# This file: Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Germany
# ViewCVS project: Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# Note: this module is designed to deploy instantly and run under any
# version of Python from 1.5 and up. That's why some 2.0 features
# (like string methods) are conspicuously avoided.
# XXX Security issues?
# -----------------------------------------------------------------------
"""Run "standalone.py -p <port>" to start an HTTP server on a given port
on the local machine to generate ViewCVS web pages.
on the local machine to generate ViewVC web pages.
"""
__author__ = "Peter Funk <pf@artcom-gmbh.de>"
@@ -34,100 +25,149 @@ Ka-Ping Yee, for the GUI code and the framework stolen from pydoc.py.
# INSTALL-TIME CONFIGURATION
#
# This value will be set during the installation process. During
# development, it will remain None.
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
import sys
import os
import os.path
import stat
import string
import urllib
import rfc822
import socket
import select
import BaseHTTPServer
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
import sapi
import viewvc
import compat; compat.for_standalone()
class Options:
port = 7467 # default TCP/IP port used for the server
start_gui = 0 # No GUI unless requested.
repository = None # use default repository specified in config
repositories = {} # use default repositories specified in config
if sys.platform == 'mac':
host = '127.0.0.1'
else:
host = 'localhost'
script_alias = 'viewvc'
# --- web browser interface: ----------------------------------------------
def serve(port, callback=None):
class StandaloneServer(sapi.CgiServer):
def __init__(self, handler):
sapi.CgiServer.__init__(self, inheritableOut = sys.platform != "win32")
self.handler = handler
def header(self, content_type='text/html', status=None):
if not self.headerSent:
self.headerSent = 1
if status is None:
statusCode = 200
statusText = 'OK'
else:
p = string.find(status, ' ')
if p < 0:
statusCode = int(status)
statusText = ''
else:
statusCode = int(status[:p])
statusText = status[p+1:]
self.handler.send_response(statusCode, statusText)
self.handler.send_header("Content-type", content_type)
for (name, value) in self.headers:
self.handler.send_header(name, value)
self.handler.end_headers()
def serve(host, port, callback=None):
"""start a HTTP server on the given port. call 'callback' when the
server is ready to serve"""
class ViewCVS_Handler(BaseHTTPServer.BaseHTTPRequestHandler):
class ViewVC_Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
"""Serve a GET request."""
if not self.path or self.path == "/":
self.redirect()
elif self.is_viewcvs():
self.run_viewcvs()
elif self.path[:7] == "/icons/":
# XXX icon type should not be hardcoded to GIF:
self.send_response(200)
self.send_header("Content-type", "image/gif")
self.end_headers()
apache_icons.serve_icon(self.path, self.wfile)
elif self.is_viewvc():
try:
self.run_viewvc()
except IOError:
# ignore IOError: [Errno 32] Broken pipe
pass
else:
self.send_error(404)
def do_POST(self):
"""Serve a POST request."""
if self.is_viewcvs():
self.run_viewcvs()
if self.is_viewvc():
self.run_viewvc()
else:
self.send_error(501, "Can only POST to viewcvs")
self.send_error(501, "Can only POST to %s"
% (options.script_alias))
def is_viewcvs(self):
"""Check whether self.path matches the hardcoded ScriptAlias
/viewcvs"""
if self.path[:8] == "/viewcvs":
def is_viewvc(self):
"""Check whether self.path is, or is a child of, the ScriptAlias"""
if self.path == '/' + options.script_alias:
return 1
if self.path[:len(options.script_alias)+2] == \
'/' + options.script_alias + '/':
return 1
if self.path[:len(options.script_alias)+2] == \
'/' + options.script_alias + '?':
return 1
return 0
def redirect(self):
"""redirect the browser to the viewcvs URL"""
self.send_response(301, "moved (redirection follows)")
"""redirect the browser to the viewvc URL"""
new_url = self.server.url + options.script_alias + '/'
self.send_response(301, "Moved (redirection follows)")
self.send_header("Content-type", "text/html")
self.send_header("Location", self.server.url + 'viewcvs/')
self.send_header("Location", new_url)
self.end_headers()
self.wfile.write("""<html>
<head>
<meta http-equiv="refresh" content="1; URL=%s">
</head>
<body>
<h1>Redirection to <a href="%s">ViewCVS</a></h1>
Wait a second. You will be automatically redirected to <b>ViewCVS</b>.
<h1>Redirection to <a href="%s">ViewVC</a></h1>
Wait a second. You will be automatically redirected to <b>ViewVC</b>.
If this doesn't work, please click on the link above.
</body>
</html>
""" % tuple([self.server.url + "viewcvs/"]*2))
""" % tuple([new_url]*2))
def run_viewcvs(self):
"""This is a quick and dirty cut'n'rape from Pythons
def run_viewvc(self):
"""This is a quick and dirty cut'n'rape from Python's
standard library module CGIHTTPServer."""
assert self.path[:8] == "/viewcvs"
viewcvs_url, rest = self.server.url[:-1]+"/viewcvs", self.path[8:]
scriptname = '/' + options.script_alias
assert string.find(self.path, scriptname) == 0
viewvc_url = self.server.url[:-1] + scriptname
rest = self.path[len(scriptname):]
i = string.rfind(rest, '?')
if i >= 0:
rest, query = rest[:i], rest[i+1:]
else:
query = ''
i = string.find(rest, '/')
if i >= 0:
script, rest = rest[:i], rest[i:]
else:
script, rest = rest, ''
scriptname = viewcvs_url + script
# sys.stderr.write("Debug: '"+scriptname+"' '"+rest+"' '"+query+"'\n")
env = os.environ
# Since we're going to modify the env in the parent, provide empty
# values to override previously set values
for k in env.keys():
if k[:5] == 'HTTP_':
del env[k]
for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
'HTTP_USER_AGENT', 'HTTP_COOKIE'):
if env.has_key(k):
@@ -144,6 +184,7 @@ If this doesn't work, please click on the link above.
env['SCRIPT_NAME'] = scriptname
if query:
env['QUERY_STRING'] = query
env['HTTP_HOST'] = self.server.address[0]
host = self.address_string()
if host != self.client_address[0]:
env['REMOTE_HOST'] = host
@@ -168,48 +209,49 @@ If this doesn't work, please click on the link above.
ua = self.headers.getheader('user-agent')
if ua:
env['HTTP_USER_AGENT'] = ua
modified = self.headers.getheader('if-modified-since')
if modified:
env['HTTP_IF_MODIFIED_SINCE'] = modified
etag = self.headers.getheader('if-none-match')
if etag:
env['HTTP_IF_NONE_MATCH'] = etag
# XXX Other HTTP_* headers
decoded_query = string.replace(query, '+', ' ')
self.send_response(200)
# FIXME: I'm not sure about this: Sometimes it hurts, sometimes
# it is required. Please enlight me
if 1:
self.send_header("Content-type", "text/html")
self.end_headers()
# Preserve state, because we execute script in current process:
save_argv = sys.argv
save_stdin = sys.stdin
save_stdout = sys.stdout
save_stderr = sys.stderr
# For external tools like enscript we also need to redirect
# the real stdout file descriptor:
save_realstdout = os.dup(1)
# the real stdout file descriptor. (On windows, reassigning the
# sys.stdout variable is sufficient because pipe_cmds makes it
# the standard output for child processes.)
if sys.platform != "win32": save_realstdout = os.dup(1)
try:
try:
sys.stdout = self.wfile
os.close(1)
assert os.dup(self.wfile.fileno()) == 1
if sys.platform != "win32":
os.dup2(self.wfile.fileno(), 1)
sys.stdin = self.rfile
viewcvs.run_cgi()
viewvc.main(StandaloneServer(self), cfg)
finally:
sys.argv = save_argv
sys.stdin = save_stdin
sys.stdout.flush()
os.close(1)
assert os.dup(save_realstdout) == 1
if sys.platform != "win32":
os.dup2(save_realstdout, 1)
os.close(save_realstdout)
sys.stdout = save_stdout
sys.stderr = save_stderr
except SystemExit, status:
self.log_error("ViewCVS exit status %s", str(status))
self.log_error("ViewVC exit status %s", str(status))
else:
self.log_error("ViewCVS exited ok")
self.log_error("ViewVC exited ok")
class ViewCVS_Server(BaseHTTPServer.HTTPServer):
def __init__(self, port, callback):
host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost'
self.address = ('', port)
class ViewVC_Server(BaseHTTPServer.HTTPServer):
def __init__(self, host, port, callback):
self.address = (host, port)
self.url = 'http://%s:%d/' % (host, port)
self.callback = callback
BaseHTTPServer.HTTPServer.__init__(self, self.address,
@@ -235,41 +277,80 @@ If this doesn't work, please click on the link above.
socket.SO_REUSEADDR, 1)
BaseHTTPServer.HTTPServer.server_bind(self)
ViewCVS_Server.handler = ViewCVS_Handler
ViewVC_Server.handler = ViewVC_Handler
try:
# XXX Move this code out of this function.
# Early loading of configuration here. Used to
# allow tinkering with some configuration settings:
viewcvs.handle_config()
if options.repository:
if viewcvs.cfg.general.cvs_roots.has_key("Development"):
viewcvs.cfg.general.cvs_roots["Development"] = options.repository
else:
sys.stderr.write("*** No default ViewCVS configuration. Edit viewcvs.conf\n")
raise KeyboardInterrupt # Hack!
elif viewcvs.cfg.general.cvs_roots.has_key("Development") and \
not os.path.isdir(viewcvs.cfg.general.cvs_roots["Development"]):
handle_config()
if options.repositories:
cfg.general.default_root = "Development"
cfg.general.cvs_roots.update(options.repositories)
elif cfg.general.cvs_roots.has_key("Development") and \
not os.path.isdir(cfg.general.cvs_roots["Development"]):
sys.stderr.write("*** No repository found. Please use the -r option.\n")
sys.stderr.write(" Use --help for more info.\n")
raise KeyboardInterrupt # Hack!
os.close(0) # To avoid problems with shell job control
ViewCVS_Server(port, callback).serve_until_quit()
# always use default docroot location
cfg.options.docroot = None
# if cvsnt isn't found, fall back to rcs
if (cfg.conf_path is None
and cfg.general.cvsnt_exe_path):
import popen
cvsnt_works = 0
try:
fp = popen.popen(cfg.general.cvsnt_exe_path, ['--version'], 'rt')
try:
while 1:
line = fp.readline()
if not line: break
if string.find(line, "Concurrent Versions System (CVSNT)")>=0:
cvsnt_works = 1
while fp.read(4096):
pass
break
finally:
fp.close()
except:
pass
if not cvsnt_works:
cfg.cvsnt_exe_path = None
ViewVC_Server(host, port, callback).serve_until_quit()
except (KeyboardInterrupt, select.error):
pass
print 'server stopped'
def handle_config():
global cfg
cfg = viewvc.load_config(CONF_PATHNAME)
# --- graphical interface: --------------------------------------------------
def gui(port):
def nogui(missing_module):
sys.stderr.write(
"Sorry! Your Python was compiled without the %s module"%missing_module+
" enabled.\nI'm unable to run the GUI part. Please omit the '-g'\n"+
"and '--gui' options or install another Python interpreter.\n")
raise SystemExit, 1
def gui(host, port):
"""Graphical interface (starts web server and pops up a control window)."""
class GUI:
def __init__(self, window, port):
def __init__(self, window, host, port):
self.window = window
self.server = None
self.scanner = None
import Tkinter
try:
import Tkinter
except ImportError:
nogui("Tkinter")
self.server_frm = Tkinter.Frame(window)
self.title_lbl = Tkinter.Label(self.server_frm,
text='Starting server...\n ')
@@ -279,7 +360,7 @@ def gui(port):
text='quit serving', command=self.quit, state='disabled')
self.window.title('ViewCVS standalone')
self.window.title('ViewVC standalone')
self.window.protocol('WM_DELETE_WINDOW', self.quit)
self.title_lbl.pack(side='top', fill='x')
self.open_btn.pack(side='left', fill='x', expand=1)
@@ -287,15 +368,15 @@ def gui(port):
# Early loading of configuration here. Used to
# allow tinkering with configuration settings through the gui:
viewcvs.handle_config()
handle_config()
if not LIBRARY_DIR:
viewcvs.cfg.options.cvsgraph_conf = "../cgi/cvsgraph.conf.dist"
cfg.options.cvsgraph_conf = "../cgi/cvsgraph.conf.dist"
self.options_frm = Tkinter.Frame(window)
# cvsgraph toggle:
self.cvsgraph_ivar = Tkinter.IntVar()
self.cvsgraph_ivar.set(viewcvs.cfg.options.use_cvsgraph)
self.cvsgraph_ivar.set(cfg.options.use_cvsgraph)
self.cvsgraph_toggle = Tkinter.Checkbutton(self.options_frm,
text="enable cvsgraph (needs binary)", var=self.cvsgraph_ivar,
command=self.toggle_use_cvsgraph)
@@ -303,7 +384,7 @@ def gui(port):
# enscript toggle:
self.enscript_ivar = Tkinter.IntVar()
self.enscript_ivar.set(viewcvs.cfg.options.use_enscript)
self.enscript_ivar.set(cfg.options.use_enscript)
self.enscript_toggle = Tkinter.Checkbutton(self.options_frm,
text="enable enscript (needs binary)", var=self.enscript_ivar,
command=self.toggle_use_enscript)
@@ -311,7 +392,7 @@ def gui(port):
# show_subdir_lastmod toggle:
self.subdirmod_ivar = Tkinter.IntVar()
self.subdirmod_ivar.set(viewcvs.cfg.options.show_subdir_lastmod)
self.subdirmod_ivar.set(cfg.options.show_subdir_lastmod)
self.subdirmod_toggle = Tkinter.Checkbutton(self.options_frm,
text="show subdir last mod (dir view)", var=self.subdirmod_ivar,
command=self.toggle_subdirmod)
@@ -319,18 +400,38 @@ def gui(port):
# use_re_search toggle:
self.useresearch_ivar = Tkinter.IntVar()
self.useresearch_ivar.set(viewcvs.cfg.options.use_re_search)
self.useresearch_ivar.set(cfg.options.use_re_search)
self.useresearch_toggle = Tkinter.Checkbutton(self.options_frm,
text="allow regular expr search", var=self.useresearch_ivar,
command=self.toggle_useresearch)
self.useresearch_toggle.pack(side='top', anchor='w')
# use_localtime toggle:
self.use_localtime_ivar = Tkinter.IntVar()
self.use_localtime_ivar.set(cfg.options.use_localtime)
self.use_localtime_toggle = Tkinter.Checkbutton(self.options_frm,
text="use localtime (instead of UTC)",
var=self.use_localtime_ivar,
command=self.toggle_use_localtime)
self.use_localtime_toggle.pack(side='top', anchor='w')
# use_pagesize integer var:
self.usepagesize_lbl = Tkinter.Label(self.options_frm,
text='Paging (number of items per page, 0 disables):')
self.usepagesize_lbl.pack(side='top', anchor='w')
self.use_pagesize_ivar = Tkinter.IntVar()
self.use_pagesize_ivar.set(cfg.options.use_pagesize)
self.use_pagesize_entry = Tkinter.Entry(self.options_frm,
width=10, textvariable=self.use_pagesize_ivar)
self.use_pagesize_entry.bind('<Return>', self.set_use_pagesize)
self.use_pagesize_entry.pack(side='top', anchor='w')
# directory view template:
self.dirtemplate_lbl = Tkinter.Label(self.options_frm,
text='Chooose HTML Template for the Directory pages:')
self.dirtemplate_lbl.pack(side='top', anchor='w')
self.dirtemplate_svar = Tkinter.StringVar()
self.dirtemplate_svar.set(viewcvs.cfg.templates.directory)
self.dirtemplate_svar.set(cfg.templates.directory)
self.dirtemplate_entry = Tkinter.Entry(self.options_frm,
width = 40, textvariable=self.dirtemplate_svar)
self.dirtemplate_entry.bind('<Return>', self.set_templates_directory)
@@ -349,7 +450,7 @@ def gui(port):
text='Chooose HTML Template for the Log pages:')
self.logtemplate_lbl.pack(side='top', anchor='w')
self.logtemplate_svar = Tkinter.StringVar()
self.logtemplate_svar.set(viewcvs.cfg.templates.log)
self.logtemplate_svar.set(cfg.templates.log)
self.logtemplate_entry = Tkinter.Entry(self.options_frm,
width = 40, textvariable=self.logtemplate_svar)
self.logtemplate_entry.bind('<Return>', self.set_templates_log)
@@ -368,7 +469,7 @@ def gui(port):
text='Template for the database query page:')
self.querytemplate_lbl.pack(side='top', anchor='w')
self.querytemplate_svar = Tkinter.StringVar()
self.querytemplate_svar.set(viewcvs.cfg.templates.query)
self.querytemplate_svar.set(cfg.templates.query)
self.querytemplate_entry = Tkinter.Entry(self.options_frm,
width = 40, textvariable=self.querytemplate_svar)
self.querytemplate_entry.bind('<Return>', self.set_templates_query)
@@ -389,35 +490,45 @@ def gui(port):
self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight))
self.window.wm_minsize(self.minwidth, self.minheight)
import threading
threading.Thread(target=serve, args=(port, self.ready)).start()
try:
import threading
except ImportError:
nogui("thread")
threading.Thread(target=serve,
args=(host, port, self.ready)).start()
def toggle_use_cvsgraph(self, event=None):
viewcvs.cfg.options.use_cvsgraph = self.cvsgraph_ivar.get()
cfg.options.use_cvsgraph = self.cvsgraph_ivar.get()
def toggle_use_enscript(self, event=None):
viewcvs.cfg.options.use_enscript = self.enscript_ivar.get()
cfg.options.use_enscript = self.enscript_ivar.get()
def toggle_use_localtime(self, event=None):
cfg.options.use_localtime = self.use_localtime_ivar.get()
def toggle_subdirmod(self, event=None):
viewcvs.cfg.options.show_subdir_lastmod = self.subdirmod_ivar.get()
cfg.options.show_subdir_lastmod = self.subdirmod_ivar.get()
def toggle_useresearch(self, event=None):
viewcvs.cfg.options.use_re_search = self.useresearch_ivar.get()
cfg.options.use_re_search = self.useresearch_ivar.get()
def set_use_pagesize(self, event=None):
cfg.options.use_pagesize = self.use_pagesize_ivar.get()
def set_templates_log(self, event=None):
viewcvs.cfg.templates.log = self.logtemplate_svar.get()
cfg.templates.log = self.logtemplate_svar.get()
def set_templates_directory(self, event=None):
viewcvs.cfg.templates.directory = self.dirtemplate_svar.get()
cfg.templates.directory = self.dirtemplate_svar.get()
def set_templates_query(self, event=None):
viewcvs.cfg.templates.query = self.querytemplate_svar.get()
cfg.templates.query = self.querytemplate_svar.get()
def ready(self, server):
"""used as callback parameter to the serve() function"""
self.server = server
self.title_lbl.config(
text='ViewCVS standalone server at\n' + server.url)
text='ViewVC standalone server at\n' + server.url)
self.open_btn.config(state='normal')
self.quit_btn.config(state='normal')
@@ -446,7 +557,7 @@ def gui(port):
import Tkinter
try:
gui = GUI(Tkinter.Tk(), port)
gui = GUI(Tkinter.Tk(), host, port)
Tkinter.mainloop()
except KeyboardInterrupt:
pass
@@ -459,56 +570,74 @@ def cli(argv):
class BadUsage(Exception): pass
try:
opts, args = getopt.getopt(argv[1:], 'gp:r:',
['gui', 'port=', 'repository='])
opts, args = getopt.getopt(argv[1:], 'gp:r:h:s:',
['gui', 'port=', 'repository=', 'script-alias='])
for opt, val in opts:
if opt in ('-g', '--gui'):
options.start_gui = 1
elif opt in ('-r', '--repository'):
options.repository = val
if options.repositories: # option may be used more than once:
num = len(options.repositories.keys())+1
symbolic_name = "Repository"+str(num)
options.repositories[symbolic_name] = val
else:
options.repositories["Development"] = val
elif opt in ('-p', '--port'):
try:
options.port = int(val)
except ValueError:
raise BadUsage
elif opt in ('-h', '--host'):
options.host = val
elif opt in ('-s', '--script-alias'):
options.script_alias = \
string.join(filter(None, string.split(val, '/')), '/')
if options.start_gui:
gui(options.port)
gui(options.host, options.port)
return
elif options.port:
def ready(server):
print 'server ready at %s' % server.url
serve(options.port, ready)
print 'server ready at %s%s' % (server.url,
options.script_alias)
serve(options.host, options.port, ready)
return
raise BadUsage
except (getopt.error, BadUsage):
cmd = sys.argv[0]
cmd = os.path.basename(sys.argv[0])
port = options.port
print """ViewCVS standalone - a simple standalone HTTP-Server
host = options.host
script_alias = options.script_alias
print """ViewVC standalone - a simple standalone HTTP-Server
Usage: %(cmd)s [ <options> ]
Usage: %(cmd)s [OPTIONS]
Available Options:
-p <port> or --port=<port>
Start an HTTP server on the given port on the local machine.
Default port is %(port)d.
-r <path> or --repository=<path>
Specify another path for the default CVS repository "Development".
If you don't have your repository at /home/cvsroot you will need to
use this option or you have to install first and edit viewcvs.conf.
-h <host>, --host=<host>:
Start the HTTP server listening on <host>. You need to provide
the hostname if you want to access the standalone server from a
remote machine. [default: %(host)s]
-g or --gui
Pop up a graphical interface for serving and testing ViewCVS.
-p <port>, --port=<port>:
Start an HTTP server on the given port. [default: %(port)d]
-r <path>, --repository=<path>:
Specify a path for a CVS repository. Repository definitions are
typically read from the viewvc.conf file, if available. This
option may be used more than once.
-s <path>, --script-alias=<path>:
Specify the ScriptAlias, the artificial path location that at
which ViewVC appears to be located. For example, if your
ScriptAlias is "cgi-bin/viewvc", then ViewVC will appear to be
accessible at the URL "http://%(host)s:%(port)s/cgi-bin/viewvc".
[default: %(script_alias)s]
-g, --gui:
Pop up a graphical interface for serving and testing ViewVC.
NOTE: this requires a valid X11 display connection.
""" % locals()
if __name__ == '__main__':
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['lib']
os.chdir('lib')
import viewcvs
import apache_icons
if __name__ == '__main__':
options = Options()
cli(sys.argv)

311
bin/svndbadmin Executable file
View File

@@ -0,0 +1,311 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 2004 James Henstridge
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# administrative program for loading Subversion revision information
# into the checkin database. It can be used to add a single revision
# to the database, or rebuild/update all revisions.
#
# To add all the checkins from a Subversion repository to the checkin
# database, run the following:
# /path/to/svndbadmin rebuild /path/to/repo
#
# This script can also be called from the Subversion post-commit hook,
# something like this:
# REPOS="$1"
# REV="$2"
# /path/to/svndbadmin update "$REPOS" "$REV"
#
# If you allow changes to revision properties in your repository, you
# might also want to set up something similar in the
# post-revprop-change hook using "rebuild" instead of "update" to keep
# the checkin database consistent with the repository.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
CONF_PATHNAME = None
# Adjust sys.path to include our library directory
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
#########################################################################
import os
import string
import re
import svn.core
import svn.repos
import svn.fs
import svn.delta
import cvsdb
import viewvc
class SvnRepo:
"""Class used to manage a connection to a SVN repository."""
def __init__(self, path, pool):
self.scratch_pool = svn.core.svn_pool_create(pool)
self.path = path
self.repo = svn.repos.svn_repos_open(path, pool)
self.fs = svn.repos.svn_repos_fs(self.repo)
# youngest revision of base of file system is highest revision number
self.rev_max = svn.fs.youngest_rev(self.fs, pool)
def __getitem__(self, rev):
if rev is None:
rev = self.rev_max
elif rev < 0:
rev = rev + self.rev_max + 1
assert 0 <= rev <= self.rev_max
rev = SvnRev(self, rev, self.scratch_pool)
svn.core.svn_pool_clear(self.scratch_pool)
return rev
_re_diff_change_command = re.compile('(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?')
def _get_diff_counts(diff_fp):
"""Calculate the plus/minus counts by parsing the output of a
normal diff. The reasons for choosing Normal diff format are:
- the output is short, so should be quicker to parse.
- only the change commands need be parsed to calculate the counts.
- All file data is prefixed, so won't be mistaken for a change
command.
This code is based on the description of the format found in the
GNU diff manual."""
plus, minus = 0, 0
line = diff_fp.readline()
while line:
match = re.match(_re_diff_change_command, line)
if match:
# size of first range
if match.group(2):
count1 = int(match.group(2)) - int(match.group(1)) + 1
else:
count1 = 1
cmd = match.group(3)
# size of second range
if match.group(5):
count2 = int(match.group(5)) - int(match.group(4)) + 1
else:
count2 = 1
if cmd == 'a':
# LaR - insert after line L of file1 range R of file2
plus = plus + count2
elif cmd == 'c':
# FcT - replace range F of file1 with range T of file2
minus = minus + count1
plus = plus + count2
elif cmd == 'd':
# RdL - remove range R of file1, which would have been
# at line L of file2
minus = minus + count1
line = diff_fp.readline()
return plus, minus
class SvnRev:
"""Class used to hold information about a particular revision of
the repository."""
def __init__(self, repo, rev, pool):
self.repo = repo
self.rev = rev
self.pool = pool
self.rev_roots = {} # cache of revision roots
subpool = svn.core.svn_pool_create(pool)
# revision properties ...
properties = svn.fs.revision_proplist(repo.fs, rev, pool)
self.author = str(properties.get(svn.core.SVN_PROP_REVISION_AUTHOR,''))
self.date = str(properties.get(svn.core.SVN_PROP_REVISION_DATE, ''))
self.log = str(properties.get(svn.core.SVN_PROP_REVISION_LOG, ''))
# convert the date string to seconds since epoch ...
self.date = svn.core.secs_from_timestr(self.date, pool)
# get a root for the current revisions
fsroot = self._get_root_for_rev(rev)
# find changes in the revision
editor = svn.repos.RevisionChangeCollector(repo.fs, rev, pool)
e_ptr, e_baton = svn.delta.make_editor(editor, pool)
svn.repos.svn_repos_replay(fsroot, e_ptr, e_baton, pool)
self.changes = []
for path, change in editor.changes.items():
# clear the iteration subpool
svn.core.svn_pool_clear(subpool)
# skip non-file changes
if change.item_kind != svn.core.svn_node_file: continue
# deal with the change types we handle
base_root = None
if change.base_path:
base_root = self._get_root_for_rev(change.base_rev)
if not change.path:
action = 'remove'
elif change.added:
action = 'add'
else:
action = 'change'
diffobj = svn.fs.FileDiff(base_root and base_root or None,
base_root and change.base_path or None,
change.path and fsroot or None,
change.path and change.path or None,
subpool, [])
diff_fp = diffobj.get_pipe()
plus, minus = _get_diff_counts(diff_fp)
self.changes.append((path, action, plus, minus))
def _get_root_for_rev(self, rev):
"""Fetch a revision root from a cache of such, or a fresh root
(which is then cached for later use."""
if not self.rev_roots.has_key(rev):
self.rev_roots[rev] = svn.fs.revision_root(self.repo.fs, rev,
self.pool)
return self.rev_roots[rev]
def handle_revision(db, command, repo, rev, verbose):
"""Adds a particular revision of the repository to the checkin database."""
revision = repo[rev]
committed = 0
if verbose: print "Building commit info for revision %d..." % (rev),
if not revision.changes:
if verbose: print "skipped (no changes)."
return
for (path, action, plus, minus) in revision.changes:
directory, file = os.path.split(path)
commit = cvsdb.CreateCommit()
commit.SetRepository(repo.path)
commit.SetDirectory(directory)
commit.SetFile(file)
commit.SetRevision(str(rev))
commit.SetAuthor(revision.author)
commit.SetDescription(revision.log)
commit.SetTime(revision.date)
commit.SetPlusCount(plus)
commit.SetMinusCount(minus)
commit.SetBranch(None)
if action == 'add':
commit.SetTypeAdd()
elif action == 'remove':
commit.SetTypeRemove()
elif action == 'change':
commit.SetTypeChange()
if command == 'update':
result = db.CheckCommit(commit)
if result:
continue # already recorded
# commit to database
db.AddCommit(commit)
committed = 1
if verbose:
if committed:
print "done."
else:
print "skipped (already recorded)."
def main(pool, command, repository, rev=None, verbose=0):
cfg = viewvc.load_config(CONF_PATHNAME)
db = cvsdb.ConnectDatabase(cfg)
repo = SvnRepo(repository, pool)
if rev:
handle_revision(db, command, repo, rev, verbose)
else:
for rev in range(repo.rev_max+1):
handle_revision(db, command, repo, rev, verbose)
def usage():
cmd = os.path.basename(sys.argv[0])
sys.stderr.write("""
Usage: 1. %s [-v] rebuild REPOSITORY [REVISION]
2. %s [-v] update REPOSITORY [REVISION]
1. Rebuild the commit database information for REPOSITORY across all revisions
or, optionally, only for the specified REVISION.
2. Update the commit database information for REPOSITORY across all revisions
or, optionally, only for the specified REVISION. This is just like
rebuilding, except that no commit information will be stored for
commits already present in the database.
Use the -v flag to cause this script to give progress information as it works.
""" % (cmd, cmd))
sys.exit(1)
if __name__ == '__main__':
verbose = 0
args = sys.argv
try:
index = args.index('-v')
verbose = 1
del args[index]
except ValueError:
pass
if len(args) < 3:
usage()
command = string.lower(args[1])
if command not in ('rebuild', 'update'):
sys.stderr.write('ERROR: unknown command %s\n' % command)
usage()
repository = args[2]
if not os.path.exists(repository):
sys.stderr.write('ERROR: could not find repository %s\n' % repository)
usage()
if len(sys.argv) > 3:
rev = sys.argv[3]
try:
rev = int(rev)
except ValueError:
sys.stderr.write('ERROR: revision "%s" is not numeric\n' % rev)
usage()
else:
rev = None
repository = cvsdb.CleanRepository(os.path.abspath(repository))
svn.core.run_app(main, command, repository, rev, verbose)

View File

@@ -1,192 +0,0 @@
# CvsGraph configuration
#
# - Empty lines and whitespace are ignored.
#
# - Comments start with '#' and everything until
# end of line is ignored.
#
# - Strings are C-style strings in which characters
# may be escaped with '\' and written in octal
# and hex escapes. Note that '\' must be escaped
# if it is to be entered as a character.
#
# - Some strings are expanded with printf like
# conversions which start with '%'. Not all
# are applicable at all times, in which case they
# will expand to noting.
# %c = cvsroot (with trailing '/')
# %C = cvsroot (*without* trailing '/')
# %m = module (with trailing '/')
# %M = module (*without* trailing '/')
# %f = filename without path
# %F = filename without path and with ",v" stripped
# %p = path part of filename (with trailing '/')
# %r = number of revisions
# %b = number of branches
# %% = '%'
# %R = the revision number (e.g. '1.2.4.4')
# %P = previous revision number
# %B = the branch number (e.g. '1.2.4')
# %d = date of revision
# %a = author of revision
# %s = state of revision
# %t = current tag of branch or revision
# %0..%9 = command-line argument -0 .. -9
# ViewCVS currently uses the following two command-line arguments to
# pass URL information to cvsgraph:
# -6 request.amp_query (the query preceeded with '&')
# -7 request.qmark_query (the query preceed with '?')
#
# - Numbers may be entered as octal, decimal or
# hex as in 0117, 79 and 0x4f respectively.
#
# - Fonts are numbered 0..4 (defined as in libgd)
# 0 = tiny
# 1 = small
# 2 = medium (bold)
# 3 = large
# 4 = giant
#
# - Colors are a string like html-type colors in
# the form "#rrggbb" with parts written in hex
# rr = red (00..ff)
# gg = green (00-ff)
# bb = blue (00-ff)
#
# - There are several reserved words besides of the
# feature-keywords. These additional reserved words
# expand to numerical values:
# * false = 0
# * true = 1
# * left = 0
# * center = 1
# * right = 2
# * gif = 0
# * png = 1
# * jpeg = 2
# * tiny = 0
# * small = 1
# * medium = 2
# * large = 3
# * giant = 4
# cvsroot <string>
# The *absolute* base directory where the
# CSV/RCS repository can be found
# cvsmodule <string>
#
cvsroot = "--unused--"; # unused with ViewCVS, will be overridden
cvsmodule = ""; # unused with ViewCVS -- please leave it blank
# color_bg <color>
# The background color of the image
color_bg = "#ffffff";
# date_format <string>
# The strftime(3) format string for date and time
date_format = "%d-%b-%Y %H:%M:%S";
box_shadow = true;
tag_font = medium;
tag_color = "#007000";
rev_font = giant;
rev_color = "#000000";
rev_bgcolor = "#f0f0f0";
rev_separator = 1;
rev_minline = 15;
rev_maxline = 30;
rev_lspace = 5;
rev_rspace = 5;
rev_tspace = 3;
rev_bspace = 3;
rev_text = "%d"; # or "%d\n%a, %s" for author and state too
rev_text_font = tiny;
rev_text_color = "#500020";
# branch_font <number>
# The font of the number and tags
# branch_color <color>
# All branch element's color
# branch_[lrtb]space <number>
# Interior spacing (margin)
# branch_margin <number>
# Exterior spacing
# branch_connect <number>
# Length of the vertical connector
branch_font = medium;
branch_color = "#0000c0";
branch_bgcolor = "#ffffc0";
branch_lspace = 5;
branch_rspace = 5;
branch_tspace = 3;
branch_bspace = 3;
branch_margin = 15;
branch_connect = 8;
# title <string>
# The title string is expanded (see above for details)
# title_[xy] <number>
# Postion of title
# title_font <number>
# The font
# title_align <number>
# 0 = left
# 1 = center
# 2 = right
# title_color <color>
title = "%C: %p%F\nRevisions: %r, Branches: %b";
title_x = 10;
title_y = 5;
title_font = small;
title_align = left;
title_color = "#800000";
# Margins of the image
# Note: the title is outside the margin
margin_top = 35;
margin_bottom = 10;
margin_left = 10;
margin_right = 10;
# Image format(s)
# image_type <number|{gif,jpeg,png}>
# gif (0) = Create gif image
# png (1) = Create png image
# jpeg (2) = Create jpeg image
# Image types are available if they can be found in
# the gd library. Newer versions of gd do not have
# gif anymore. CvsGraph will automatically generate
# png images instead.
# image_quality <number>
# The quality of a jpeg image (1..100)
image_type = png;
image_quality = 75;
# HTML ImageMap generation
# map_name <string>
# The name= attribute in <map name="mapname">...</map>
# map_branch_href <string>
# map_branch_alt <string>
# map_rev_href <string>
# map_rev_alt <string>
# map_diff_href <string>
# map_diff_alt <string>
# These are the href= and alt= attributes in the <area>
# tags of html. The strings are expanded (see above).
map_name = "MyMapName";
map_branch_href = "href=\"%m%F?only_with_tag=%t%8%6\"";
map_branch_alt = "alt=\"%0 %t (%B)\"";
# You might want to experiment with the following setting:
# 1. The default setting will take you to a ViewCVS generated page displaying
# that revision of the file, if you click into a revision box:
map_rev_href = "href=\"%m%F?rev=%R&content-type=text/vnd.viewcvs-markup%6\"";
# 2. This alternative setting will take you to the anchor representing this
# revision on a ViewCVS generated Log page for that file:
# map_rev_href = "href=\"%m%F%7#rev%R\"";
#
map_rev_alt = "alt=\"%1 %t (%R)\"";
map_diff_href = "href=\"%m%F.diff?r1=%P&r2=%R%8%6\"";
map_diff_alt = "alt=\"%2 %P &lt;-&gt; %R\"";

View File

@@ -1,529 +0,0 @@
#!/usr/bin/python
# -*- Mode: python -*-
"""
Granny.py - display CVS annotations in HTML
with lines colored by code age in days.
Original Perl version by J. Gabriel Foster (gabe@sgrail.com)
Posted to info-cvs on 02/27/1997
You can still get the original shell archive here:
http://www.geocrawler.com/archives/3/382/1997/2/0/2103824/
Perl modifications for NT by Marc Paquette (marcpa@cam.org)
Python port and CGI modifications by Brian Lenihan (brianl@real.com)
From the original granny.pl README:
--
What is Granny? Why do I care?
Granny is a tool for viewing cvs annotation information graphically. Using
Netscape, granny indicates the age of lines by color. Red lines are new,
blue lines are old. This information can be very useful in determining
what lines are 'hot'. New lines are more likely to contain bugs, and this
is an easy way to visualize that information.
Requirements:
Netscape (version 2.0 or better)
Perl5
CVS 1.9 (1.8 should work, but I have not tried it.)
Installation:
Put granny somewhere in your path. You may need to edit the
first line to point to your perl5 binary and libraries.
What to do:
Run granny just like you would 'cvs annotate' for a single file.
granny thefile.C
To find out who is to blame for that new 'feature'.
granny -U thefile.C
For all your options:
granny -h
Questions, Comments, Assertions?
send e-mail to the author: Gabe Foster (gabe@sgrail.com)
Notes:
I'm not the first person to try this sort of display, I just read about it
in a magazine somewhere and decided that cvs had all the information
I needed. To whomever first had this idea, it's a great one.
Granny is free, please use it as you see fit. I give no warranties.
As a courtesy, I ask that you tell me about any modifications you have made,
and also ask that you acknowledge my work if you use Granny in your own
software.
--
Granny.py:
granny.py [-h][-d days][-i input][-o output][-DUV] file
-h: Get this help display.
-i: Specify the input file. (Use - for stdin.)
-o: Specify the output file. (Use - for stdout.)
-d: Specify the day range for the coloring.\n
-r: Specify the cvs revision of the file.
-D: Display the date the line was last edited.
-U Display the user that last edited the line.
-V: Display the version the line was last edited.
By default, granny.py executes cvs annotate on a FILE and
runs netscape to display the graphic.
It is assumed that cvs and Netscape (for command line version) are
in your path.
If granny.py is placed in the cgi-bin directory of your Web
server, it will act as a CGI script. The working directory
defaults to /usr/tmp, but it can be overridden in the class
constructor:
A = CGIAnnotate(tempdir='/tmp')
Required fields:
root The full path to the cvs root directory.
Name The module/filename of the annotated file.
Optional fields:
rev The cvs revision number to use. (default HEAD).
Set the following fields to display extra info:
showUser Display the user that last edited the line.
showVersion Display version that the line was last edited in.
showDate Display the date the line was last edited.
http://yourserver.yourdomain.com/cgi-bin/granny.py?root=/cvsroot&Name=module/file
TODO:
Add support for determining the MIME type of files and/or a binary check.
- easily done by parsing Apache (mime.conf) or Roxen (extensions) MIME
files.
Consider adding buttons to HTML for optional display fields.
Add support for launching other browsers.
"""
import os
import sys
import string
import re
import time
import getopt
import cStringIO
import tempfile
import traceback
month_num = {
'Jan' : 1, 'Feb' : 2, 'Mar' : 3, 'Apr' : 4, 'May' : 5, 'Jun' : 6,
'Jul' : 7, 'Aug' : 8, 'Sep' : 9, 'Oct' : 10, 'Nov' : 11, 'Dec' : 12
}
class Annotate:
def __init__(self):
self.day_range = 365
self.counter = 0
self.color_table = {}
self.user = {}
self.version = {}
self.rtime = {}
self.source = {}
self.tmp = None
self.tmpfile = None
self.revision = ''
self.showUser = 0
self.showDate = 0
self.showVersion = 0
self.set_today()
def run(self):
try:
self.process_args()
self.parse_raw_annotated_file()
self.write_annotated_html_file()
if self.tmp:
self.display_annotated_html_file()
finally:
if sys.exc_info()[0] is not None:
traceback.print_exc()
self.cleanup()
def cleanup(self):
if self.tmp:
self.tmp.close()
os.unlink(self.tmpfile)
sys.exit(0)
def getoutput(self, cmd):
"""
Get stdin and stderr from cmd and
return exit status and captured output
"""
if os.name == 'nt':
# os.popen is broken on win32, but seems to work so far...
pipe = os.popen('%s 2>&1' % cmd, 'r')
else:
pipe = os.popen('{ %s ; } 2>&1' % cmd, 'r')
text = pipe.read()
sts = pipe.close()
if sts == None:
sts = 0
if text[:-1] == '\n':
text = text[-1:]
return sts, text
def set_today(self):
"""
compute the start of this day
"""
(year,mon,day,hour,min,sec,dow,doy,dst) = time.gmtime(time.time())
self.today = time.mktime((year,mon,day,0,0,0,0,0,0))
def get_today(self):
return self.today
# entify stuff which breaks HTML display
# this was lifted from some Zope Code in
# StructuredText.py
#
# XXX try it with string.replace and run it in the profiler
def html_quote(self,v,
character_entities=((re.compile('&'), '&amp;'),
(re.compile("<"), '&lt;' ),
(re.compile(">"), '&gt;' ),
(re.compile('"'), '&quot;'))):
gsub = re.sub
text=str(v)
for regexp,name in character_entities:
text=gsub(regexp,name,text)
return text
def display_annotated_html_file(self):
if os.name == 'nt':
path = '"C:\\Program Files\\Netscape\\Communicator'\
'\\Program\\Netscape"'
if os.system('%s %s' % (path, self.tmpfile)) != 0:
sys.stderr.write('%s: Unable to start Netscape' % sys.argv[0])
sys.exit(1)
else:
if os.system('netscape -remote openFile\(%s\)' %
self.tmpfile) != 0:
sys.stderr.write('%s: Trying to run netscape, please wait\n' %
sys.argv[0])
if os.system('netscape &') == 0:
for i in range(10):
time.sleep(1)
if os.system('netscape -remote openFile\(%s\)' %
self.tmpfile) == 0:
break
if i == 10:
sys.stderr.write('%s:Unable to start netscape\n' %
sys.argv[0])
else:
sys.stderr.write('%s:Unable to start netscape\n' %
sys.argv[0])
# give Netscape time to read the file
# XXX big files may raise an OSError exception on NT
# if the sleep is too short.
time.sleep(5)
def get_opts(self):
opt_dict = {}
if not len(sys.argv[1:]) > 0:
self.usage()
opts, args = getopt.getopt(sys.argv[1:], 'DUVhi:o:d:r:')
for k,v in opts:
opt_dict[k] = v
return opt_dict
def process_args(self):
opts = self.get_opts()
if opts.has_key('-r'):
self.revision = '-r%s' % opts['-r']
if opts.has_key('-h'):
self.usage(help=1)
if opts.has_key('-i'):
if opts['-i'] != '-':
self.filename = v
infile = open(filename, 'r')
sys.stdin = infile
else:
self.file = sys.stdin
else:
self.filename = sys.argv[len(sys.argv) - 1]
cmd = 'cvs annotate %s %s' % (self.revision, self.filename)
status, text = self.getoutput(cmd)
if status != 0 or text == '':
sys.stderr.write("Can't run cvs annotate on %s\n" %
self.filename)
sys.stderr.write('%s\n' % text)
sys.exit(1)
self.file = cStringIO.StringIO(text)
if opts.has_key('-o'):
if opts['-o'] != '-':
outfile = open(v, 'w')
sys.stdout = outfile
else:
# this could be done without a temp file
target = sys.argv[len(sys.argv) -1]
self.tmpfile = tempfile.mktemp()
self.tmp = open(self.tmpfile, 'w')
sys.stdout = self.tmp
if opts.has_key('-d'):
if opts['-d'] > 0:
self.day_range = opts['-d']
if opts.has_key('-D'):
self.showDate = 1
if opts.has_key('-U'):
self.showUser = 1
if opts.has_key('-V'):
self.showVersion = 1
def parse_raw_annotated_file(self):
ann = re.compile('((\d+\.?)+)\s+\((\w+)\s+(\d\d)-'\
'(\w{3})-(\d\d)\): (.*)')
text = self.file.read()
lines = string.split(text, '\n')
for line in lines:
# Parse an annotate string
m = ann.search(line)
if m:
self.version[self.counter] = m.group(1)
self.user[self.counter] = m.group(3)
oldtime = self.today - time.mktime((
int(m.group(6)),
int(month_num[m.group(5)]),
int(m.group(4)),0,0,0,0,0,0))
self.rtime[self.counter] = oldtime / 86400
self.source[self.counter] = self.html_quote(m.group(7))
else:
self.source[self.counter] = self.html_quote(line)
pass
self.counter = self.counter + 1
def write_annotated_html_file(self):
if os.environ.has_key('SCRIPT_NAME'):
print 'Status: 200 OK\r\n'
print 'Content-type: text/html\r\n\r\n'
print ('<html><head><title>%s</title></head>\n' \
'<body bgcolor="#000000">\n' \
'<font color="#FFFFFF"><H1>File %s</H1>\n' \
'<H3>Code age in days</H2>' % (self.filename, self.filename))
for i in range(self.day_range + 1):
self.color_table[i] = \
self.hsvtorgb(240.0 * i / self.day_range, 1.0, 1.0)
step = self.day_range / 40
if step < 5:
step = 1
while self.day_range/step > 40:
step = step + 1
if step >= 5:
if step != 5:
step = step + 5 - (step % 5)
while self.day_range / step > 20:
step = step + 5
for i in range(self.day_range + 1, step):
print '<font color=%s>%s ' % (self.color_table[i], i),
print '<pre><code>'
for i in range(self.counter):
if self.showUser and self.user.has_key(i):
print '%s%s ' % ('<font color=#FFFFFF>',
string.ljust(self.user[i],10)),
if self.showVersion and self.version.has_key(i):
print '%s%s ' % ('<font color=#FFFFFF>',
string.ljust(self.version[i],6)),
if self.showDate and self.rtime.has_key(i):
(year,mon,day,hour,min,sec,dow,doy,dst) = time.gmtime(
self.today - self.rtime[i] * 86400)
print '<font color=#FFFFFF>%02d/%02d/%4d ' % (mon, day, year),
if self.rtime.get(i, self.day_range) < self.day_range:
fcolor = self.color_table.get(
self.rtime[i],
self.color_table[self.day_range])
else:
fcolor = self.color_table[self.day_range]
print '<font color=%s> %s' % (fcolor, self.source[i])
print ('</code></pre>\n' \
'<font color=#FFFFFF>\n' \
'<H5>Granny original Perl version by' \
'<I>J. Gabriel Foster</I>\n' \
'<ADDRESS><A HREF=\"mailto:gabe@sgrail.com\">'\
'gabe@sgrail.com</A></ADDRESS>\n' \
'Python version by <I>Brian Lenihan</I>\n' \
'<ADDRESS><A HREF=\"mailto:brianl@real.com\">' \
'brianl@real.com</A></ADDRESS>\n' \
'</body></html>')
sys.stdout.flush()
def hsvtorgb(self,h,s,v):
"""
a veritable technicolor spew
"""
if s == 0.0:
r = v; g = v; b = v
else:
if h < 0:
h = h + 360.0
elif h >= 360.0:
h = h - 360.0
h = h / 60.0
i = int(h)
f = h - i
if s > 1.0:
s = 1.0
p = v * (1.0 - s)
q = v * (1.0 - (s * f))
t = v * (1.0 - (s * (1.0 - f)))
if i == 0: r = v; g = t; b = p
elif i == 1: r = q; g = v; b = p
elif i == 2: r = p; g = v; b = t
elif i == 3: r = p; g = q; b = v
elif i == 4: r = t; g = p; b = v
elif i == 5: r = v; g = p; b = q
return '#%02X%02X%02X' % (r * 255 + 0.5, g * 255 + 0.5, b * 255 + 0.5)
def usage(self, help=None):
sys.stderr.write('\nusage: %s %s\n\n' % (
sys.argv[0],
'[-hDUV][-d days][-i input][-o output][-r rev] FILE')
)
if help is not None:
sys.stderr.write(
'-h: Get this help display.\n' \
'-i: Specify the input file. (Use - for stdin.)\n' \
'-o: Specify the output file. (Use - for stdout.)\n' \
'-d: Specify the day range for the coloring.\n' \
'-r: Specify the cvs revision of the file.\n' \
'-D: Display the date the line was last edited.\n' \
'-U Display the user that last edited the line.\n' \
'-V: Display the version the line was last edited.\n\n' \
'By default, %s executes a cvs annotate on a FILE and\n' \
'runs netscape to display the graphical ' \
'annotation\n' % sys.argv[0]
)
sys.exit(0)
class CGIAnnotate(Annotate):
def __init__(self,tempdir='/usr/tmp'):
Annotate.__init__(self)
if os.name == 'nt':
self.tempdir = os.environ.get('TEMP') or os.environ.get('TMP')
else:
# XXX need a sanity check here
self.tempdir = tempdir
os.chdir(self.tempdir)
def process_args(self):
f = cgi.FieldStorage()
cvsroot = f['root'].value
if f.has_key('showUser'):
self.showUser = 1
if f.has_key('showDate'):
self.showDate = 1
if f.has_key('showVersion'):
self.showVersion = 1
if f.has_key('rev'):
self.revision = '-r%s' % f['rev'].value
path = f['Name'].value
module = os.path.dirname(path)
self.workingdir = 'ann.%s' % os.getpid()
self.filename = os.path.basename(path)
os.mkdir(self.workingdir)
os.chdir(os.path.join(self.tempdir, self.workingdir))
os.system('cvs -d %s co %s' % (cvsroot, path))
os.chdir(module)
cmd = 'cvs annotate %s %s' % (self.revision, self.filename)
status, text = self.getoutput(cmd)
if status != 0 or text == '':
text = "Can't run cvs annotate on %s\n" % path
self.file = cStringIO.StringIO(text)
def cleanup(self):
os.chdir(self.tempdir)
os.system('rm -rf %s' % self.workingdir)
def display_annotated_html_file(self):
pass
def usage(self):
pass
if __name__ == '__main__':
if os.environ.has_key('SCRIPT_NAME'):
import cgi
A = CGIAnnotate()
else:
A = Annotate()
A.run()

394
cvsgraph.conf.dist Normal file
View File

@@ -0,0 +1,394 @@
# CvsGraph configuration
#
# - Empty lines and whitespace are ignored.
#
# - Comments start with '#' and everything until
# end of line is ignored.
#
# - Strings are C-style strings in which characters
# may be escaped with '\' and written in octal
# and hex escapes. Note that '\' must be escaped
# if it is to be entered as a character.
#
# - Some strings are expanded with printf like
# conversions which start with '%'. Not all
# are applicable at all times, in which case they
# will expand to nothing.
# %c = cvsroot (with trailing '/')
# %C = cvsroot (*without* trailing '/')
# %m = module (with trailing '/')
# %M = module (*without* trailing '/')
# %f = filename without path
# %F = filename without path and with ",v" stripped
# %p = path part of filename (with trailing '/')
# %r = number of revisions
# %b = number of branches
# %% = '%'
# %R = the revision number (e.g. '1.2.4.4')
# %P = previous revision number
# %B = the branch number (e.g. '1.2.4')
# %d = date of revision
# %a = author of revision
# %s = state of revision
# %t = current tag of branch or revision
# %0..%9 = command-line argument -0 .. -9
# %l = HTMLized log entry of the revision
# NOTE: %l is obsolete. See %(%) and cvsgraph.conf(5) for
# more details.
# %L = log entry of revision
# The log entry expansion takes an optional argument to
# specify maximum length of the expansion like %L[25].
# %(...%) = HTMLize the string within the parenthesis.
# ViewVC currently uses the following four command-line arguments to
# pass URL information to cvsgraph:
# -3 link to current file's log page
# -4 link to current file's checkout page minus "rev" parameter
# -5 link to current file's diff page minus "r1" and "r2" parameters
# -6 link to current directory page minus "pathrev" parameter
#
# - Numbers may be entered as octal, decimal or
# hex as in 0117, 79 and 0x4f respectively.
#
# - Fonts are numbered 0..4 (defined as in libgd)
# 0 = tiny
# 1 = small
# 2 = medium (bold)
# 3 = large
# 4 = giant
#
# - Colors are a string like HTML type colors in
# the form "#rrggbb" with parts written in hex
# rr = red (00..ff)
# gg = green (00-ff)
# bb = blue (00-ff)
#
# - There are several reserved words besides of the
# feature-keywords. These additional reserved words
# expand to numerical values:
# * false = 0
# * true = 1
# * not = -1
# * left = 0
# * center = 1
# * right = 2
# * gif = 0
# * png = 1
# * jpeg = 2
# * tiny = 0
# * small = 1
# * medium = 2
# * large = 3
# * giant = 4
#
# - Booleans have three possible arguments: true, false
# and not. `Not' means inverse of what it was (logical
# negation) and is represented by the value -1.
# For the configuration file that means that the default
# value is negated.
#
# cvsroot <string>
# The *absolute* base directory where the
# CVS/RCS repository can be found
# cvsmodule <string>
#
cvsroot = "--unused--"; # unused with ViewVC, will be overridden
cvsmodule = ""; # unused with ViewVC -- please leave it blank
# color_bg <color>
# The background color of the image
# transparent_bg <boolean>
# Make color_bg the transparent color (only useful with PNG)
color_bg = "#ffffff";
transparent_bg = false;
# date_format <string>
# The strftime(3) format string for date and time
date_format = "%d-%b-%Y %H:%M:%S";
# box_shadow <boolean>
# Add a shadow around the boxes
# upside_down <boolean>
# Reverse the order of the revisions
# left_right <boolean>
# Draw the image left to right instead of top down,
# or right to left is upside_down is set simultaneously.
# strip_untagged <boolean>
# Remove all untagged revisions except the first, last and tagged ones
# strip_first_rev <boolean>
# Also remove the first revision if untagged
# auto_stretch <boolean>
# Try to reformat the tree to minimize image size
# use_ttf <boolean>
# Use TrueType fonts for text
# anti_alias <boolean>
# Enable pretty TrueType anti-alias drawing
# thick_lines <number>
# Draw all connector lines thicker (range: 1..11)
box_shadow = true;
upside_down = false;
left_right = false;
strip_untagged = false;
strip_first_rev = false;
#auto_stretch = true; # not yet stable.
use_ttf = false;
anti_alias = true;
thick_lines = 1;
# msg_color <color>
# Sets the error/warning message color
# msg_font <number>
# msg_ttfont <string>
# msg_ttsize <float>
# Sets the error/warning message font
msg_color = "#800000";
msg_font = medium;
msg_ttfont = "/dos/windows/fonts/ariali.ttf";
msg_ttsize = 11.0;
# parse_logs <boolean>
# Enable the parsing of the *entire* ,v file to read the
# log-entries between revisions. This is necessary for
# the %L expansion to work, but slows down parsing by
# a very large factor. You're warned.
parse_logs = false;
# tag_font <number>
# The font of the tag text
# tag_color <color>
# The color of the tag text
# tag_ignore <string>
# A extended regular expression to exclude certain tags from view.
# See regex(7) for details on the format.
# Note 1: tags matched in merge_from/merge_to are always displayed unless
# tag_ignore_merge is set to true.
# Note 2: normal string rules apply and special characters must be
# escaped.
# tag_ignore_merge <boolean>
# If set to true, allows tag_ignore to also hide merge_from and merge_to
# tags.
# tag_nocase <boolean>
# Ignore the case is tag_ignore expressions
# tag_negate <boolean>
# Negate the matching criteria of tag_ignore. When true, only matching
# tags will be shown.
# Note: tags matched with merge_from/merge_to will still be displayed.
tag_font = medium;
#tag_ttfont = "/dos/windows/fonts/ariali.ttf";
#tag_ttsize = 11.0;
tag_color = "#007000";
#tag_ignore = "(test|alpha)_release";
#tag_ignore_merge = false;
#tag_nocase = false;
#tag_negate = false;
# rev_hidenumber <boolean>
# If set to true no revision numbers will be printed in the graph.
#rev_hidenumber = false;
rev_font = giant;
#rev_ttfont = "/dos/windows/fonts/arial.ttf";
#rev_ttsize = 12.0;
rev_color = "#000000";
rev_bgcolor = "#f0f0f0";
rev_separator = 1;
rev_minline = 15;
rev_maxline = 75;
rev_lspace = 5;
rev_rspace = 5;
rev_tspace = 3;
rev_bspace = 3;
rev_text = "%d"; # or "%d\n%a, %s" for author and state too
rev_text_font = tiny;
#rev_text_ttfont = "/dos/windows/fonts/times.ttf";
#rev_text_ttsize = 9.0;
rev_text_color = "#500020";
rev_maxtags = 25;
# merge_color <color>
# The color of the line connecting merges
# merge_front <boolean>
# If true, draw the merge-lines on top if the image
# merge_nocase <boolean>
# Ignore case in regular expressions
# merge_from <string>
# A regex describing a tag that is used as the merge source
# merge_to <string>
# A regex describing a tag that is the target of the merge
# merge_findall <boolean>
# Try to match all merge_to targets possible. This can result in
# multiple lines originating from one tag.
# merge_arrows <boolean>
# Use arrows to point to the merge destination. Default is true.
# merge_cvsnt <boolean>
# Use CVSNT's mergepoint registration for merges
# merge_cvsnt_color <color>
# The color of the line connecting merges from/to registered
# mergepoints.
# arrow_width <number>
# arrow_length <number>
# Specify the size of the arrows. Default is 3 wide and 12 long.
#
# NOTE:
# - The merge_from is an extended regular expression as described in
# regex(7) and POSIX 1003.2 (see also Single Unix Specification at
# http://www.opengroup.com).
# - The merge_to is an extended regular expression with a twist. All
# subexpressions from the merge_from are expanded into merge_to
# using %[1-9] (in contrast to \[1-9] for backreferences). Care is
# taken to escape the constructed expression.
# - A '$' at the end of the merge_to expression can be important to
# prevent 'near match' references. Normally, you want the destination
# to be a good representation of the source. However, this depends
# on how well you defined the tags in the first place.
#
# Example:
# merge_from = "^f_(.*)";
# merge_to = "^t_%1$";
# tags: f_foo, f_bar, f_foobar, t_foo, t_bar
# result:
# f_foo -> "^t_foo$" -> t_foo
# f_bar -> "^t_bar$" -> t_bar
# f_foobar-> "^t_foobar$" -> <no match>
#
merge_color = "#a000a0";
merge_front = false;
merge_nocase = false;
merge_from = "^f_(.*)";
merge_to = "^t_%1$";
merge_findall = false;
#merge_arrows = true;
#arrow_width = 3;
#arrow_length = 12;
merge_cvsnt = true;
merge_cvsnt_color = "#606000";
# branch_font <number>
# The font of the number and tags
# branch_color <color>
# All branch element's color
# branch_[lrtb]space <number>
# Interior spacing (margin)
# branch_margin <number>
# Exterior spacing
# branch_connect <number>
# Length of the vertical connector
# branch_dupbox <boolean>
# Add the branch-tag also at the bottom/top of the trunk
# branch_fold <boolean>
# Fold empty branches in one box to save space
# branch_foldall <boolean>
# Put all empty branches in one box, even if they
# were interspaced with branches with revisions.
# branch_resort <boolean>
# Resort the branches by the number of revisions to save space
# branch_subtree <string>
# Only show the branch denoted or all branches that sprout
# from the denoted revision. The argument may be a symbolic
# tag. This option you would normally want to set from the
# command line with the -O option.
branch_font = medium;
#branch_ttfont = "/dos/windows/fonts/arialbd.ttf";
#branch_ttsize = 18.0;
branch_tag_color= "#000080";
branch_tag_font = medium;
#branch_tag_ttfont = "/dos/windows/fonts/arialbi.ttf";
#branch_tag_ttsize = 14.0;
branch_color = "#0000c0";
branch_bgcolor = "#ffffc0";
branch_lspace = 5;
branch_rspace = 5;
branch_tspace = 3;
branch_bspace = 3;
branch_margin = 15;
branch_connect = 8;
branch_dupbox = false;
branch_fold = true;
branch_foldall = false;
branch_resort = false;
#branch_subtree = "1.2.4";
# title <string>
# The title string is expanded (see above for details)
# title_[xy] <number>
# Position of title
# title_font <number>
# The font
# title_align <number>
# 0 = left
# 1 = center
# 2 = right
# title_color <color>
title = "%c%p%f\nRevisions: %r, Branches: %b";
title_x = 10;
title_y = 5;
title_font = small;
#title_ttfont = "/dos/windows/fonts/times.ttf";
#title_ttsize = 10.0;
title_align = left;
title_color = "#800000";
# Margins of the image
# Note: the title is outside the margin
margin_top = 35;
margin_bottom = 10;
margin_left = 10;
margin_right = 10;
# Image format(s)
# image_type <number|{gif,jpeg,png}>
# gif (0) = Create gif image
# png (1) = Create png image
# jpeg (2) = Create jpeg image
# Image types are available if they can be found in
# the gd library. Newer versions of gd do not have
# gif anymore. CvsGraph will automatically generate
# png images instead.
# image_quality <number>
# The quality of a jpeg image (1..100)
# image_compress <number>
# Set the compression of a PNG image (gd version >= 2.0.12).
# Values range from -1 to 9 where:
# - -1 default compression (usually 3)
# - 0 no compression
# - 1 lowest level compression
# - ... ...
# - 9 highest level of compression
# image_interlace <boolean>
# Write interlaces PNG/JPEG images for progressive loading.
image_type = png;
image_quality = 75;
image_compress = 3;
image_interlace = true;
# HTML image map generation
# map_name <string>
# The name= attribute in <map name="mapname">...</map>
# map_branch_href <string>
# map_branch_alt <string>
# map_rev_href <string>
# map_rev_alt <string>
# map_diff_href <string>
# map_diff_alt <string>
# map_merge_href <string>
# map_merge_alt <string>
# These are the href= and alt= attributes in the <area>
# tags of HTML. The strings are expanded (see above).
map_name = "MyMapName\" name=\"MyMapName";
map_branch_href = "href=\"%6pathrev=%(%t%)\"";
map_branch_alt = "alt=\"%0 %(%t%) (%B)\"";
# You might want to experiment with the following setting:
# 1. The default setting will take you to a ViewVC generated page displaying
# that revision of the file, if you click into a revision box:
map_rev_href = "href=\"%4rev=%R\"";
# 2. This alternative setting will take you to the anchor representing this
# revision on a ViewVC generated Log page for that file:
# map_rev_href = "href=\"%3#rev%R\"";
#
map_rev_alt = "alt=\"%1 %(%t%) (%R)\"";
map_diff_href = "href=\"%5r1=%P&amp;r2=%R\"";
map_diff_alt = "alt=\"%2 %P &lt;-&gt; %R\"";
map_merge_href = "href=\"%5r1=%P&amp;r2=%R\"";
map_merge_alt = "alt=\"%2 %P &lt;-&gt; %R\"";

File diff suppressed because it is too large Load Diff

1154
docs/upgrading-howto.html Normal file

File diff suppressed because it is too large Load Diff

1239
docs/url-reference.html Normal file

File diff suppressed because it is too large Load Diff

54
elemx/Makefile Normal file
View File

@@ -0,0 +1,54 @@
TARGETS = python/elx-python java/elx-java
all : $(TARGETS)
CFLAGS = -g -Wpointer-arith -Wwrite-strings -Wshadow -Wall
CPPFLAGS = -Ipython -Ijava -I.
# the scanner depends on tokens generated from python.y
python/scanner.c : python/python.c
# the keywords also need the tokens in python.h
python/py_keywords.c : python/python.c
# we need the scanner tokens in py_scan.h and keywords in py_keywords.h
python/elx-python.o : python/elx-python.c python/py_keywords.c
# we need java.[ch] generated first to get the tokens in java.h
java/j_scan.c : java/java.c java/j_keywords.c
# the keywords also need the tokens in java.h
java/j_keywords.c : java/java.c
# we need the scanner tokens in j_scan.h and keywords in j_keywords.h
java/elx-java.o : java/elx-java.c java/j_keywords.c java/java.c
python/elx-python : python/elx-python.o python/scanner.o python/python.o \
python/py_keywords.o elx-common.o
$(CC) -o $@ $^
java/elx-java : java/elx-java.o java/j_scan.o java/java.o java/j_keywords.o \
elx-common.o
$(CC) -o $@ $^
clean :
rm -f *.o
rm -f python/*.o python/python.[ch] python/py_keywords.[ch]
rm -f java/*.o java/java.[ch] java/j_keywords.[ch] java/j_scan.[ch]
rm -f python/*.output java/*.output
rm -f $(TARGETS)
.SUFFIXES:
.SUFFIXES: .c .y .shilka .o
%.c : %.y
@d="`echo $@ | sed 's/\.c//'`" ; \
echo msta -d -enum -v -o $$d $< ; \
msta -d -enum -v -o $$d $<
%.c : %.shilka
@d="`echo $@ | sed 's,/[^/]*$$,,'`" ; \
f="`echo $< | sed 's,.*/,,'`" ; \
echo shilka -length -no-definitions -interface $$f ; \
(cd $$d && shilka -length -no-definitions -interface $$f)

110
elemx/elx-common.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "elx.h"
#define ELX_ELEMS_EXT ".elx"
#define ELX_SYMBOLS_EXT ".els"
static void usage(const char *progname)
{
fprintf(stderr, "USAGE: %s FILENAME\n", progname);
exit(1);
}
static const char * build_one(const char *base, int len, const char *suffix)
{
int slen = strlen(suffix);
char *fn;
fn = malloc(len + slen + 1);
memcpy(fn, base, len);
memcpy(fn + len, suffix, slen);
fn[len + slen] = '\0';
return fn;
}
elx_context_t *elx_process_args(int argc, const char **argv)
{
elx_context_t *ec;
const char *input_fn;
const char *p;
int len;
/* ### in the future, we can expand this for more options */
if (argc != 2)
{
usage(argv[0]);
/* NOTREACHED */
}
input_fn = argv[1];
p = strrchr(input_fn, '.');
if (p == NULL)
len = strlen(input_fn);
else
len = p - argv[1];
ec = malloc(sizeof(*ec));
ec->input_fn = input_fn;
ec->elx_fn = build_one(input_fn, len, ELX_ELEMS_EXT);
ec->sym_fn = build_one(input_fn, len, ELX_SYMBOLS_EXT);
return ec;
}
void elx_open_files(elx_context_t *ec)
{
const char *fn;
const char *op;
if ((ec->input_fp = fopen(ec->input_fn, "r")) == NULL)
{
fn = ec->input_fn;
op = "reading";
goto error;
}
if ((ec->elx_fp = fopen(ec->elx_fn, "w")) == NULL)
{
fn = ec->elx_fn;
op = "writing";
goto error;
}
if ((ec->sym_fp = fopen(ec->sym_fn, "w")) == NULL)
{
fn = ec->sym_fn;
op = "writing";
goto error;
}
return;
error:
fprintf(stderr, "ERROR: file \"%s\" could not be opened for %s.\n %s\n",
fn, op, strerror(errno));
exit(2);
}
void elx_close_files(elx_context_t *ec)
{
fclose(ec->input_fp);
fclose(ec->elx_fp);
fclose(ec->sym_fp);
}
void elx_issue_token(elx_context_t *ec,
char which, int start, int len,
const char *symbol)
{
fprintf(ec->elx_fp, "%c %d %d\n", which, start, len);
if (ELX_DEFINES_SYM(which))
{
fprintf(ec->sym_fp, "%s %d %s\n", symbol, start, ec->input_fn);
}
}

54
elemx/elx.h Normal file
View File

@@ -0,0 +1,54 @@
#ifndef ELX_H
#define ELX_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define ELX_COMMENT 'C' /* a comment */
#define ELX_STRING 'S' /* a string constant */
#define ELX_KEYWORD 'K' /* a language keyword */
#define ELX_GLOBAL_FDEF 'F' /* function defn in global (visible) scope */
#define ELX_LOCAL_FDEF 'L' /* function defn in local (hidden) scope */
#define ELX_METHOD_DEF 'M' /* method definition */
#define ELX_FUNC_REF 'R' /* function reference / call */
#define ELX_DEFINES_SYM(c) ((c) == ELX_GLOBAL_FDEF || (c) == ELX_LOCAL_FDEF \
|| (c) == ELX_METHOD_DEF)
typedef struct
{
/* input filename */
const char *input_fn;
/* output filenames: element extractions, and symbols */
const char *elx_fn;
const char *sym_fn;
/* file pointers for each of the input/output files */
FILE *input_fp;
FILE *elx_fp;
FILE *sym_fp;
} elx_context_t;
elx_context_t *elx_process_args(int argc, const char **argv);
void elx_open_files(elx_context_t *ec);
void elx_close_files(elx_context_t *ec);
void elx_issue_token(elx_context_t *ec,
char which, int start, int len,
const char *symbol);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ELX_H */

121
elemx/elx_html.py Normal file
View File

@@ -0,0 +1,121 @@
#!/usr/bin/env python
#
# generate HTML given an input file and an element file
#
import re
import string
import cgi
import struct
_re_elem = re.compile('([a-zA-Z]) ([0-9]+) ([0-9]+)\n')
CHUNK_SIZE = 98304 # 4096*24
class ElemParser:
"Parse an elements file, extracting the token type, start, and length."
def __init__(self, efile):
self.efile = efile
def get(self):
line = self.efile.readline()
if not line:
return None, None, None
t, s, e = string.split(line)
return t, int(s)-1, int(e)
def unused_get(self):
record = self.efile.read(9)
if not record:
return None, None, None
return struct.unpack('>cii', record)
class Writer:
"Generate output, including copying from another input."
def __init__(self, ifile, ofile):
self.ifile = ifile
self.ofile = ofile
self.buf = ifile.read(CHUNK_SIZE)
self.offset = 0
def write(self, data):
self.ofile.write(data)
def copy(self, pos, amt):
"Copy 'amt' bytes from position 'pos' of input to output."
idx = pos - self.offset
self.ofile.write(cgi.escape(buffer(self.buf, idx, amt)))
amt = amt - (len(self.buf) - idx)
while amt > 0:
self._more()
self.ofile.write(cgi.escape(buffer(self.buf, 0, amt)))
amt = amt - len(self.buf)
def flush(self, pos):
"Flush the rest of the input to the output."
idx = pos - self.offset
self.ofile.write(cgi.escape(buffer(self.buf, idx)))
while 1:
buf = self.ifile.read(CHUNK_SIZE)
if not buf:
break
self.ofile.write(cgi.escape(buf))
def _more(self):
self.offset = self.offset + len(self.buf)
self.buf = self.ifile.read(CHUNK_SIZE)
def generate(input, elems, output, genpage=0):
ep = ElemParser(elems)
w = Writer(input, output)
cur = 0
if genpage:
w.write('''\
<html><head><title>ELX Output Page</title>
<style type="text/css">
.elx_C { color: firebrick; font-style: italic; }
.elx_S { color: #bc8f8f; font-weight: bold; }
.elx_K { color: purple; font-weight: bold }
.elx_F { color: blue; font-weight: bold; }
.elx_L { color: blue; font-weight: bold; }
.elx_M { color: blue; font-weight: bold; }
.elx_R { color: blue; font-weight: bold; }
</style>
</head>
<body>
''')
w.write('<pre>')
while 1:
type, start, length = ep.get()
if type is None:
break
if cur < start:
# print out some plain text up to 'cur'
w.copy(cur, start - cur)
# wrap a bit o' formatting here
w.write('<span class="elx_%s">' % type)
# copy over the token
w.copy(start, length)
# and close up the formatting
w.write('</span>')
cur = start + length
# all done.
w.flush(cur)
w.write('</pre>')
if genpage:
w.write('</body></html>\n')
if __name__ == '__main__':
import sys
generate(open(sys.argv[1]), open(sys.argv[2]), sys.stdout, 1)

26
elemx/elx_page.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
if test "$#" != 2; then
echo "USAGE: $0 SOURCE-FILE ELX-FILE"
exit 1
fi
cat <<EOF
<html><head><title>ELX Output Page</title>
<style type="text/css">
.elx_C { color: firebrick; font-style: italic; }
.elx_S { color: #bc8f8f; font-weight: bold; }
.elx_K { color: purple; font-weight: bold }
.elx_F { color: blue; font-weight: bold; }
.elx_L { color: blue; font-weight: bold; }
.elx_M { color: blue; font-weight: bold; }
.elx_R { color: blue; font-weight: bold; }
</style>
</head>
<body>
EOF
dirname="`dirname $0`"
python2 $dirname/elx_html.py $1 $2
echo "</body></html>"

8
elemx/java/.cvsignore Normal file
View File

@@ -0,0 +1,8 @@
elx-java
j_keywords.c
j_keywords.h
j_scan.c
j_scan.h
java.c
java.h
*.output

148
elemx/java/elx-java.c Normal file
View File

@@ -0,0 +1,148 @@
#include <stdio.h>
#include <stdlib.h>
#include "java.h"
#include "j_keywords.h"
#include "elx.h"
/* from j_scan.c */
extern int yylex(void);
extern void yylex_start(int *error_flag);
extern void yylex_finish(void);
extern const char *get_identifier(void);
static const char *fname;
static int saw_error = 0;
static int lineno = 1;
static int hpos = 1;
static int fpos = 0;
static int token_start = 0;
static int start_lineno;
static int start_hpos;
static elx_context_t *ectx;
//#define DEBUG_SCANNER
/* if we're debugging, then the scanner looks for this var */
int yysdebug = 0;
/* and the parser looks for this */
int yydebug = 1;
void yyserror(const char *msg)
{
fprintf(stderr, "%s:%d:%d: lex error: %s\n",
fname, start_lineno, start_hpos, msg);
saw_error = 1;
}
void yyerror(const char *msg)
{
fprintf(stderr, "%s:%d:%d: parse error: %s\n",
fname, start_lineno, start_hpos, msg);
saw_error = 1;
}
int yyslex(void)
{
int c = fgetc(ectx->input_fp);
if (c == EOF)
return -1; /* tell lexer we're done */
++fpos;
if (c == '\n')
{
hpos = 1;
++lineno;
}
else
++hpos;
// printf("char: '%c'\n", c);
return c;
}
void issue_token(char which)
{
const char *ident = NULL;
if (ELX_DEFINES_SYM(which))
ident = get_identifier();
else
ident = NULL;
elx_issue_token(ectx, which, token_start, fpos - token_start + 1, ident);
}
void mark_token_start(void)
{
token_start = fpos;
start_lineno = lineno;
start_hpos = hpos;
}
#ifdef DEBUG_SCANNER
void gen_scan_tokens(void)
{
while (1)
{
int v = yylex();
if (v == TK_IDENTIFIER)
printf("%d-%d: %d '%s'\n",
token_start, fpos-1, v, get_identifier());
else
printf("%d-%d: %d\n", token_start, fpos-1, v);
/* end of parse? */
if (v <= 0)
break;
}
}
#else /* DEBUG_SCANNER */
static void gen_elx_tokens(void)
{
/* ### what to do with the result? should have seen/set saw_error */
(void) yyparse();
}
#endif /* DEBUG_SCANNER */
int main(int argc, const char **argv)
{
int errcode;
ectx = elx_process_args(argc, argv);
yylex_start(&errcode);
if (errcode)
{
fprintf(stderr, "error: yylex_start: %d\n", errcode);
return EXIT_FAILURE;
}
elx_open_files(ectx);
#ifdef DEBUG_SCANNER
gen_scan_tokens();
#else
gen_elx_tokens();
#endif
yylex_finish();
elx_close_files(ectx);
if (saw_error)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,65 @@
%local {
/* get the KR_* values */
#include "java.h"
}
%%
abstract
boolean
break
byte
/* byvalue */
case
/* cast */
catch
char
class
/* const */
continue
default
do
double
else
extends
false
final
finally
float
for
/* future */
/* generic */
/* goto */
if
implements
import
/* inner */
instanceof
int
interface
long
native
new
null
/* operator */
/* outer */
package
private
protected
public
/* rest */
return
short
static
super
switch
synchronized
this
throw
throws
transient
true
try
/* var */
void
volatile
while

135
elemx/java/j_scan.y Normal file
View File

@@ -0,0 +1,135 @@
%start token
%scanner
%local {
#include "elx.h"
/* from elx-java.c */
void yyserror(const char *msg);
int yyslex(void);
/* for the TK_ symbols, generated from java.y */
#include "java.h"
/* for keyword recognition */
#include "j_keywords.h"
extern void issue_token(char which);
extern void mark_token_start(void);
#define MAX_IDENT 200
static int idlen;
static char identifier[MAX_IDENT+1];
#define INIT_IDENT(c) (identifier[0] = (c), idlen = 1)
#define ADD_IDENT(c) if (idlen == MAX_IDENT) return E_IDENT_TOO_LONG; \
else identifier[idlen++] = (c)
/* ### is there a better place? */
#define E_IDENT_TOO_LONG (-100)
static int lookup(void);
}
%%
token : pure_ws* { mark_token_start(); } slash_op
slash_op : "/=" { return TK_OPERATOR; }
| comment token
| '/' { return TK_OPERATOR; }
| one_token
|
;
one_token : t_identifier { return lookup(); }
| t_literal { return TK_LITERAL; }
| t_operator { return TK_OPERATOR; }
| t_chars { return yysprev_char; }
| t_inc_dec { return TK_INC_DEC; }
| t_bracket
;
t_identifier : alpha { INIT_IDENT(yysprev_char); }
( alphanum { ADD_IDENT(yysprev_char); } )*
alpha : 'a' - 'z' | 'A' - 'Z' | '_' | '$'
alphanum : alpha | digit
digit : '0' - '9'
hexdigit : digit | 'a' - 'f' | 'A' - 'F'
octal : '0' - '7'
t_literal : number | string | char_constant
number : ('1' - '9') digit* decimal_suffix
| '.' digit+ [exponent] [float_suffix]
| '0' (('x' | 'X') hexdigit+ | octal+) decimal_suffix
;
decimal_suffix : ('.' digit* [exponent] [float_suffix])
| 'l' | 'L'
| /* nothing */
;
exponent : ('e' | 'E') ['+' | '-'] digit+
float_suffix : 'f' | 'F' | 'd' | 'D'
string : '"' string_char* '"' { issue_token(ELX_STRING); }
string_char : '\1' -> '"' | '"' <-> '\\' | '\\' <- '\377' | '\\' '\1' - '\377'
char_constant : '\'' one_char '\''
one_char : '\1' -> '\'' | '\'' <-> '\\' | '\\' <- '\377' | '\\' '\1' - '\377'
comment : ( "//" line_comment_char* '\n'
| "/*" (block_comment_char | '*' block_non_term_char)* "*/"
) { issue_token(ELX_COMMENT); }
;
line_comment_char : '\1' -> '\n' | '\n' <- '\377'
block_comment_char : '\1' -> '*' | '*' <- '\377'
block_non_term_char : '\1' -> '/' | '/' <- '\377'
t_operator : "<<" | ">>" | ">>>"
| ">=" | "<=" | "==" | "!=" | "&&" | "||"
| "*=" | "%=" | "+=" | "-=" | "<<=" | ">>="
| ">>>=" | "&=" | "^=" | "|="
| '<' | '>' | '%' | '^' | '&' | '|'
;
t_inc_dec : "++" | "--"
/* note: could not use ws* ; the '[' form would only reduce on $end
rather than "any" character. that meant we could not recognize '['
within the program text. separating out the cases Does The Right
Thing */
t_bracket : '[' { return '['; }
| '[' ']' { return TK_DIM; }
| '[' ws+ ']' { return TK_DIM; }
;
t_chars : ',' | ';' | '.' | '{' | '}' | '=' | '(' | ')' | ':'
| ']' | '!' | '~' | '+' | '-' | '*' | '?'
;
ws : pure_ws | comment
pure_ws : ' ' | '\t' | '\n' | '\f'
%%
static int lookup(void)
{
int kw = KR_find_keyword(identifier, idlen);
if (kw == KR__not_found)
{
/* terminate so user can grab an identifier string */
identifier[idlen] = '\0';
return TK_IDENTIFIER;
}
issue_token(ELX_KEYWORD);
return kw;
}
const char *get_identifier(void)
{
return identifier;
}

458
elemx/java/java.y Normal file
View File

@@ -0,0 +1,458 @@
%token KR_abstract
%token KR_boolean KR_break KR_byte /* KR_byvalue */
%token KR_case /* KR_cast */ KR_catch KR_char KR_class /* KR_const */ KR_continue
%token KR_default KR_do KR_double
%token KR_else KR_extends
%token KR_false KR_final KR_finally KR_float KR_for /* KR_future */
/* %token KR_generic KR_goto */
%token KR_if KR_implements KR_import /* KR_inner */ KR_instanceof KR_int KR_interface
%token KR_long
%token KR_native KR_new KR_null
/* %token KR_operator KR_outer */
%token KR_package KR_private KR_protected KR_public
%token /* KR_rest */ KR_return
%token KR_short KR_static KR_super KR_switch KR_synchronized
%token KR_this KR_throw KR_throws KR_transient KR_true KR_try
%token /* KR_var */ KR_void KR_volatile
%token KR_while
%token TK_OP_ASSIGN TK_OPERATOR TK_IDENTIFIER TK_LITERAL
%token TK_DIM TK_INC_DEC
%start CompilationUnit
/* the standard if/then/else conflict */
/* %expect 1 */
%{
#include "elx.h"
void yyerror(const char *msg);
int yylex(void);
/* ### should come from an elx-python.h or something */
void issue_token(char which);
%}
%export {
/* the main parsing function */
int yyparse(void);
/* need to define the 'not found' in addition to the regular keywords */
#define KR__not_found 0
}
%%
TypeSpecifier
: TypeName
| TypeNameDims
;
TypeNameDims
: TypeName TK_DIM+
;
TypeNameDot
: NamePeriod
| PrimitiveType '.'
;
TypeName
: PrimitiveType
| NamePeriod TK_IDENTIFIER
| TK_IDENTIFIER
;
NamePeriod
: TK_IDENTIFIER '.'
| NamePeriod TK_IDENTIFIER '.'
;
TypeNameList
: TypeName / ','
;
PrimitiveType
: KR_boolean
| KR_byte
| KR_char
| KR_double
| KR_float
| KR_int
| KR_long
| KR_short
| KR_void
;
CompilationUnit
: PackageStatement [ImportStatements] [TypeDeclarations]
| ImportStatements [TypeDeclarations]
| TypeDeclarations
;
PackageStatement
: KR_package (TK_IDENTIFIER / '.') ';'
;
TypeDeclarations
: TypeDeclaration+
;
TypeDeclaration
: ClassDeclaration
| InterfaceDeclaration
;
ImportStatements
: ImportStatement+
;
ImportStatement
: KR_import TK_IDENTIFIER ('.' TK_IDENTIFIER)* [".*"] ';'
;
/*
QualifiedName
: TK_IDENTIFIER / '.'
;
*/
ClassDeclaration
: [Modifiers] KR_class TK_IDENTIFIER [Super] [Interfaces] ClassBody
;
Modifiers
: Modifier+
;
Modifier
: KR_abstract
| KR_final
| KR_public
| KR_protected
| KR_private
| KR_static
| KR_transient
| KR_volatile
| KR_native
| KR_synchronized
;
Super
: KR_extends TypeNameList
;
Interfaces
: KR_implements TypeNameList
;
ClassBody
: '{' FieldDeclaration* '}'
;
FieldDeclaration
: FieldVariableDeclaration
| MethodDeclaration
| ConstructorDeclaration
| StaticInitializer
;
FieldVariableDeclaration
: [Modifiers] TypeSpecifier VariableDeclarators ';'
;
VariableDeclarators
: VariableDeclarator / ','
;
VariableDeclarator
: DeclaratorName ['=' VariableInitializer]
;
VariableInitializer
: Expression
| '{' [ArrayInitializers] '}'
;
ArrayInitializers
: VariableInitializer ( ',' [VariableInitializer] )*
;
MethodDeclaration
: [Modifiers] TypeSpecifier MethodDeclarator [Throws] MethodBody
;
MethodDeclarator
: DeclaratorName '(' [ParameterList] ')' TK_DIM*
;
ParameterList
: Parameter / ','
;
Parameter
: TypeSpecifier DeclaratorName
;
DeclaratorName
: TK_IDENTIFIER TK_DIM*
;
Throws
: KR_throws TypeNameList
;
MethodBody
: Block
| ';'
;
ConstructorDeclaration
: [Modifiers] ConstructorDeclarator [Throws] Block
;
ConstructorDeclarator
: TypeName '(' [ParameterList] ')'
;
StaticInitializer
: KR_static Block
;
InterfaceDeclaration
: [Modifiers] KR_interface TK_IDENTIFIER [ExtendsInterfaces] InterfaceBody
;
ExtendsInterfaces
: KR_extends TypeNameList
;
InterfaceBody
: '{' FieldDeclaration+ '}'
;
Block
: '{' LocalVariableDeclarationOrStatement* '}'
;
LocalVariableDeclarationOrStatement
: LocalVariableDeclarationStatement
| Statement
;
LocalVariableDeclarationStatement
: TypeSpecifier VariableDeclarators ';'
;
Statement
: EmptyStatement
| LabeledStatement
| ExpressionStatement ';'
| SelectionStatement
| IterationStatement
| JumpStatement
| GuardingStatement
| Block
;
EmptyStatement
: ';'
;
LabeledStatement
: TK_IDENTIFIER ':' LocalVariableDeclarationOrStatement
| KR_case ConstantExpression ':' LocalVariableDeclarationOrStatement
| KR_default ':' LocalVariableDeclarationOrStatement
;
ExpressionStatement
: Expression
;
SelectionStatement
: KR_if '(' Expression ')' Statement [KR_else Statement]
| KR_switch '(' Expression ')' Block
;
IterationStatement
: KR_while '(' Expression ')' Statement
| KR_do Statement KR_while '(' Expression ')' ';'
| KR_for '(' ForInit ForExpr [ForIncr] ')' Statement
;
ForInit
: ExpressionStatements ';'
| LocalVariableDeclarationStatement
| ';'
;
ForExpr
: [Expression] ';'
;
ForIncr
: ExpressionStatements
;
ExpressionStatements
: ExpressionStatement / ','
;
JumpStatement
: KR_break [TK_IDENTIFIER] ';'
| KR_continue [TK_IDENTIFIER] ';'
| KR_return [Expression] ';'
| KR_throw Expression ';'
;
GuardingStatement
: KR_synchronized '(' Expression ')' Statement
| KR_try Block Finally
| KR_try Block Catches
| KR_try Block Catches Finally
;
Catches
: Catch+
;
Catch
: KR_catch '(' TypeSpecifier [TK_IDENTIFIER] ')' Block
;
Finally
: KR_finally Block
;
ArgumentList
: Expression / ','
;
PrimaryExpression
: TK_LITERAL
| KR_true | KR_false
| KR_this
| KR_null
| KR_super
| '(' Expression ')'
;
PostfixExpression
: PrimaryExpression Trailers
| TypeName AltTrailers
| TypeNameDot FollowsPeriod Trailers
| TypeNameDot DimAllocation TypeTrailers
| TypeNameDims TypeTrailers
| KR_new TypeName AltTrailers
| KR_new TypeNameDims TypeTrailers
;
DimAllocation
: KR_new TypeNameDims
;
PostfixDims
: TK_DIM+ '.' KR_class
;
FollowsPeriod
: KR_this
| KR_class
| KR_super
| KR_new TypeName NoPeriodsTrailer
;
NoPeriodsTrailer
: '[' Expression ']'
| '(' [ArgumentList] ')'
;
NoDimTrailer
: NoPeriodsTrailer
| '.' (FollowsPeriod | TK_IDENTIFIER)
;
AnyTrailer
: NoDimTrailer
| PostfixDims
;
Trailers
: (AnyTrailer | DimAllocation NoDimTrailer)* [DimAllocation]
;
AltTrailers
: NoPeriodsTrailer Trailers
|
;
TypeTrailers
: NoDimTrailer Trailers
|
;
CastablePrefixExpression
: PostfixExpression [TK_INC_DEC]
| LogicalUnaryOperator CastExpression
;
LogicalUnaryOperator
: '~'
| '!'
;
UnaryOperator
: '+'
| '-'
| TK_INC_DEC
;
/* note: we don't actually have grammar for a cast. we just rely on:
(expr) (argument)
as our parse match */
CastExpression
: /* '(' PrimitiveType ')' CastExpression
| '(' NamePeriod TK_IDENTIFIER TK_DIM TK_DIM* ')' CastablePrefixExpression
| '(' NamePeriod TK_IDENTIFIER ')' CastablePrefixExpression
| '(' TK_IDENTIFIER TK_DIM TK_DIM* ')' CastablePrefixExpression
| '(' TK_IDENTIFIER ')' CastablePrefixExpression
| */ UnaryOperator CastExpression
| CastablePrefixExpression
;
BinaryExpression
: CastExpression
| BinaryExpression TK_BINARY CastExpression
| BinaryExpression KR_instanceof TypeSpecifier
;
ConditionalExpression
: BinaryExpression
| BinaryExpression '?' Expression ':' ConditionalExpression
;
AssignmentExpression
: ConditionalExpression [AssignmentOperator AssignmentExpression]
;
AssignmentOperator
: '='
| TK_OP_ASSIGN
;
Expression
: AssignmentExpression
;
ConstantExpression
: ConditionalExpression
;
/*
TK_OPERATOR : OP_LOR | OP_LAND
| OP_EQ | OP_NE | OP_LE | OP_GE
| OP_SHL | OP_SHR | OP_SHRR
;
*/
TK_BINARY : TK_OPERATOR | '+' | '-' | '*'

6
elemx/python/.cvsignore Normal file
View File

@@ -0,0 +1,6 @@
elx-python
py_keywords.c
py_keywords.h
python.c
python.h
*.output

150
elemx/python/elx-python.c Normal file
View File

@@ -0,0 +1,150 @@
#include <stdio.h>
#include <stdlib.h>
#include "scanner.h"
#include "python.h"
#include "py_keywords.h"
#include "elx.h"
extern int yylex(void);
static const char *fname;
static int saw_error = 0;
static void *scan_ctx;
static elx_context_t *ectx;
void yyerror(const char *msg)
{
int sl, sc, el, ec;
scanner_token_linecol(scan_ctx, &sl, &sc, &el, &ec);
fprintf(stderr, "%s:%d:%d: parse error: %s\n", fname, sl, sc, msg);
saw_error = 1;
}
int reader(void *user_ctx)
{
FILE *inf = user_ctx;
int c = fgetc(inf);
if (c == EOF)
return SCANNER_EOF;
// printf("char: '%c'\n", c);
return c;
}
void issue_token(char which)
{
int start;
int end;
const char *ident = NULL;
scanner_token_range(scan_ctx, &start, &end);
if (ELX_DEFINES_SYM(which))
{
int length;
scanner_identifier(scan_ctx, &ident, &length);
}
elx_issue_token(ectx, which, start, end - start + 1, ident);
}
int yylex(void)
{
int v;
do {
v = scanner_get_token(scan_ctx);
if (v == TK_COMMENT)
{
issue_token(ELX_COMMENT);
}
} while (v == TK_COMMENT);
/* is this identifier a keyword? */
if (v == TK_IDENTIFIER)
{
const char *ident;
int length;
int kw;
scanner_identifier(scan_ctx, &ident, &length);
#if 0
printf("id=%s\n", ident);
#endif
kw = KR_find_keyword(ident, length);
if (kw != KR__not_found)
{
v = kw;
issue_token(ELX_KEYWORD);
}
}
else if (v == TK_STRING)
{
issue_token(ELX_STRING);
}
// printf("token=%d\n", v);
return v;
}
#ifdef DEBUG_SCANNER
void gen_scan_tokens(void)
{
while (1)
{
int v = scanner_get_token(scan_ctx);
int sl, sc, el, ec;
scanner_token_linecol(scan_ctx, &sl, &sc, &el, &ec);
if (v == TK_NEWLINE)
printf("%d,%d: NEWLINE\n", sl, sc);
else if (v == TK_INDENT)
printf("%d,%d: INDENT\n", el, ec);
else if (v == TK_DEDENT)
printf("%d,%d: DEDENT\n", el, ec);
else
printf("%d,%d-%d,%d: %d\n", sl, sc, el, ec, v);
/* end of parse? */
if (v <= 0)
break;
}
}
#endif /* DEBUG_SCANNER */
static void gen_elx_tokens(void)
{
/* ### what to do with the result? should have seen/set saw_error */
(void) yyparse();
}
int main(int argc, const char **argv)
{
ectx = elx_process_args(argc, argv);
elx_open_files(ectx);
scan_ctx = scanner_begin(reader, ectx->input_fp);
#ifdef DEBUG_SCANNER
gen_scan_tokens();
#else
gen_elx_tokens();
#endif
scanner_end(scan_ctx);
elx_close_files(ectx);
if (saw_error)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,36 @@
%local {
/* get the KR_* values */
#include "python.h"
}
%%
and
/* as */
assert
break
class
continue
def
del
elif
else
except
exec
finally
for
from
global
if
import
in
is
lambda
not
or
pass
print
raise
return
try
while
yield

135
elemx/python/python.y Normal file
View File

@@ -0,0 +1,135 @@
%token TK_COMMENT TK_IDENTIFIER TK_NUMBER
%token TK_OPERATOR TK_STRING
%token TK_INDENT TK_DEDENT TK_NEWLINE
%token KR_and KR_assert KR_break KR_class KR_continue KR_def
%token KR_del KR_elif KR_else KR_except KR_exec KR_finally
%token KR_for KR_from KR_global KR_if KR_import KR_in KR_is
%token KR_lambda KR_not KR_or KR_pass KR_print KR_raise
%token KR_return KR_try KR_while KR_yield
%start file_input
%{
#include "elx.h"
void yyerror(const char *msg);
int yylex(void);
/* ### should come from an elx-python.h or something */
void issue_token(char which);
%}
%export {
/* the main parsing function */
int yyparse(void);
/* need to define the 'not found' in addition to the regular keywords */
#define KR__not_found 0
}
%%
file_input: (TK_NEWLINE | stmt)*
NAME: TK_IDENTIFIER
funcdef: KR_def NAME { issue_token(ELX_LOCAL_FDEF); } parameters ':' suite
parameters: '(' [varargslist] ')'
varargslist: paramdef (',' paramdef)* [',' [varargsdef]]
| varargsdef
;
/* the TK_OPERATOR represents '*' or '**' */
varargsdef: TK_OPERATOR NAME [',' TK_OPERATOR NAME]
paramdef: fpdef [TK_OPERATOR test]
fpdef: NAME | '(' fplist ')'
fplist: fpdef (',' fpdef)* [',']
stmt: simple_stmt | compound_stmt
simple_stmt: small_stmt (';' small_stmt)* [';'] TK_NEWLINE
small_stmt: expr_stmt | print_stmt | raise_stmt
| import_stmt | global_stmt | exec_stmt | assert_stmt
| KR_del exprlist
| KR_pass
| KR_break
| KR_continue
| KR_return [testlist]
| KR_yield testlist
;
/* expr_stmt is normally assignment, which we get thru TK_OPERATOR in 'expr' */
expr_stmt: testlist
/* a print normally allows '>> test'; since that is a TK_OPERATOR, we
get it as part of 'factor'. this rule also allows for a trailing
comma in '>> test,' which the normal print doesn't */
print_stmt: KR_print [test (',' test)* [',']]
raise_stmt: KR_raise [test [',' test [',' test]]]
/* the TK_OPERATOR represents '*' */
import_stmt: KR_import dotted_as_name (',' dotted_as_name)*
| KR_from dotted_name KR_import (TK_OPERATOR | import_as_name (',' import_as_name)*)
import_as_name: NAME [NAME NAME]
dotted_as_name: dotted_name [NAME NAME]
dotted_name: NAME ('.' NAME)*
global_stmt: KR_global NAME (',' NAME)*
exec_stmt: KR_exec expr [KR_in test [',' test]]
assert_stmt: KR_assert test [',' test]
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
if_stmt: KR_if test ':' suite (KR_elif test ':' suite)* [KR_else ':' suite]
while_stmt: KR_while test ':' suite [KR_else ':' suite]
for_stmt: KR_for exprlist KR_in testlist ':' suite [KR_else ':' suite]
try_stmt: KR_try ':' suite (except_clause ':' suite)+
[KR_else ':' suite] | KR_try ':' suite KR_finally ':' suite
/* NB compile.c makes sure that the default except clause is last */
except_clause: KR_except [test [',' test]]
suite: simple_stmt | TK_NEWLINE TK_INDENT stmt+ TK_DEDENT
test: test_factor (test_op test_factor | KR_is [KR_not] factor)*
[TK_OPERATOR lambdef] | lambdef
test_op: bin_op | KR_in
test_factor: KR_not* factor
expr: factor (expr_op factor)*
expr_op: bin_op | KR_is [KR_not]
factor: TK_OPERATOR* atom trailer*
bin_op: TK_OPERATOR | KR_or | KR_and | KR_not KR_in
atom: '(' [testlist] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}'
| '`' testlist_no_trailing '`' | TK_IDENTIFIER | TK_NUMBER | TK_STRING+
listmaker: test ( list_for | (',' test)* [','] )
lambdef: KR_lambda [varargslist] ':' test
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
subscriptlist: subscript (',' subscript)* [',']
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
sliceop: ':' [test]
exprlist: expr (',' expr)* [',']
testlist: test (',' test)* [',']
testlist_no_trailing: test (',' test)*
testlist_safe: test [(',' test)+ [',']] /* doesn't match: test, */
dictmaker: test ':' test (',' test ':' test)* [',']
classdef: KR_class NAME ['(' testlist ')'] ':' suite
/* arguments are normally 'keyword = test; since '=' is TK_OPERATOR, we
match keyword arguments as part of 'test' (in 'expr').
the vararg portion is normally '* test' or '** test'; since '*' and
'**' are TK_OPERATOR, we match varargs as part of 'test' (in
'factor')
thus, all argument forms are simply 'test'
varargs does not normally allow a trailing comma, but we can
simplify things and allow a match
*/
arglist: test (',' test)* [',']
list_iter: list_for | list_if
list_for: KR_for exprlist KR_in testlist_safe [list_iter]
list_if: KR_if test [list_iter]

523
elemx/python/scanner.c Normal file
View File

@@ -0,0 +1,523 @@
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <string.h>
#include "python.h" /* get the TK_ values */
#include "scanner.h"
#define SCANNER_EMPTY (SCANNER_EOF - 1) /* -2 */
#define SCANNER_TABSIZE 8
#define SCANNER_MAXINDENT 100
#define SCANNER_MAXIDLEN 200
typedef struct
{
get_char_t getfunc;
void *user_ctx;
char saved;
int was_newline; /* was previous character a newline? */
int start; /* start position of last token returned */
int start_col;
int start_line;
int fpos; /* file position */
int lineno; /* file line number */
int line_pos; /* file position of current line's first char */
int nesting_level;
int indent; /* which indent */
int indents[SCANNER_MAXINDENT]; /* the set of indents */
int dedent_count; /* how many DEDENTs to issue */
int skip_newline; /* skip the newline after a blank_line + comment */
int idlen;
char identifier[SCANNER_MAXIDLEN]; /* accumulated identifier */
} scanner_ctx;
static int next_char(scanner_ctx *ctx)
{
int c;
++ctx->fpos;
if (ctx->saved == SCANNER_EMPTY)
{
return (*ctx->getfunc)(ctx->user_ctx);
}
c = ctx->saved;
ctx->saved = SCANNER_EMPTY;
return c;
}
static void backup_char(scanner_ctx *ctx, int c)
{
assert(ctx->saved == SCANNER_EMPTY);
ctx->saved = c;
ctx->was_newline = 0; /* we may have put it back */
--ctx->fpos;
}
/* called to note that we've moved on to another line */
static void on_next_line(scanner_ctx *ctx)
{
ctx->line_pos = ctx->fpos;
++ctx->lineno;
}
void *scanner_begin(get_char_t getfunc, void *user_ctx)
{
scanner_ctx *ctx = malloc(sizeof(*ctx));
memset(ctx, 0, sizeof(*ctx));
ctx->getfunc = getfunc;
ctx->user_ctx = user_ctx;
ctx->saved = SCANNER_EMPTY;
ctx->lineno = 1;
return ctx;
}
int scanner_get_token(void *opaque_ctx)
{
scanner_ctx *ctx = opaque_ctx;
int c;
int c2;
int blank_line;
if (ctx->dedent_count)
{
--ctx->dedent_count;
return TK_DEDENT;
}
nextline:
blank_line = 0;
/* if we're at the start of the line, then get the indentation level */
if (ctx->fpos == ctx->line_pos)
{
int col = 0;
while (1)
{
c = next_char(ctx);
if (c == ' ')
++col;
else if (c == '\t')
col = (col / SCANNER_TABSIZE + 1) * SCANNER_TABSIZE;
else if (c == '\f') /* ^L / formfeed */
col = 0;
else
break;
}
backup_char(ctx, c);
if (c == '#' || c == '\n')
{
/* this is a "blank" line and doesn't count towards indentation,
and it doesn't produce NEWLINE tokens */
blank_line = 1;
}
/* if it isn't blank, and we aren't inside nesting expressions, then
we need to handle INDENT/DEDENT */
if (!blank_line && ctx->nesting_level == 0)
{
int last_indent = ctx->indents[ctx->indent];
if (col == last_indent)
{
/* no change */
}
else if (col > last_indent)
{
if (ctx->indent == SCANNER_MAXINDENT - 1)
{
/* oops. too deep. */
return E_TOO_MANY_INDENTS;
}
ctx->indents[++ctx->indent] = col;
return TK_INDENT;
}
else /* col < last_indent */
{
/* find the previous indentation that matches this one */
while (ctx->indent > 0
&& col < ctx->indents[ctx->indent])
{
++ctx->dedent_count;
--ctx->indent;
}
if (col != ctx->indents[ctx->indent])
{
/* oops. dedent doesn't match any indent. */
return E_DEDENT_MISMATCH;
}
/* deliver one dedent now */
--ctx->dedent_count;
return TK_DEDENT;
}
} /* !blank_line ... */
} /* start of line */
/* start here if we see a line continuation */
read_more:
do {
c = next_char(ctx);
} while (c == ' ' || c == '\t' || c == '\f');
/* here is where the token starts */
ctx->start = ctx->fpos;
ctx->start_line = ctx->lineno;
ctx->start_col = ctx->fpos - ctx->line_pos;
/* comment? */
if (c == '#')
{
do {
c = next_char(ctx);
} while (c != SCANNER_EOF && c != '\n');
/* if we are suppressing newlines because this is a blank line, then
leave a marker to skip the newline, next time through. */
if (blank_line && c == '\n')
ctx->skip_newline = 1;
/* put back whatever we sucked up */
backup_char(ctx, c);
return TK_COMMENT;
}
/* Look for an identifier */
if (isalpha(c) || c == '_')
{
ctx->idlen = 0;
/* is this actually a string? */
if (c == 'r' || c == 'R')
{
ctx->identifier[ctx->idlen++] = c;
c = next_char(ctx);
if (c == '"' || c == '\'')
goto parse_string;
}
else if (c == 'u' || c == 'U')
{
ctx->identifier[ctx->idlen++] = c;
c = next_char(ctx);
if (c == 'r' || c == 'R')
{
ctx->identifier[ctx->idlen++] = c;
c = next_char(ctx);
}
if (c == '"' || c == '\'')
goto parse_string;
}
while (isalnum(c) || c == '_') {
/* store the character if there is room for it, and room left
for a null-terminator. */
if (ctx->idlen < SCANNER_MAXIDLEN-1)
ctx->identifier[ctx->idlen++] = c;
c = next_char(ctx);
}
backup_char(ctx, c);
/* ### check for a keyword */
return TK_IDENTIFIER;
}
if (c == '\n')
{
on_next_line(ctx);
/* don't report NEWLINE tokens for blank lines or nested exprs */
if (blank_line || ctx->nesting_level > 0 || ctx->skip_newline)
{
ctx->skip_newline = 0;
goto nextline;
}
return TK_NEWLINE;
}
if (c == '.')
{
c = next_char(ctx);
if (isdigit(c))
goto parse_fraction;
backup_char(ctx, c);
return '.';
}
if (isdigit(c))
{
if (c == '0')
{
c = next_char(ctx);
if (c == 'x' || c == 'X')
{
do {
c = next_char(ctx);
} while (isxdigit(c));
goto skip_fp;
}
else if (isdigit(c))
{
do {
c = next_char(ctx);
} while (isdigit(c));
}
if (c == '.')
goto parse_fraction;
if (c == 'e' || c == 'E')
goto parse_exponent;
if (c == 'j' || c == 'J')
goto parse_imaginary;
skip_fp:
/* this point: parsed an octal, decimal, or hexadecimal */
if (c == 'l' || c == 'L')
{
/* we consumed just enough. stop and return a NUMBER */
return TK_NUMBER;
}
/* consumed too much. backup and return a NUMBER */
backup_char(ctx, c);
return TK_NUMBER;
}
/* decimal number */
do {
c = next_char(ctx);
} while (isdigit(c));
if (c == 'l' || c == 'L')
{
/* we consumed just enogh. stop and return a NUMBER */
return TK_NUMBER;
}
if (c == '.')
{
parse_fraction:
do {
c = next_char(ctx);
} while (isdigit(c));
}
if (c == 'e' || c == 'E')
{
parse_exponent:
c = next_char(ctx);
if (c == '+' || c == '-')
c = next_char(ctx);
if (!isdigit(c))
{
backup_char(ctx, c);
return E_BAD_NUMBER;
}
do {
c = next_char(ctx);
} while (isdigit(c));
}
if (c == 'j' || c == 'J')
{
parse_imaginary:
c = next_char(ctx);
}
/* one too far. backup and return a NUMBER */
backup_char(ctx, c);
return TK_NUMBER;
} /* isdigit */
parse_string:
if (c == '\'' || c == '"')
{
int second_quote_pos = ctx->fpos + 1;
int which_quote = c;
int is_triple = 0;
int quote_count = 0;
while (1)
{
c = next_char(ctx);
if (c == '\n')
{
on_next_line(ctx);
if (!is_triple)
return E_UNTERM_STRING;
quote_count = 0;
}
else if (c == SCANNER_EOF)
{
return E_UNTERM_STRING;
}
else if (c == which_quote)
{
++quote_count;
if (ctx->fpos == second_quote_pos)
{
c = next_char(ctx);
if (c == which_quote)
{
is_triple = 1;
quote_count = 0;
continue;
}
/* we just read one past the empty string. back up. */
backup_char(ctx, c);
}
/* this quote may have terminated the string */
if (!is_triple || quote_count == 3)
return TK_STRING;
}
else if (c == '\\')
{
c = next_char(ctx);
if (c == SCANNER_EOF)
return E_UNTERM_STRING;
if (c == '\n')
on_next_line(ctx);
quote_count = 0;
}
else
{
quote_count = 0;
}
}
/* NOTREACHED */
}
/* line continuation */
if (c == '\\')
{
c = next_char(ctx);
if (c != '\n')
return E_BAD_CONTINUATION;
on_next_line(ctx);
goto read_more;
}
/* look for operators */
/* the nesting operators */
if (c == '(' || c == '[' || c == '{')
{
++ctx->nesting_level;
return c;
}
if (c == ')' || c == ']' || c == '}')
{
--ctx->nesting_level;
return c;
}
/* look for up-to-3-char ops */
if (c == '<' || c == '>' || c == '*' || c == '/')
{
c2 = next_char(ctx);
if (c == c2)
{
c2 = next_char(ctx);
if (c2 != '=')
{
/* oops. one too far. */
backup_char(ctx, c2);
}
return TK_OPERATOR;
}
if (c == '<' && c2 == '>')
return TK_OPERATOR;
if (c2 != '=')
{
/* one char too far. */
backup_char(ctx, c2);
}
return TK_OPERATOR;
}
/* look for 2-char ops */
if (c == '=' || c == '!' || c == '+' || c == '-'
|| c == '|' || c == '%' || c == '&' || c == '^')
{
c2 = next_char(ctx);
if (c2 == '=')
return TK_OPERATOR;
/* oops. too far. */
backup_char(ctx, c2);
return TK_OPERATOR;
}
/* ### should all of these return 'c' ? */
if (c == ':' || c == ',' || c == ';' || c == '`')
return c;
/* as a unary operator, this must be a TK_OPERATOR */
if (c == '~')
return TK_OPERATOR;
/* if we have an EOF, then just return it */
if (c == SCANNER_EOF)
return SCANNER_EOF;
/* unknown input */
return E_UNKNOWN_TOKEN;
}
void scanner_identifier(void *opaque_ctx, const char **ident, int *len)
{
scanner_ctx *ctx = opaque_ctx;
ctx->identifier[ctx->idlen] = '\0';
*ident = ctx->identifier;
*len = ctx->idlen;
}
void scanner_token_range(void *opaque_ctx, int *start, int *end)
{
scanner_ctx *ctx = opaque_ctx;
*start = ctx->start;
*end = ctx->fpos;
}
void scanner_token_linecol(void *opaque_ctx,
int *sline, int *scol, int *eline, int *ecol)
{
scanner_ctx *ctx = opaque_ctx;
*sline = ctx->start_line;
*scol = ctx->start_col;
*eline = ctx->lineno;
*ecol = ctx->fpos - ctx->line_pos;
}
void scanner_end(void *ctx)
{
free(ctx);
}

42
elemx/python/scanner.h Normal file
View File

@@ -0,0 +1,42 @@
#ifndef SCANNER_H
#define SCANNER_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* constants and errors returned by the scanner */
enum
{
SCANNER_EOF = -1, /* returned by get_char_t and
scanner_get_token to symbolize EOF */
E_TOO_MANY_INDENTS = -100, /* too many indents */
E_DEDENT_MISMATCH, /* no matching indent */
E_BAD_CONTINUATION, /* character occurred after \ */
E_BAD_NUMBER, /* parse error in a number */
E_UNKNOWN_TOKEN, /* dunno what we found */
E_UNTERM_STRING /* unterminated string constant */
};
typedef int (*get_char_t)(void *user_ctx);
void *scanner_begin(get_char_t getfunc, void *user_ctx);
int scanner_get_token(void *ctx);
void scanner_identifier(void *ctx, const char **ident, int *len);
void scanner_token_range(void *ctx, int *start, int *end);
void scanner_token_linecol(void *ctx,
int *sline, int *scol, int *eline, int *ecol);
void scanner_end(void *ctx);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SCANNER_H */

View File

@@ -1,153 +1,170 @@
"""Module to analyze Python source code; for syntax coloring tools.
Interface:
tags = fontify(pytext, searchfrom, searchto)
The 'pytext' argument is a string containing Python source code.
The (optional) arguments 'searchfrom' and 'searchto' may contain a slice in pytext.
tags = fontify(pytext, searchfrom, searchto)
The PYTEXT argument is a string containing Python source code. The
(optional) arguments SEARCHFROM and SEARCHTO may contain a slice in
PYTEXT.
The returned value is a list of tuples, formatted like this:
[('keyword', 0, 6, None), ('keyword', 11, 17, None), ('comment', 23, 53, None), etc. ]
[('keyword', 0, 6, None),
('keyword', 11, 17, None),
('comment', 23, 53, None),
...
]
The tuple contents are always like this:
(tag, startindex, endindex, sublist)
tag is one of 'keyword', 'string', 'comment' or 'identifier'
sublist is not used, hence always None.
(tag, startindex, endindex, sublist)
TAG is one of 'keyword', 'string', 'comment' or 'identifier'
SUBLIST is not used, hence always None.
"""
# Based on FontText.py by Mitchell S. Chapman,
# which was modified by Zachary Roadhouse,
# then un-Tk'd by Just van Rossum.
# Many thanks for regular expression debugging & authoring are due to:
# Tim (the-incredib-ly y'rs) Peters and Cristian Tismer
# Tim (the-incredib-ly y'rs) Peters and Cristian Tismer
# So, who owns the copyright? ;-) How about this:
# Copyright 1996-1997:
# Mitchell S. Chapman,
# Zachary Roadhouse,
# Tim Peters,
# Just van Rossum
# Mitchell S. Chapman,
# Zachary Roadhouse,
# Tim Peters,
# Just van Rossum
__version__ = "0.3.1"
import string, regex
import string, re
# First a little helper, since I don't like to repeat things. (Tismer speaking)
import string
def replace(where, what, with):
return string.join(string.split(where, what), with)
# This list of keywords is taken from ref/node13.html of the
# Python 1.3 HTML documentation. ("access" is intentionally omitted.)
keywordsList = [
"del", "from", "lambda", "return",
"and", "elif", "global", "not", "try",
"break", "else", "if", "or", "while",
"class", "except", "import", "pass",
"continue", "finally", "in", "print",
"def", "for", "is", "raise"]
# Build up a regular expression which will match anything
# interesting, including multi-line triple-quoted strings.
keywordsList = ["and", "assert", "break", "class", "continue", "def",
"del", "elif", "else", "except", "exec", "finally",
"for", "from", "global", "if", "import", "in", "is",
"lambda", "not", "or", "pass", "print", "raise",
"return", "try", "while",
]
# A regexp for matching Python comments.
commentPat = "#.*"
pat = "q[^\q\n]*\(\\\\[\000-\377][^\q\n]*\)*q"
quotePat = replace(pat, "q", "'") + "\|" + replace(pat, 'q', '"')
# A regexp for matching simple quoted strings.
pat = "q[^q\\n]*(\\[\000-\377][^q\\n]*)*q"
quotePat = string.replace(pat, "q", "'") + "|" + string.replace(pat, 'q', '"')
# Way to go, Tim!
# A regexp for matching multi-line tripled-quoted strings. (Way to go, Tim!)
pat = """
qqq
[^\\q]*
\(
\( \\\\[\000-\377]
\| q
\( \\\\[\000-\377]
\| [^\\q]
\| q
\( \\\\[\000-\377]
\| [^\\q]
\)
\)
\)
[^\\q]*
\)*
qqq
qqq
[^q]*
(
( \\[\000-\377]
| q
( \\[\000-\377]
| [^q]
| q
( \\[\000-\377]
| [^q]
)
)
)
[^q]*
)*
qqq
"""
pat = string.join(string.split(pat), '') # get rid of whitespace
tripleQuotePat = replace(pat, "q", "'") + "\|" + replace(pat, 'q', '"')
pat = string.join(string.split(pat), '') # get rid of whitespace
tripleQuotePat = string.replace(pat, "q", "'") + "|" \
+ string.replace(pat, 'q', '"')
# Build up a regular expression which matches all and only
# Python keywords. This will let us skip the uninteresting
# identifier references.
# nonKeyPat identifies characters which may legally precede
# a keyword pattern.
nonKeyPat = "\(^\|[^a-zA-Z0-9_.\"']\)"
# A regexp which matches all and only Python keywords. This will let
# us skip the uninteresting identifier references.
nonKeyPat = "(^|[^a-zA-Z0-9_.\"'])" # legal keyword-preceding characters
keyPat = nonKeyPat + "(" + string.join(keywordsList, "|") + ")" + nonKeyPat
keyPat = nonKeyPat + "\("
for keyword in keywordsList:
keyPat = keyPat + keyword + "\|"
keyPat = keyPat[:-2] + "\)" + nonKeyPat
# Our final syntax-matching regexp is the concatation of the regexp's we
# constructed above.
syntaxPat = keyPat + \
"|" + commentPat + \
"|" + tripleQuotePat + \
"|" + quotePat
syntaxRE = re.compile(syntaxPat)
matchPat = keyPat + "\|" + commentPat + "\|" + tripleQuotePat + "\|" + quotePat
matchRE = regex.compile(matchPat)
idKeyPat = "[ \t]*[A-Za-z_][A-Za-z_0-9.]*" # Ident w. leading whitespace.
idRE = regex.compile(idKeyPat)
# Finally, we construct a regexp for matching indentifiers (with
# optional leading whitespace).
idKeyPat = "[ \t]*[A-Za-z_][A-Za-z_0-9.]*"
idRE = re.compile(idKeyPat)
def fontify(pytext, searchfrom = 0, searchto = None):
if searchto is None:
searchto = len(pytext)
# Cache a few attributes for quicker reference.
search = matchRE.search
group = matchRE.group
idSearch = idRE.search
idGroup = idRE.group
tags = []
tags_append = tags.append
commentTag = 'comment'
stringTag = 'string'
keywordTag = 'keyword'
identifierTag = 'identifier'
start = 0
end = searchfrom
while 1:
start = search(pytext, end)
if start < 0 or start >= searchto:
break # EXIT LOOP
match = group(0)
end = start + len(match)
c = match[0]
if c not in "#'\"":
# Must have matched a keyword.
if start <> searchfrom:
# there's still a redundant char before and after it, strip!
match = match[1:-1]
start = start + 1
else:
# this is the first keyword in the text.
# Only a space at the end.
match = match[:-1]
end = end - 1
tags_append((keywordTag, start, end, None))
# If this was a defining keyword, look ahead to the
# following identifier.
if match in ["def", "class"]:
start = idSearch(pytext, end)
if start == end:
match = idGroup(0)
end = start + len(match)
tags_append((identifierTag, start, end, None))
elif c == "#":
tags_append((commentTag, start, end, None))
else:
tags_append((stringTag, start, end, None))
return tags
def fontify(pytext, searchfrom=0, searchto=None):
if searchto is None:
searchto = len(pytext)
tags = []
commentTag = 'comment'
stringTag = 'string'
keywordTag = 'keyword'
identifierTag = 'identifier'
start = 0
end = searchfrom
while 1:
# Look for some syntax token we're interested in. If find
# nothing, we're done.
matchobj = syntaxRE.search(pytext, end)
if not matchobj:
break
# If we found something outside our search area, it doesn't
# count (and we're done).
start = matchobj.start()
if start >= searchto:
break
match = matchobj.group(0)
end = start + len(match)
c = match[0]
if c == '#':
# We matched a comment.
tags.append((commentTag, start, end, None))
elif c == '"' or c == '\'':
# We matched a string.
tags.append((stringTag, start, end, None))
else:
# We matched a keyword.
if start != searchfrom:
# there's still a redundant char before and after it, strip!
match = match[1:-1]
start = start + 1
else:
# This is the first keyword in the text.
# Only a space at the end.
match = match[:-1]
end = end - 1
tags.append((keywordTag, start, end, None))
# If this was a defining keyword, look ahead to the
# following identifier.
if match in ["def", "class"]:
matchobj = idRE.search(pytext, end)
if matchobj:
start = matchobj.start()
if start == end and start < searchto:
end = start + len(matchobj.group(0))
tags.append((identifierTag, start, end, None))
return tags
def test(path):
f = open(path)
text = f.read()
f.close()
tags = fontify(text)
for tag, start, end, sublist in tags:
print tag, `text[start:end]`
f = open(path)
text = f.read()
f.close()
tags = fontify(text)
for tag, start, end, sublist in tags:
print tag, `text[start:end]`
if __name__ == "__main__":
import sys
test(sys.argv[0])

View File

@@ -1,21 +1,18 @@
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# accept.py: parse/handle the various Accept headers from the client
#
# -----------------------------------------------------------------------
#
import re
import string
@@ -111,6 +108,23 @@ class _LanguageRange(_AcceptItem):
return None
class _LanguageSelector:
"""Instances select an available language based on the user's request.
Languages found in the user's request are added to this object with the
append() method (they should be instances of _LanguageRange). After the
languages have been added, then the caller can use select_from() to
determine which user-request language(s) best matches the set of
available languages.
Strictly speaking, this class is pretty close for more than just
language matching. It has been implemented to enable q-value based
matching between requests and availability. Some minor tweaks may be
necessary, but simply using a new 'item_class' should be sufficient
to allow the _parse() function to construct a selector which holds
the appropriate item implementations (e.g. _LanguageRange is the
concrete _AcceptItem class that handles matching of language tags).
"""
item_class = _LanguageRange
def __init__(self):
@@ -120,7 +134,8 @@ class _LanguageSelector:
"""Select one of the available choices based on the request.
Note: if there isn't a match, then the first available choice is
considered the default.
considered the default. Also, if a number of matches are equally
relevant, then the first-requested will be used.
avail is a list of language-tag strings of available languages
"""
@@ -140,7 +155,8 @@ class _LanguageSelector:
qvalue = want.matches(tag)
#print 'have %s. want %s. qvalue=%s' % (tag, want.name, qvalue)
if qvalue is not None and len(want.name) > longest:
# we have a match and it is longer than any we may have had
# we have a match and it is longer than any we may have had.
# the final qvalue should be from this tag.
final = qvalue
longest = len(want.name)
@@ -148,22 +164,48 @@ class _LanguageSelector:
if final:
matches.append((final, tag))
# if we have any matches, then look at the highest qvalue
if matches:
matches.sort()
qvalue, tag = matches[-1]
# if there are no matches, then return the default language tag
if not matches:
return avail[0]
if len(matches) >= 2 and matches[-2][0] == qvalue:
#print "non-deterministic choice", avail
pass
# get the highest qvalue and its corresponding tag
matches.sort()
qvalue, tag = matches[-1]
# if the qvalue is non-zero, then we have a valid match
if qvalue:
return tag
# the qvalue is zero (non-match). drop thru to return the default
# if the qvalue is zero, then we have no valid matches. return the
# default language tag.
if not qvalue:
return avail[0]
# return the default language tag
return avail[0]
# if there are two or more matches, and the second-highest has a
# qvalue equal to the best, then we have multiple "best" options.
# select the one that occurs first in self.requested
if len(matches) >= 2 and matches[-2][0] == qvalue:
# remove non-best matches
while matches[0][0] != qvalue:
del matches[0]
#print "non-deterministic choice", matches
# sequence through self.requested, in order
for want in self.requested:
# try to find this one in our best matches
for qvalue, tag in matches:
if want.matches(tag):
# this requested item is one of the "best" options
### note: this request item could match *other* "best" options,
### so returning *this* one is rather non-deterministic.
### theoretically, we could go further here, and do another
### search based on the ordering in 'avail'. however, note
### that this generally means that we are picking from multiple
### *SUB* languages, so I'm all right with the non-determinism
### at this point. stupid client should send a qvalue if they
### want to refine.
return tag
# NOTREACHED
# return the best match
return tag
def append(self, item):
self.requested.append(item)
@@ -177,6 +219,10 @@ def _test():
assert s.select_from(['en', 'de']) == 'en'
assert s.select_from(['de', 'en']) == 'en'
# Netscape 4.x and early version of Mozilla may not send a q value
s = language('en, ja')
assert s.select_from(['en', 'ja']) == 'en'
s = language('fr, de;q=0.9, en-gb;q=0.7, en;q=0.6, en-gb-foo;q=0.8')
assert s.select_from(['en']) == 'en'
assert s.select_from(['en-gb-foo']) == 'en-gb-foo'

View File

@@ -1,199 +0,0 @@
#! /usr/bin/env python
# This file was automatically generated! DO NOT EDIT!
# Howto regenerate: see ../tools/bin2inline.py
# $Id$
# You have been warned. But if you want to edit, go ahead using your
# favorite editor :-)
## vim:ts=4:et:nowrap
# [Emacs: -*- python -*-]
_ap_icons = {
"/icons/apache_pb.gif" :
'GIF89a\003\001 \000\367\000\000\377\377\377'
'\316\316\316\245\245\245\204\204\204ssskkkZ'
'ZZ!\030\030\377B\030\3771\000\275R\020\336\255'
'\204\357\234B\377\204\000\377\316\030\377\316\000\316\316\306'
'\275\275\3061\000\377c\000\377\234\000\377\357\000\377\347'
'J\357\336{\336\326\245\316\377\000\234\357J\214\377\000'
'c\347\204\234\357Rc\377\000\030\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000!\371\004'
'\001\000\000\001\000,\000\000\000\000\003\001 \000G\010'
'\377\000\003\010\034H\260\240\301\203\010\023*\\\310\260'
'\241\303\207\020#J\234H\261\242E\206\021\016\034\030'
'0\260\300\200\001\002\002l0\260!\303\006\017(Q'
'&X\331\300A\204\201\007\376\3753\020\363_\004\231'
'\007h\376;\020 \246\001\0032\011\370\024\2603\302'
'\200\231=e\006%03\002P\002\001p\352\374W'
'\020\350L\253\004\254\336\264y\261\253\327\257`\303\026'
'|Iv\203\331\012\033*P\2400a\302?\011J'
'\343\276\225@w\002\333\265\0252P\3100!\203I'
'\277\005P\376;\231\022\001\002\001._\212]\314\270'
'\261\343\307b#Dh0\000A\203\225\011R\012N'
'\371\317\203\001\017f\375\206\366+\332d^\275\245\323'
"f\030\360\240u\353\006\017\032\314\374'\200\243\300\013"
"u'Hh\333\226\356\356\335\272%\\0xa\355"
'\332\341\022/\220^\316\274y\006\015\0065{X\330'
'A3\206\202\0300\257d\270@{\202\203\014\032\210'
'\377o\000\371\253\200\363\347\313/\214\220\236 \373\220'
'\352\343\313\237\357\360\345y\271o\347\266]\233!o'
'\337\275\031L\225\222\001\010(PSQ\002\035\305S'
'T\264\011$\300\201P\305\264\240@L)\025\222S'
'rU\025\327F\016\312\244\030} \2068_\004\010'
'\030\260Rg\240\225d\332r\024T`\327ZnY'
'\205\237\\p\375\366\033[\025\2505\300^\033\000\230'
'\300\000-\271\324P\004\272\265\025\200\005\277M\360\341'
'A\305\031G\301BN"\207\335r\303Y\260\334u'
'\011I\267\220\006\326a\347\035w_\032\024\336x"'
'\226i\346\231h\246\251\346\232l\266\351\246A\017.'
'9\320y\005(\346\200\000\015\340\331PM\002X\305'
'\221Q\006\014`\337O/\031\000\225S\006\220E\200'
'\240\024\032 \200S\360\011@\000|\002E@@V'
'2i\370\317\000\216\006\320g\242\236\032\372\346\250e'
'\032U\023P \355\367_\217*J\247RM\037n'
'\377\005U\205\222)\365\023N\001\034E\033zIM'
'\010\324\001\350=*S\242Vi\352\351\260\001\310('
"'\251\314\252\367\350O\004\024\020\000_\301\3218\227"
'\001\022\030p\227\213\250M0\022a\011\240\310\222x'
'\206!\260\254|[Q\332\354\272"\032\225\222Y\241'
'\251\325\237\213l\3015c~\276\365\266\037\275x\241'
'6\322_&\201\326\300\271\023\345;\201\005\0155\351'
'\344\302\014\033\207%B\0324\367pB\030\270j\261'
'\253\034\030\224\035f\035\200\251\035x\343\205,\362\310'
'\013<\206\247\211\232\015\206\222\212\244\261\314\234qj'
'\3355\301On\331;#P\015\030\020\333k\2559'
" \244\306ENP\020\222ENL\220\302\015'\275"
'\226\321\312\221&\345m\313e|\220\226\025m\354\335'
'\325Xc\006\362\310"\227<\252d\001HfT\003'
'\033!p\000\002)\036\340\301\000\033\014\000\332\333\360'
'\232\205\322\001q\033\345\300\000w\252{d\276F\037'
'\377\204Ap\022 <\020\322O7\304\\\337~\037'
'>\020\007\0277\216R\307^~\274Pw\222\0274'
'&\327\230\213\007\001\273\234w\356\371\347\240\207.\372'
'\350\244\227\3169\301a\203M\321\201\310\212X,A'
'\257\233.;D\246\352-)\243hk\226\200e\003'
'#T\323\261\377L*\227\260\233\022e\323\257\311*'
'\005lRV\361t\340\001/U\030\227\246\312oe'
'\000\363\263go\320\000\032\011\012@\001\005@\205Z'
'\005\004\2304RJ,\355~\030\353\300\032?\253L'
'\222\342$!\374\025j\224)\237\317\356d?\2602'
'q\024\273@\257\363\311V|\242\275\002\036DF\267'
'\252\213\223\374\223\232\317x@)\0360\314\300jB'
'A\000\302OW\327\263\236\244\234\267\2239\015\353S'
'I\311\020\354\360\023\022\343]\317\200(\014[\001\200'
'b\000\217\330L)\276\221\000\214\214\343\257\275\020\000'
'\\\036X\211\002,\203\030\325%\204=\014yTW'
'\377X\230B\024\212\215=/\351Vo^\010\303|'
'\311\320.}\351V\3344\343\300\0346\240\\z\203'
'\314\005rR\304.V*l\271\353\221_\3622\303'
'\266\334k.7z"\031\333\242\032\322\334\020\\\231'
')\014\352(R\227\302%Dix\274\000\342\012r'
'\001\013\370Qp\015\201\000\007\030\347\270\224p\000q'
'\030\350\200";\3405\205Pn%\215$\010\003&'
'I\311JZ\262\222\221\264\310d\334\366.\227\235\246'
'E0b"~jd\243\375\340H-1\243@\001'
'\344V\030\004\260\315\\\022\311\315o\000\231\020\244Q'
'\340\002\270\314\245.\011\227\020\347\370e\217\003\221\316'
' \207IL\016h\240:)\331\034A\254\346\001\310'
'92L\226\013\331\002\246I\315jZ\2231w\273'
'L\034W\026\232\264\250\34649B\245]\012\000\027'
'\031\235Q&\300\341\015o\332&\236\330\300\346g\010'
'!\022p\006B\264\335\240\316\226\273\314g\2244F'
'\363\245\301])K\232Y\010\006\016\211\310\254\031\364'
"j[\023\317%'\231I\365\214\315D+\331\014J"
'H\302\315n.\3474\375\361\313^\310\330\242\276\304'
'\314\0003\273U\\~b\000\361\300S \177K\222'
':y\223$\304\331\022\217\306\321#\037}IS\251'
'\025\204j\011\341\200"\017\2511\357\024\223\003\326|'
'\244\326\304$\315\240.@\231i\222Lm\\\351\235'
'\034\272\252G\025e\245\001\376B\030\222\250\250\000\355'
'\204\215k|\366!\334\000G\217\030\010k\000\302J'
'\326\013,\261p\274\214H\323\374\002V\262\2725\254'
'\034X\016t\010"\314\237\016\363\230\232A*J\241'
'\231\020\241~\207\250\343\241\244Q\257\351E\332\351r'
'\216\3569\354@0\240K`\372M\227\020\031\3500'
"'&Y\273ZV\257\003\201@5\035+\020\315V"
'\363 \203\015-5\013K\332\322\232\366\264\250=\010'
'@\002\004\004\000;',
"/icons/small/back.gif" :
'GIF89a\020\000\020\000\242\377\000!!!'
'111ZZZ\204\204\204\214\214\214\300\300\300\000'
'\000\000\000\000\000!\371\004\001\000\000\005\000,\000\000'
'\000\000\020\000\020\000\000\003FX\272\334\015\300I`'
'L\224\213V\213\213\320\025 t\304f\020]Qn'
'(i\266\303\240\310\312Z\215D,\010\255\022\230\236'
'\20000Z\010L\203\241\320a"*\035 \321\260'
'\267\260\235\204E\307q3\310J\010`p#\001\000'
';',
"/icons/small/dir.gif" :
'GIF89a\020\000\020\000\242\377\000\377\336\255'
'\377\334\256\300\300\300\270\240}WK;+%\035\000'
'\000\000\000\000\000!\371\004\001\000\000\002\000,\000\000'
'\000\000\020\000\020\000\000\003I(b\246\376\316\2241'
'\230\262\320\2002\253\031\001v\001$GQA\025\221'
'\254y6#\333v\360"\337_\255\335dE\350\274'
'\236\341\267\012\372t\204\001\357\370`$e\314\314P'
'\0118\026 \227\251\365\212]\014\277\234n\204\021\026'
'$\000\000;',
"/icons/small/text.gif" :
'GIF89a\020\000\020\000\242\377\000\377\377\377'
'999kkk\214\214\214\300\300\300\316\316\316\347'
'\347\347\000\000\000!\371\004\001\000\000\004\000,\000\000'
'\000\000\020\000\020\000\000\003EH\272\334\276\343\025@'
"k1\261\315J'\326\\W\024D\246LA\232\002"
'j\300xFlP\212\360\262me\330\013,\307\024'
'\336\011\327Z\011\011\276\337\354\210*\032oJ\031\200'
'I,No!\316\261$\350z\275\256E\002\000;',
}
def serve_icon(pathname, fp):
if _ap_icons.has_key(pathname):
fp.write(_ap_icons[pathname])
else:
raise OSError # icon not found

View File

@@ -1,16 +1,14 @@
#!/usr/local/bin/python
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 2000 Curt Hagenlocher <curt@hagenlocher.org>
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
@@ -19,10 +17,6 @@
#
# -----------------------------------------------------------------------
#
# This software is being maintained as part of the ViewCVS project.
# Information is available at:
# http://viewcvs.sourceforge.net/
#
# This file is based on the cvsblame.pl portion of the Bonsai CVS tool,
# developed by Steve Lamm for Netscape Communications Corporation. More
# information about Bonsai can be found at
@@ -31,439 +25,84 @@
# cvsblame.pl, in turn, was based on Scott Furman's cvsblame script
#
# -----------------------------------------------------------------------
#
import string
import sys
import os
import re
import time
import math
import cgi
import rcsparse
class CVSParser(rcsparse.Sink):
# Precompiled regular expressions
trunk_rev = re.compile('^[0-9]+\\.[0-9]+$')
last_branch = re.compile('(.*)\\.[0-9]+')
is_branch = re.compile('(.*)\\.0\\.([0-9]+)')
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
SECONDS_PER_DAY = 86400
def __init__(self):
self.Reset()
def Reset(self):
self.last_revision = {}
self.prev_revision = {}
self.revision_date = {}
self.revision_author = {}
self.revision_branches = {}
self.next_delta = {}
self.prev_delta = {}
self.tag_revision = {}
self.revision_symbolic_name = {}
self.timestamp = {}
self.revision_ctime = {}
self.revision_age = {}
self.revision_log = {}
self.revision_deltatext = {}
self.revision_map = []
self.lines_added = {}
self.lines_removed = {}
# Map a tag to a numerical revision number. The tag can be a symbolic
# branch tag, a symbolic revision tag, or an ordinary numerical
# revision number.
def map_tag_to_revision(self, tag_or_revision):
try:
revision = self.tag_revision[tag_or_revision]
match = self.is_branch.match(revision)
if match:
branch = match.group(1) + '.' + match.group(2)
if self.last_revision.get(branch):
return self.last_revision[branch]
else:
return match.group(1)
else:
return revision
except:
return ''
# Construct an ordered list of ancestor revisions to the given
# revision, starting with the immediate ancestor and going back
# to the primordial revision (1.1).
#
# Note: The generated path does not traverse the tree the same way
# that the individual revision deltas do. In particular,
# the path traverses the tree "backwards" on branches.
def ancestor_revisions(self, revision):
ancestors = []
revision = self.prev_revision.get(revision)
while revision:
ancestors.append(revision)
revision = self.prev_revision.get(revision)
return ancestors
# Split deltatext specified by rev to each line.
def deltatext_split(self, rev):
lines = string.split(self.revision_deltatext[rev], '\n')
if lines[-1] == '':
del lines[-1]
return lines
# Extract the given revision from the digested RCS file.
# (Essentially the equivalent of cvs up -rXXX)
def extract_revision(self, revision):
path = []
add_lines_remaining = 0
start_line = 0
count = 0
while revision:
path.append(revision)
revision = self.prev_delta.get(revision)
path.reverse()
path = path[1:] # Get rid of head revision
text = self.deltatext_split(self.head_revision)
# Iterate, applying deltas to previous revision
for revision in path:
adjust = 0
diffs = self.deltatext_split(revision)
self.lines_added[revision] = 0
self.lines_removed[revision] = 0
lines_added_now = 0
lines_removed_now = 0
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if add_lines_remaining > 0:
# Insertion lines from a prior "a" command
text.insert(start_line + adjust, command)
add_lines_remaining = add_lines_remaining - 1
adjust = adjust + 1
elif dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
begin = start_line + adjust - 1
del text[begin:begin + count]
adjust = adjust - count
lines_removed_now = lines_removed_now + count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
add_lines_remaining = count
lines_added_now = lines_added_now + count
else:
raise RuntimeError, 'Error parsing diff commands'
self.lines_added[revision] = self.lines_added[revision] + lines_added_now
self.lines_removed[revision] = self.lines_removed[revision] + lines_removed_now
return text
def set_head_revision(self, revision):
self.head_revision = revision
def set_principal_branch(self, branch_name):
self.principal_branch = branch_name
def define_tag(self, name, revision):
# Create an associate array that maps from tag name to
# revision number and vice-versa.
self.tag_revision[name] = revision
### actually, this is a bit bogus... a rev can have multiple names
self.revision_symbolic_name[revision] = name
def set_comment(self, comment):
self.file_description = comment
def set_description(self, description):
self.rcs_file_description = description
# Construct dicts that represent the topology of the RCS tree
# and other arrays that contain info about individual revisions.
#
# The following dicts are created, keyed by revision number:
# self.revision_date -- e.g. "96.02.23.00.21.52"
# self.timestamp -- seconds since 12:00 AM, Jan 1, 1970 GMT
# self.revision_author -- e.g. "tom"
# self.revision_branches -- descendant branch revisions, separated by spaces,
# e.g. "1.21.4.1 1.21.2.6.1"
# self.prev_revision -- revision number of previous *ancestor* in RCS tree.
# Traversal of this array occurs in the direction
# of the primordial (1.1) revision.
# self.prev_delta -- revision number of previous revision which forms
# the basis for the edit commands in this revision.
# This causes the tree to be traversed towards the
# trunk when on a branch, and towards the latest trunk
# revision when on the trunk.
# self.next_delta -- revision number of next "delta". Inverts prev_delta.
#
# Also creates self.last_revision, keyed by a branch revision number, which
# indicates the latest revision on a given branch,
# e.g. self.last_revision{"1.2.8"} == 1.2.8.5
def define_revision(self, revision, timestamp, author, state,
branches, next):
self.tag_revision[revision] = revision
branch = self.last_branch.match(revision).group(1)
self.last_revision[branch] = revision
#self.revision_date[revision] = date
self.timestamp[revision] = timestamp
# Pretty print the date string
ltime = time.localtime(self.timestamp[revision])
formatted_date = time.strftime("%d %b %Y %H:%M", ltime)
self.revision_ctime[revision] = formatted_date
# Save age
self.revision_age[revision] = ((time.time() - self.timestamp[revision])
/ self.SECONDS_PER_DAY)
# save author
self.revision_author[revision] = author
# ignore the state
# process the branch information
branch_text = ''
for branch in branches:
self.prev_revision[branch] = revision
self.next_delta[revision] = branch
self.prev_delta[branch] = revision
branch_text = branch_text + branch + ''
self.revision_branches[revision] = branch_text
# process the "next revision" information
if next:
self.next_delta[revision] = next
self.prev_delta[next] = revision
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
self.prev_revision[revision] = next
else:
self.prev_revision[next] = revision
# Construct associative arrays containing info about individual revisions.
#
# The following associative arrays are created, keyed by revision number:
# revision_log -- log message
# revision_deltatext -- Either the complete text of the revision,
# in the case of the head revision, or the
# encoded delta between this revision and another.
# The delta is either with respect to the successor
# revision if this revision is on the trunk or
# relative to its immediate predecessor if this
# revision is on a branch.
def set_revision_info(self, revision, log, text):
self.revision_log[revision] = log
self.revision_deltatext[revision] = text
def parse_cvs_file(self, rcs_pathname, opt_rev = None, opt_m_timestamp = None):
# Args in: opt_rev - requested revision
# opt_m - time since modified
# Args out: revision_map
# timestamp
# revision_deltatext
# CheckHidden(rcs_pathname);
try:
rcsfile = open(rcs_pathname, 'r')
except:
raise RuntimeError, ('error: %s appeared to be under CVS control, ' +
'but the RCS file is inaccessible.') % rcs_pathname
rcsparse.Parser().parse(rcsfile, self)
rcsfile.close()
if opt_rev in [None, '', 'HEAD']:
# Explicitly specified topmost revision in tree
revision = self.head_revision
else:
# Symbolic tag or specific revision number specified.
revision = self.map_tag_to_revision(opt_rev)
if revision == '':
raise RuntimeError, 'error: -r: No such revision: ' + opt_rev
# The primordial revision is not always 1.1! Go find it.
primordial = revision
while self.prev_revision.get(primordial):
primordial = self.prev_revision[primordial]
# Don't display file at all, if -m option is specified and no
# changes have been made in the specified file.
if opt_m_timestamp and self.timestamp[revision] < opt_m_timestamp:
return ''
# Figure out how many lines were in the primordial, i.e. version 1.1,
# check-in by moving backward in time from the head revision to the
# first revision.
line_count = 0
if self.revision_deltatext.get(self.head_revision):
tmp_array = self.deltatext_split(self.head_revision)
line_count = len(tmp_array)
skip = 0
rev = self.prev_revision.get(self.head_revision)
while rev:
diffs = self.deltatext_split(rev)
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if skip > 0:
# Skip insertion lines from a prior "a" command
skip = skip - 1
elif dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
line_count = line_count - count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
skip = count;
line_count = line_count + count
else:
raise RuntimeError, 'error: illegal RCS file'
rev = self.prev_revision.get(rev)
# Now, play the delta edit commands *backwards* from the primordial
# revision forward, but rather than applying the deltas to the text of
# each revision, apply the changes to an array of revision numbers.
# This creates a "revision map" -- an array where each element
# represents a line of text in the given revision but contains only
# the revision number in which the line was introduced rather than
# the line text itself.
#
# Note: These are backward deltas for revisions on the trunk and
# forward deltas for branch revisions.
# Create initial revision map for primordial version.
self.revision_map = [primordial] * line_count
ancestors = [revision, ] + self.ancestor_revisions(revision)
ancestors = ancestors[:-1] # Remove "1.1"
last_revision = primordial
ancestors.reverse()
for revision in ancestors:
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
diffs = self.deltatext_split(last_revision)
# Revisions on the trunk specify deltas that transform a
# revision into an earlier revision, so invert the translation
# of the 'diff' commands.
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line - 1] +
temp + self.revision_map[start_line - 1:])
elif amatch:
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
del self.revision_map[start_line:start_line + count]
skip = count
else:
raise RuntimeError, 'Error parsing diff commands'
else:
# Revisions on a branch are arranged backwards from those on
# the trunk. They specify deltas that transform a revision
# into a later revision.
adjust = 0
diffs = self.deltatext_split(revision)
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
del self.revision_map[start_line + adjust - 1:start_line + adjust - 1 + count]
adjust = adjust - count
elif amatch:
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
skip = count
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line + adjust] +
temp + self.revision_map[start_line + adjust:])
adjust = adjust + skip
else:
raise RuntimeError, 'Error parsing diff commands'
last_revision = revision
return revision
import vclib
re_includes = re.compile('\\#(\\s*)include(\\s*)"(.*?)"')
re_filename = re.compile('(.*[\\\\/])?(.+)')
def link_includes(text, root, rcs_path, sticky = None):
def link_includes(text, repos, path_parts, include_url):
match = re_includes.match(text)
if match:
incfile = match.group(3)
for rel_path in ('', 'Attic', '..'):
trial_root = os.path.join(rcs_path, rel_path)
file = os.path.join(root, trial_root)
file = os.path.normpath(os.path.join(file, incfile + ',v'))
if os.access(file, os.F_OK):
url = os.path.join(rel_path, incfile)
if sticky:
url = url + '?' + sticky
return '#%sinclude%s"<a href="%s">%s</a>"' % \
(match.group(1), match.group(2), url, incfile)
include_path_parts = path_parts[:-1]
for part in filter(None, string.split(incfile, '/')):
if part == "..":
if not include_path_parts:
# nothing left to pop; don't bother marking up this include.
return text
include_path_parts.pop()
elif part and part != ".":
include_path_parts.append(part)
include_path = None
try:
if repos.itemtype(include_path_parts, None) == vclib.FILE:
include_path = string.join(include_path_parts, '/')
except vclib.ItemNotFound:
pass
if include_path:
return '#%sinclude%s<a href="%s">"%s"</a>' % \
(match.group(1), match.group(2),
string.replace(include_url, '/WHERE/', include_path), incfile)
return text
def make_html(root, rcs_path, opt_rev = None, sticky = None):
filename = os.path.join(root, rcs_path)
parser = CVSParser()
revision = parser.parse_cvs_file(filename, opt_rev)
count = len(parser.revision_map)
text = parser.extract_revision(revision)
if len(text) != count:
raise RuntimeError, 'Internal consistency error'
match = re_filename.match(rcs_path)
if not match:
raise RuntimeError, 'Unable to parse filename'
file_head = match.group(1)
file_tail = match.group(2)
class HTMLBlameSource:
"""Wrapper around a the object by the vclib.annotate() which does
HTML escaping, diff URL generation, and #include linking."""
def __init__(self, repos, path_parts, diff_url, include_url, opt_rev=None):
self.repos = repos
self.path_parts = path_parts
self.diff_url = diff_url
self.include_url = include_url
self.annotation, self.revision = self.repos.annotate(path_parts, opt_rev)
open_table_tag = '<table border=0 cellpadding=0 cellspacing=0 width="100%">'
startOfRow = '<tr><td colspan=3%s><pre>'
endOfRow = '</td></tr>'
def __getitem__(self, idx):
item = self.annotation.__getitem__(idx)
diff_url = None
if item.prev_rev:
diff_url = '%sr1=%s&amp;r2=%s' % (self.diff_url, item.prev_rev, item.rev)
thisline = link_includes(cgi.escape(item.text), self.repos,
self.path_parts, self.include_url)
return _item(text=thisline, line_number=item.line_number,
rev=item.rev, prev_rev=item.prev_rev,
diff_url=diff_url, date=item.date, author=item.author)
print open_table_tag + (startOfRow % '')
def blame(repos, path_parts, diff_url, include_url, opt_rev=None):
source = HTMLBlameSource(repos, path_parts, diff_url, include_url, opt_rev)
return source, source.revision
class _item:
def __init__(self, **kw):
vars(self).update(kw)
def make_html(root, rcs_path):
import vclib.ccvs.blame
bs = vclib.ccvs.blame.BlameSource(os.path.join(root, rcs_path))
count = bs.num_lines
if count == 0:
count = 1
@@ -471,80 +110,44 @@ def make_html(root, rcs_path, opt_rev = None, sticky = None):
revision_width = 3
author_width = 5
line = 0
usedlog = {}
usedlog[revision] = 1
old_revision = 0
row_color = ''
lines_in_table = 0
inMark = 0
rev_count = 0
for revision in parser.revision_map:
thisline = text[line]
line = line + 1
usedlog[revision] = 1
line_in_table = lines_in_table + 1
open_table_tag = '<table cellpadding="0" cellspacing="0">'
startOfRow = '<tr><td colspan="3"%s><pre>'
endOfRow = '</td></tr>'
# Escape HTML meta-characters
thisline = cgi.escape(thisline)
# Add a link to traverse to included files
if 1: # opt_includes
thisline = link_includes(thisline, root, file_head, sticky)
print open_table_tag + (startOfRow % '')
for line_data in bs:
revision = line_data.rev
thisline = line_data.text
line = line_data.line_number
author = line_data.author
prev_rev = line_data.prev_rev
output = ''
# Highlight lines
#mark_cmd;
#if (defined($mark_cmd = $mark_line{$line}) and mark_cmd != 'end':
# output = output + endOfRow + '<tr><td bgcolor=LIGHTGREEN width="100%"><pre>'
# inMark = 1
if old_revision != revision and line != 1:
if row_color == '':
row_color = ' bgcolor="#e7e7e7"'
row_color = ' style="background-color:#e7e7e7"'
else:
row_color = ''
if not inMark:
if lines_in_table > 100:
output = output + endOfRow + '</table>' + open_table_tag + (startOfRow % row_color)
lines_in_table = 0
else:
output = output + endOfRow + (startOfRow % row_color)
output = output + endOfRow + (startOfRow % row_color)
elif lines_in_table > 200 and not inMark:
output = output + endOfRow + '</table>' + open_table_tag + (startOfRow % row_color)
lines_in_table = 0
output = output + "<a name=%d></a>" % (line, )
if 1: # opt_line_nums
output = output + ('%%%dd' % (line_num_width, )) % (line, )
output = output + '<a name="%d">%*d</a>' % (line, line_num_width, line)
if old_revision != revision or rev_count > 20:
revision_width = max(revision_width, len(revision))
if parser.prev_revision.get(revision):
fname = file_tail[:-2] # strip the ",v"
url = '%s.diff?r1=%s&amp;r2=%s' % \
(fname, parser.prev_revision[revision], revision)
if sticky:
url = url + '&' + sticky
output = output + ' <a href="%s"' % (url, )
if 0: # use_layers
output = output + " onmouseover='return log(event,\"%s\",\"%s\");'" % (
parser.prev_revision[revision], revision)
output = output + ">"
else:
output = output + " "
parser.prev_revision[revision] = ''
author = parser.revision_author[revision]
# $author =~ s/%.*$//;
output = output + ' '
author_width = max(author_width, len(author))
output = output + ('%%-%ds ' % (author_width, )) % (author, )
output = output + ('%-*s ' % (author_width, author))
output = output + revision
if parser.prev_revision.get(revision):
if prev_rev:
output = output + '</a>'
output = output + (' ' * (revision_width - len(revision) + 1))
@@ -558,15 +161,16 @@ def make_html(root, rcs_path, opt_rev = None, sticky = None):
# Close the highlighted section
#if (defined $mark_cmd and mark_cmd != 'begin'):
# chop($output)
# output = output + endOfRow + (startOfRow % row_color)
# inMark = 0
# chop($output)
# output = output + endOfRow + (startOfRow % row_color)
# inMark = 0
print output
print endOfRow + '</table>'
def main():
import sys
if len(sys.argv) != 3:
print 'USAGE: %s cvsroot rcs-file' % sys.argv[0]
sys.exit(1)

View File

@@ -1,28 +1,28 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# compat.py: compatibility functions for operation across Python 1.5.x
# compat.py: compatibility functions for operation across Python 1.5.x to 2.2.x
#
# -----------------------------------------------------------------------
#
import urllib
import string
import time
import calendar
import re
import os
import rfc822
import tempfile
import errno
#
# urllib.urlencode() is new to Python 1.5.2
@@ -46,14 +46,17 @@ except AttributeError:
if hasattr(time, 'strptime'):
def cvs_strptime(timestr):
'Parse a CVS-style date/time value.'
return time.strptime(timestr, '%Y/%m/%d %H:%M:%S')
return time.strptime(timestr, '%Y/%m/%d %H:%M:%S')[:-1] + (0,)
else:
_re_rev_date = re.compile('([0-9]{4})/([0-9][0-9])/([0-9][0-9]) '
'([0-9][0-9]):([0-9][0-9]):([0-9][0-9])')
def cvs_strptime(timestr):
'Parse a CVS-style date/time value.'
matches = _re_rev_date.match(timestr).groups()
return tuple(map(int, matches)) + (0, 1, 0)
match = _re_rev_date.match(timestr)
if match:
return tuple(map(int, match.groups())) + (0, 1, 0)
else:
raise ValueError('date is not in cvs format')
#
# os.makedirs() is new to Python 1.5.2
@@ -66,3 +69,98 @@ except AttributeError:
if head and tail and not os.path.exists(head):
makedirs(head, mode)
os.mkdir(path, mode)
#
# rfc822.formatdate() is new to Python 1.6
#
try:
formatdate = rfc822.formatdate
except AttributeError:
def formatdate(timeval):
if timeval is None:
timeval = time.time()
timeval = time.gmtime(timeval)
return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (
["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][timeval[6]],
timeval[2],
["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][timeval[1]-1],
timeval[0], timeval[3], timeval[4], timeval[5])
#
# calendar.timegm() is new to Python 2.x and
# calendar.leapdays() was wrong in Python 1.5.2
#
try:
timegm = calendar.timegm
except AttributeError:
def leapdays(year1, year2):
"""Return number of leap years in range [year1, year2).
Assume year1 <= year2."""
year1 = year1 - 1
year2 = year2 - 1
return (year2/4 - year1/4) - (year2/100 -
year1/100) + (year2/400 - year1/400)
EPOCH = 1970
def timegm(tuple):
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
year, month, day, hour, minute, second = tuple[:6]
# assert year >= EPOCH
# assert 1 <= month <= 12
days = 365*(year-EPOCH) + leapdays(EPOCH, year)
for i in range(1, month):
days = days + calendar.mdays[i]
if month > 2 and calendar.isleap(year):
days = days + 1
days = days + day - 1
hours = days*24 + hour
minutes = hours*60 + minute
seconds = minutes*60 + second
return seconds
#
# tempfile.mkdtemp() is new to Python 2.3
#
try:
mkdtemp = tempfile.mkdtemp
except AttributeError:
def mkdtemp():
for i in range(10):
dir = tempfile.mktemp()
try:
os.mkdir(dir, 0700)
return dir
except OSError, e:
if e.errno == errno.EEXIST:
continue # try again
raise
raise IOError, (errno.EEXIST, "No usable temporary directory name found")
#
# the following stuff is *ONLY* needed for standalone.py.
# For that reason I've encapsulated it into a function.
#
def for_standalone():
import SocketServer
if not hasattr(SocketServer.TCPServer, "close_request"):
#
# method close_request() was missing until Python 2.1
#
class TCPServer(SocketServer.TCPServer):
def process_request(self, request, client_address):
"""Call finish_request.
Overridden by ForkingMixIn and ThreadingMixIn.
"""
self.finish_request(request, client_address)
self.close_request(request)
def close_request(self, request):
"""Called to clean up an individual request."""
request.close()
SocketServer.TCPServer = TCPServer

786
lib/compat_difflib.py Executable file
View File

@@ -0,0 +1,786 @@
#! /usr/bin/env python
# Backported to Python 1.5.2 for the ViewCVS project by pf@artcom-gmbh.de
# 24-Dec-2001, original version "stolen" from Python-2.1.1
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
word is a sequence for which close matches are desired (typically a
string).
possibilities is a list of sequences against which to match word
(typically a list of strings).
Optional arg n (default 3) is the maximum number of close matches to
return. n must be > 0.
Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities
that don't score at least that similar to word are ignored.
The best (no more than n) matches among the possibilities are returned
in a list, sorted by similarity score, most similar first.
>>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
['apple', 'ape']
>>> import keyword
>>> get_close_matches("wheel", keyword.kwlist)
['while']
>>> get_close_matches("apple", keyword.kwlist)
[]
>>> get_close_matches("accept", keyword.kwlist)
['except']
Class SequenceMatcher
SequenceMatcher is a flexible class for comparing pairs of sequences of any
type, so long as the sequence elements are hashable. The basic algorithm
predates, and is a little fancier than, an algorithm published in the late
1980's by Ratcliff and Obershelp under the hyperbolic name "gestalt pattern
matching". The basic idea is to find the longest contiguous matching
subsequence that contains no "junk" elements (R-O doesn't address junk).
The same idea is then applied recursively to the pieces of the sequences to
the left and to the right of the matching subsequence. This does not yield
minimal edit sequences, but does tend to yield matches that "look right"
to people.
Example, comparing two strings, and considering blanks to be "junk":
>>> s = SequenceMatcher(lambda x: x == " ",
... "private Thread currentThread;",
... "private volatile Thread currentThread;")
>>>
.ratio() returns a float in [0, 1], measuring the "similarity" of the
sequences. As a rule of thumb, a .ratio() value over 0.6 means the
sequences are close matches:
>>> print round(s.ratio(), 3)
0.866
>>>
If you're only interested in where the sequences match,
.get_matching_blocks() is handy:
>>> for block in s.get_matching_blocks():
... print "a[%d] and b[%d] match for %d elements" % block
a[0] and b[0] match for 8 elements
a[8] and b[17] match for 6 elements
a[14] and b[23] match for 15 elements
a[29] and b[38] match for 0 elements
Note that the last tuple returned by .get_matching_blocks() is always a
dummy, (len(a), len(b), 0), and this is the only case in which the last
tuple element (number of elements matched) is 0.
If you want to know how to change the first sequence into the second, use
.get_opcodes():
>>> for opcode in s.get_opcodes():
... print "%6s a[%d:%d] b[%d:%d]" % opcode
equal a[0:8] b[0:8]
insert a[8:8] b[8:17]
equal a[8:14] b[17:23]
equal a[14:29] b[23:38]
See Tools/scripts/ndiff.py for a fancy human-friendly file differencer,
which uses SequenceMatcher both to view files as sequences of lines, and
lines as sequences of characters.
See also function get_close_matches() in this module, which shows how
simple code building on SequenceMatcher can be used to do useful work.
Timing: Basic R-O is cubic time worst case and quadratic time expected
case. SequenceMatcher is quadratic time for the worst case and has
expected-case behavior dependent in a complicated way on how many
elements the sequences have in common; best case time is linear.
SequenceMatcher methods:
__init__(isjunk=None, a='', b='')
Construct a SequenceMatcher.
Optional arg isjunk is None (the default), or a one-argument function
that takes a sequence element and returns true iff the element is junk.
None is equivalent to passing "lambda x: 0", i.e. no elements are
considered to be junk. For example, pass
lambda x: x in " \\t"
if you're comparing lines as sequences of characters, and don't want to
synch up on blanks or hard tabs.
Optional arg a is the first of two sequences to be compared. By
default, an empty string. The elements of a must be hashable.
Optional arg b is the second of two sequences to be compared. By
default, an empty string. The elements of b must be hashable.
set_seqs(a, b)
Set the two sequences to be compared.
>>> s = SequenceMatcher()
>>> s.set_seqs("abcd", "bcde")
>>> s.ratio()
0.75
set_seq1(a)
Set the first sequence to be compared.
The second sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq1("bcde")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against many
sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for
each of the other sequences.
See also set_seqs() and set_seq2().
set_seq2(b)
Set the second sequence to be compared.
The first sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq2("abcd")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against many
sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for
each of the other sequences.
See also set_seqs() and set_seq1().
find_longest_match(alo, ahi, blo, bhi)
Find longest matching block in a[alo:ahi] and b[blo:bhi].
If isjunk is not defined:
Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
alo <= i <= i+k <= ahi
blo <= j <= j+k <= bhi
and for all (i',j',k') meeting those conditions,
k >= k'
i <= i'
and if i == i', j <= j'
In other words, of all maximal matching blocks, return one that starts
earliest in a, and of all those maximal matching blocks that start
earliest in a, return the one that starts earliest in b.
>>> s = SequenceMatcher(None, " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(0, 4, 5)
If isjunk is defined, first the longest matching block is determined as
above, but with the additional restriction that no junk element appears
in the block. Then that block is extended as far as possible by
matching (only) junk elements on both sides. So the resulting block
never matches on junk except as identical junk happens to be adjacent
to an "interesting" match.
Here's the same example as before, but considering blanks to be junk.
That prevents " abcd" from matching the " abcd" at the tail end of the
second sequence directly. Instead only the "abcd" can match, and
matches the leftmost "abcd" in the second sequence:
>>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(1, 0, 4)
If no blocks match, return (alo, blo, 0).
>>> s = SequenceMatcher(None, "ab", "c")
>>> s.find_longest_match(0, 2, 0, 1)
(0, 0, 0)
get_matching_blocks()
Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i
and in j.
The last triple is a dummy, (len(a), len(b), 0), and is the only triple
with n==0.
>>> s = SequenceMatcher(None, "abxcd", "abcd")
>>> s.get_matching_blocks()
[(0, 0, 2), (3, 2, 2), (5, 4, 0)]
get_opcodes()
Return list of 5-tuples describing how to turn a into b.
Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple has
i1 == j1 == 0, and remaining tuples have i1 == the i2 from the tuple
preceding it, and likewise for j1 == the previous j2.
The tags are strings, with these meanings:
'replace': a[i1:i2] should be replaced by b[j1:j2]
'delete': a[i1:i2] should be deleted.
Note that j1==j2 in this case.
'insert': b[j1:j2] should be inserted at a[i1:i1].
Note that i1==i2 in this case.
'equal': a[i1:i2] == b[j1:j2]
>>> a = "qabxcd"
>>> b = "abycdf"
>>> s = SequenceMatcher(None, a, b)
>>> for tag, i1, i2, j1, j2 in s.get_opcodes():
... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))
delete a[0:1] (q) b[0:0] ()
equal a[1:3] (ab) b[0:2] (ab)
replace a[3:4] (x) b[2:3] (y)
equal a[4:6] (cd) b[3:5] (cd)
insert a[6:6] () b[5:6] (f)
ratio()
Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and M is the
number of matches, this is 2,0*M / T. Note that this is 1 if the
sequences are identical, and 0 if they have nothing in common.
.ratio() is expensive to compute if you haven't already computed
.get_matching_blocks() or .get_opcodes(), in which case you may want to
try .quick_ratio() or .real_quick_ratio() first to get an upper bound.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.quick_ratio()
0.75
>>> s.real_quick_ratio()
1.0
quick_ratio()
Return an upper bound on .ratio() relatively quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute.
real_quick_ratio():
Return an upper bound on ratio() very quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute than either .ratio() or .quick_ratio().
"""
TRACE = 0
class SequenceMatcher:
def __init__(self, isjunk=None, a='', b=''):
"""Construct a SequenceMatcher.
Optional arg isjunk is None (the default), or a one-argument
function that takes a sequence element and returns true iff the
element is junk. None is equivalent to passing "lambda x: 0", i.e.
no elements are considered to be junk. For example, pass
lambda x: x in " \\t"
if you're comparing lines as sequences of characters, and don't
want to synch up on blanks or hard tabs.
Optional arg a is the first of two sequences to be compared. By
default, an empty string. The elements of a must be hashable. See
also .set_seqs() and .set_seq1().
Optional arg b is the second of two sequences to be compared. By
default, an empty string. The elements of b must be hashable. See
also .set_seqs() and .set_seq2().
"""
# Members:
# a
# first sequence
# b
# second sequence; differences are computed as "what do
# we need to do to 'a' to change it into 'b'?"
# b2j
# for x in b, b2j[x] is a list of the indices (into b)
# at which x appears; junk elements do not appear
# b2jhas
# b2j.has_key
# fullbcount
# for x in b, fullbcount[x] == the number of times x
# appears in b; only materialized if really needed (used
# only for computing quick_ratio())
# matching_blocks
# a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k];
# ascending & non-overlapping in i and in j; terminated by
# a dummy (len(a), len(b), 0) sentinel
# opcodes
# a list of (tag, i1, i2, j1, j2) tuples, where tag is
# one of
# 'replace' a[i1:i2] should be replaced by b[j1:j2]
# 'delete' a[i1:i2] should be deleted
# 'insert' b[j1:j2] should be inserted
# 'equal' a[i1:i2] == b[j1:j2]
# isjunk
# a user-supplied function taking a sequence element and
# returning true iff the element is "junk" -- this has
# subtle but helpful effects on the algorithm, which I'll
# get around to writing up someday <0.9 wink>.
# DON'T USE! Only __chain_b uses this. Use isbjunk.
# isbjunk
# for x in b, isbjunk(x) == isjunk(x) but much faster;
# it's really the has_key method of a hidden dict.
# DOES NOT WORK for x in a!
self.isjunk = isjunk
self.a = self.b = None
self.set_seqs(a, b)
def set_seqs(self, a, b):
"""Set the two sequences to be compared.
>>> s = SequenceMatcher()
>>> s.set_seqs("abcd", "bcde")
>>> s.ratio()
0.75
"""
self.set_seq1(a)
self.set_seq2(b)
def set_seq1(self, a):
"""Set the first sequence to be compared.
The second sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq1("bcde")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against
many sequences, use .set_seq2(S) once and call .set_seq1(x)
repeatedly for each of the other sequences.
See also set_seqs() and set_seq2().
"""
if a is self.a:
return
self.a = a
self.matching_blocks = self.opcodes = None
def set_seq2(self, b):
"""Set the second sequence to be compared.
The first sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq2("abcd")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against
many sequences, use .set_seq2(S) once and call .set_seq1(x)
repeatedly for each of the other sequences.
See also set_seqs() and set_seq1().
"""
if b is self.b:
return
self.b = b
self.matching_blocks = self.opcodes = None
self.fullbcount = None
self.__chain_b()
# For each element x in b, set b2j[x] to a list of the indices in
# b where x appears; the indices are in increasing order; note that
# the number of times x appears in b is len(b2j[x]) ...
# when self.isjunk is defined, junk elements don't show up in this
# map at all, which stops the central find_longest_match method
# from starting any matching block at a junk element ...
# also creates the fast isbjunk function ...
# note that this is only called when b changes; so for cross-product
# kinds of matches, it's best to call set_seq2 once, then set_seq1
# repeatedly
def __chain_b(self):
# Because isjunk is a user-defined (not C) function, and we test
# for junk a LOT, it's important to minimize the number of calls.
# Before the tricks described here, __chain_b was by far the most
# time-consuming routine in the whole module! If anyone sees
# Jim Roskind, thank him again for profile.py -- I never would
# have guessed that.
# The first trick is to build b2j ignoring the possibility
# of junk. I.e., we don't call isjunk at all yet. Throwing
# out the junk later is much cheaper than building b2j "right"
# from the start.
b = self.b
self.b2j = b2j = {}
self.b2jhas = b2jhas = b2j.has_key
for i in xrange(len(b)):
elt = b[i]
if b2jhas(elt):
b2j[elt].append(i)
else:
b2j[elt] = [i]
# Now b2j.keys() contains elements uniquely, and especially when
# the sequence is a string, that's usually a good deal smaller
# than len(string). The difference is the number of isjunk calls
# saved.
isjunk, junkdict = self.isjunk, {}
if isjunk:
for elt in b2j.keys():
if isjunk(elt):
junkdict[elt] = 1 # value irrelevant; it's a set
del b2j[elt]
# Now for x in b, isjunk(x) == junkdict.has_key(x), but the
# latter is much faster. Note too that while there may be a
# lot of junk in the sequence, the number of *unique* junk
# elements is probably small. So the memory burden of keeping
# this dict alive is likely trivial compared to the size of b2j.
self.isbjunk = junkdict.has_key
def find_longest_match(self, alo, ahi, blo, bhi):
"""Find longest matching block in a[alo:ahi] and b[blo:bhi].
If isjunk is not defined:
Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
alo <= i <= i+k <= ahi
blo <= j <= j+k <= bhi
and for all (i',j',k') meeting those conditions,
k >= k'
i <= i'
and if i == i', j <= j'
In other words, of all maximal matching blocks, return one that
starts earliest in a, and of all those maximal matching blocks that
start earliest in a, return the one that starts earliest in b.
>>> s = SequenceMatcher(None, " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(0, 4, 5)
If isjunk is defined, first the longest matching block is
determined as above, but with the additional restriction that no
junk element appears in the block. Then that block is extended as
far as possible by matching (only) junk elements on both sides. So
the resulting block never matches on junk except as identical junk
happens to be adjacent to an "interesting" match.
Here's the same example as before, but considering blanks to be
junk. That prevents " abcd" from matching the " abcd" at the tail
end of the second sequence directly. Instead only the "abcd" can
match, and matches the leftmost "abcd" in the second sequence:
>>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(1, 0, 4)
If no blocks match, return (alo, blo, 0).
>>> s = SequenceMatcher(None, "ab", "c")
>>> s.find_longest_match(0, 2, 0, 1)
(0, 0, 0)
"""
# CAUTION: stripping common prefix or suffix would be incorrect.
# E.g.,
# ab
# acab
# Longest matching block is "ab", but if common prefix is
# stripped, it's "a" (tied with "b"). UNIX(tm) diff does so
# strip, so ends up claiming that ab is changed to acab by
# inserting "ca" in the middle. That's minimal but unintuitive:
# "it's obvious" that someone inserted "ac" at the front.
# Windiff ends up at the same place as diff, but by pairing up
# the unique 'b's and then matching the first two 'a's.
a, b, b2j, isbjunk = self.a, self.b, self.b2j, self.isbjunk
besti, bestj, bestsize = alo, blo, 0
# find longest junk-free match
# during an iteration of the loop, j2len[j] = length of longest
# junk-free match ending with a[i-1] and b[j]
j2len = {}
nothing = []
for i in xrange(alo, ahi):
# look at all instances of a[i] in b; note that because
# b2j has no junk keys, the loop is skipped if a[i] is junk
j2lenget = j2len.get
newj2len = {}
for j in b2j.get(a[i], nothing):
# a[i] matches b[j]
if j < blo:
continue
if j >= bhi:
break
k = newj2len[j] = j2lenget(j-1, 0) + 1
if k > bestsize:
besti, bestj, bestsize = i-k+1, j-k+1, k
j2len = newj2len
# Now that we have a wholly interesting match (albeit possibly
# empty!), we may as well suck up the matching junk on each
# side of it too. Can't think of a good reason not to, and it
# saves post-processing the (possibly considerable) expense of
# figuring out what to do with it. In the case of an empty
# interesting match, this is clearly the right thing to do,
# because no other kind of match is possible in the regions.
while besti > alo and bestj > blo and \
isbjunk(b[bestj-1]) and \
a[besti-1] == b[bestj-1]:
besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
while besti+bestsize < ahi and bestj+bestsize < bhi and \
isbjunk(b[bestj+bestsize]) and \
a[besti+bestsize] == b[bestj+bestsize]:
bestsize = bestsize + 1
if TRACE:
print "get_matching_blocks", alo, ahi, blo, bhi
print " returns", besti, bestj, bestsize
return besti, bestj, bestsize
def get_matching_blocks(self):
"""Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
i and in j.
The last triple is a dummy, (len(a), len(b), 0), and is the only
triple with n==0.
>>> s = SequenceMatcher(None, "abxcd", "abcd")
>>> s.get_matching_blocks()
[(0, 0, 2), (3, 2, 2), (5, 4, 0)]
"""
if self.matching_blocks is not None:
return self.matching_blocks
self.matching_blocks = []
la, lb = len(self.a), len(self.b)
self.__helper(0, la, 0, lb, self.matching_blocks)
self.matching_blocks.append( (la, lb, 0) )
if TRACE:
print '*** matching blocks', self.matching_blocks
return self.matching_blocks
# builds list of matching blocks covering a[alo:ahi] and
# b[blo:bhi], appending them in increasing order to answer
def __helper(self, alo, ahi, blo, bhi, answer):
i, j, k = x = self.find_longest_match(alo, ahi, blo, bhi)
# a[alo:i] vs b[blo:j] unknown
# a[i:i+k] same as b[j:j+k]
# a[i+k:ahi] vs b[j+k:bhi] unknown
if k:
if alo < i and blo < j:
self.__helper(alo, i, blo, j, answer)
answer.append(x)
if i+k < ahi and j+k < bhi:
self.__helper(i+k, ahi, j+k, bhi, answer)
def get_opcodes(self):
"""Return list of 5-tuples describing how to turn a into b.
Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple
has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
tuple preceding it, and likewise for j1 == the previous j2.
The tags are strings, with these meanings:
'replace': a[i1:i2] should be replaced by b[j1:j2]
'delete': a[i1:i2] should be deleted.
Note that j1==j2 in this case.
'insert': b[j1:j2] should be inserted at a[i1:i1].
Note that i1==i2 in this case.
'equal': a[i1:i2] == b[j1:j2]
>>> a = "qabxcd"
>>> b = "abycdf"
>>> s = SequenceMatcher(None, a, b)
>>> for tag, i1, i2, j1, j2 in s.get_opcodes():
... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))
delete a[0:1] (q) b[0:0] ()
equal a[1:3] (ab) b[0:2] (ab)
replace a[3:4] (x) b[2:3] (y)
equal a[4:6] (cd) b[3:5] (cd)
insert a[6:6] () b[5:6] (f)
"""
if self.opcodes is not None:
return self.opcodes
i = j = 0
self.opcodes = answer = []
for ai, bj, size in self.get_matching_blocks():
# invariant: we've pumped out correct diffs to change
# a[:i] into b[:j], and the next matching block is
# a[ai:ai+size] == b[bj:bj+size]. So we need to pump
# out a diff to change a[i:ai] into b[j:bj], pump out
# the matching block, and move (i,j) beyond the match
tag = ''
if i < ai and j < bj:
tag = 'replace'
elif i < ai:
tag = 'delete'
elif j < bj:
tag = 'insert'
if tag:
answer.append( (tag, i, ai, j, bj) )
i, j = ai+size, bj+size
# the list of matching blocks is terminated by a
# sentinel with size 0
if size:
answer.append( ('equal', ai, i, bj, j) )
return answer
def ratio(self):
"""Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and
M is the number of matches, this is 2,0*M / T.
Note that this is 1 if the sequences are identical, and 0 if
they have nothing in common.
.ratio() is expensive to compute if you haven't already computed
.get_matching_blocks() or .get_opcodes(), in which case you may
want to try .quick_ratio() or .real_quick_ratio() first to get an
upper bound.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.quick_ratio()
0.75
>>> s.real_quick_ratio()
1.0
"""
matches = reduce(lambda sum, triple: sum + triple[-1],
self.get_matching_blocks(), 0)
return 2.0 * matches / (len(self.a) + len(self.b))
def quick_ratio(self):
"""Return an upper bound on ratio() relatively quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute.
"""
# viewing a and b as multisets, set matches to the cardinality
# of their intersection; this counts the number of matches
# without regard to order, so is clearly an upper bound
if self.fullbcount is None:
self.fullbcount = fullbcount = {}
for elt in self.b:
fullbcount[elt] = fullbcount.get(elt, 0) + 1
fullbcount = self.fullbcount
# avail[x] is the number of times x appears in 'b' less the
# number of times we've seen it in 'a' so far ... kinda
avail = {}
availhas, matches = avail.has_key, 0
for elt in self.a:
if availhas(elt):
numb = avail[elt]
else:
numb = fullbcount.get(elt, 0)
avail[elt] = numb - 1
if numb > 0:
matches = matches + 1
return 2.0 * matches / (len(self.a) + len(self.b))
def real_quick_ratio(self):
"""Return an upper bound on ratio() very quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute than either .ratio() or .quick_ratio().
"""
la, lb = len(self.a), len(self.b)
# can't have more matches than the number of elements in the
# shorter sequence
return 2.0 * min(la, lb) / (la + lb)
def get_close_matches(word, possibilities, n=3, cutoff=0.6):
"""Use SequenceMatcher to return list of the best "good enough" matches.
word is a sequence for which close matches are desired (typically a
string).
possibilities is a list of sequences against which to match word
(typically a list of strings).
Optional arg n (default 3) is the maximum number of close matches to
return. n must be > 0.
Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities
that don't score at least that similar to word are ignored.
The best (no more than n) matches among the possibilities are returned
in a list, sorted by similarity score, most similar first.
>>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
['apple', 'ape']
>>> import keyword
>>> get_close_matches("wheel", keyword.kwlist)
['while']
>>> get_close_matches("apple", keyword.kwlist)
[]
>>> get_close_matches("accept", keyword.kwlist)
['except']
"""
if not n > 0:
raise ValueError("n must be > 0: " + `n`)
if not 0.0 <= cutoff <= 1.0:
raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`)
result = []
s = SequenceMatcher()
s.set_seq2(word)
for x in possibilities:
s.set_seq1(x)
if s.real_quick_ratio() >= cutoff and \
s.quick_ratio() >= cutoff and \
s.ratio() >= cutoff:
result.append((s.ratio(), x))
# Sort by score.
result.sort()
# Retain only the best n.
result = result[-n:]
# Move best-scorer to head of list.
result.reverse()
# Strip scores.
# Python 2.x list comprehensions: return [x for score, x in result]
return_result = []
for score, x in result:
return_result.append(x)
return return_result
def _test():
import doctest, difflib
return doctest.testmod(difflib)
if __name__ == "__main__":
_test()

View File

@@ -4,6 +4,8 @@
# Released to the public domain 08-Dec-2000,
# by Tim Peters (tim.one@home.com).
# Backported to Python 1.5.2 for ViewCVS by pf@artcom-gmbh.de, 24-Dec-2001
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
"""ndiff [-q] file1 file2
@@ -43,7 +45,7 @@ recovered by piping the output through
See module comments for details and programmatic interface.
"""
__version__ = 1, 5, 0
__version__ = 1, 6, 1
# SequenceMatcher tries to compute a "human-friendly diff" between
# two sequences (chiefly picturing a file as a sequence of lines,
@@ -97,9 +99,8 @@ __version__ = 1, 5, 0
# is sent to stdout. Or you can call main(args), passing what would
# have been in sys.argv[1:] had the cmd-line form been used.
from difflib import SequenceMatcher
from compat_difflib import SequenceMatcher
import string
TRACE = 0
# define what "junk" means
@@ -200,15 +201,15 @@ def fancy_replace(a, alo, ahi, b, blo, bhi):
for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes():
la, lb = ai2 - ai1, bj2 - bj1
if tag == 'replace':
atags += '^' * la
btags += '^' * lb
atags = atags + '^' * la
btags = btags + '^' * lb
elif tag == 'delete':
atags += '-' * la
atags = atags + '-' * la
elif tag == 'insert':
btags += '+' * lb
btags = btags + '+' * lb
elif tag == 'equal':
atags += ' ' * la
btags += ' ' * lb
atags = atags + ' ' * la
btags = btags + ' ' * lb
else:
raise ValueError, 'unknown tag ' + `tag`
printq(aelt, belt, atags, btags)
@@ -245,7 +246,7 @@ def printq(aline, bline, atags, btags):
def count_leading(line, ch):
i, n = 0, len(line)
while i < n and line[i] == ch:
i += 1
i = i+1
return i
def fail(msg):

View File

@@ -1,27 +1,26 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2008 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# config.py: configuration utilities
#
# -----------------------------------------------------------------------
#
import sys
import os
import string
import ConfigParser
import fnmatch
import re
import vclib
#########################################################################
@@ -30,28 +29,28 @@ import fnmatch
#
# There are three forms of configuration:
#
# 1) edit the viewcvs.conf created by the viewcvs-install(er)
# 2) as (1), but delete all unchanged entries from viewcvs.conf
# 3) do not use viewcvs.conf and just edit the defaults in this file
# 1) edit the viewvc.conf created by the viewvc-install(er)
# 2) as (1), but delete all unchanged entries from viewvc.conf
# 3) do not use viewvc.conf and just edit the defaults in this file
#
# Most users will want to use (1), but there are slight speed advantages
# to the other two options. Note that viewcvs.conf values are a bit easier
# to the other two options. Note that viewvc.conf values are a bit easier
# to work with since it is raw text, rather than python literal values.
#
#########################################################################
class Config:
_sections = ('general', 'options', 'cvsdb', 'templates')
_force_multi_value = ('cvs_roots', 'forbidden', 'disable_enscript_lang',
'languages', 'kv_files')
_force_multi_value = ('cvs_roots', 'forbidden', 'forbiddenre',
'svn_roots', 'languages', 'kv_files',
'root_parents')
def __init__(self):
for section in self._sections:
setattr(self, section, _sub_config())
def load_config(self, fname, vhost=None):
this_dir = os.path.dirname(sys.argv[0])
pathname = os.path.join(this_dir, fname)
def load_config(self, pathname, vhost=None):
self.conf_path = os.path.isfile(pathname) and pathname or None
self.base = os.path.dirname(pathname)
parser = ConfigParser.ConfigParser()
@@ -106,12 +105,9 @@ class Config:
except ValueError:
pass
if opt == 'cvs_roots':
roots = { }
for root in value:
name, path = map(string.strip, string.split(root, ':'))
roots[name] = path
value = roots
if opt == 'cvs_roots' or opt == 'svn_roots':
value = _parse_roots(opt, value)
setattr(sc, opt, value)
def _process_vhost(self, parser, vhost):
@@ -128,6 +124,8 @@ class Config:
def _find_canon_vhost(self, parser, vhost):
vhost = string.lower(vhost)
# Strip (ignore) port number:
vhost = string.split(vhost, ':')[0]
for canon_vhost in parser.options('vhosts'):
value = parser.get('vhosts', canon_vhost)
@@ -142,38 +140,52 @@ class Config:
def set_defaults(self):
"Set some default values in the configuration."
self.general.cvs_roots = {
# user-visible-name : path
"Development" : "/home/cvsroot",
}
self.general.default_root = "Development"
self.general.cvs_roots = { }
self.general.svn_roots = { }
self.general.root_parents = []
self.general.default_root = ''
self.general.rcs_path = ''
if sys.platform == "win32":
self.general.cvsnt_exe_path = 'cvs'
else:
self.general.cvsnt_exe_path = None
self.general.use_rcsparse = 0
self.general.svn_path = ''
self.general.mime_types_file = ''
self.general.address = '<a href="mailto:user@insert.your.domain.here">No CVS admin address has been configured</a>'
self.general.main_title = 'CVS Repository'
self.general.forbidden = ()
self.general.kv_files = [ ]
self.general.address = '<a href="mailto:user@insert.your.domain.here">No admin address has been configured</a>'
self.general.forbidden = []
self.general.forbiddenre = []
self.general.kv_files = []
self.general.languages = ['en-us']
self.templates.directory = 'templates/directory.ezt'
self.templates.log = 'templates/log.ezt'
self.templates.query = 'templates/query.ezt'
self.templates.footer = 'templates/footer.ezt'
self.templates.diff = 'templates/diff.ezt'
self.templates.graph = 'templates/graph.ezt'
self.templates.annotate = 'templates/annotate.ezt'
self.templates.markup = 'templates/markup.ezt'
self.templates.directory = None
self.templates.log = None
self.templates.query = None
self.templates.diff = None
self.templates.graph = None
self.templates.annotate = None
self.templates.markup = None
self.templates.error = None
self.templates.query_form = None
self.templates.query_results = None
self.templates.roots = None
self.cvsdb.enabled = 0
self.cvsdb.host = ''
self.cvsdb.port = 3306
self.cvsdb.database_name = ''
self.cvsdb.user = ''
self.cvsdb.passwd = ''
self.cvsdb.readonly_user = ''
self.cvsdb.readonly_passwd = ''
self.cvsdb.row_limit = 1000
self.cvsdb.rss_row_limit = 100
self.options.root_as_url_component = 0
self.options.default_file_view = "log"
self.options.checkout_magic = 0
self.options.sort_by = 'file'
self.options.sort_group_dirs = 1
self.options.hide_attic = 1
self.options.log_sort = 'date'
self.options.diff_format = 'h'
@@ -182,38 +194,117 @@ class Config:
self.options.hr_funout = 1
self.options.hr_ignore_white = 1
self.options.hr_ignore_keyword_subst = 1
self.options.hr_intraline = 0
self.options.allow_annotate = 1
self.options.allow_markup = 1
self.options.allow_compress = 1
self.options.checkout_magic = 1
self.options.template_dir = "templates"
self.options.docroot = None
self.options.show_subdir_lastmod = 0
self.options.show_logs = 1
self.options.show_log_in_markup = 1
self.options.cross_copies = 0
self.options.py2html_path = '.'
self.options.short_log_len = 80
self.options.diff_font_face = 'Helvetica,Arial'
self.options.diff_font_size = -1
self.options.use_enscript = 0
self.options.enscript_path = ''
self.options.disable_enscript_lang = ()
self.options.use_highlight = 0
self.options.highlight_path = ''
self.options.highlight_line_numbers = 1
self.options.highlight_convert_tabs = 2
self.options.use_php = 0
self.options.php_exe_path = 'php'
self.options.allow_tar = 0
self.options.use_cvsgraph = 0
self.options.cvsgraph_path = ''
self.options.cvsgraph_conf = "<VIEWCVS_INSTALL_DIRECTORY>/cvsgraph.conf"
self.options.cvsgraph_conf = "cvsgraph.conf"
self.options.use_re_search = 0
self.options.use_pagesize = 0
self.options.limit_changes = 100
self.options.use_localtime = 0
self.options.http_expiration_time = 600
self.options.generate_etags = 1
def is_forbidden(self, module):
if not module:
def is_forbidden(self, root, path_parts, pathtype):
# If we don't have a root and path to check, get outta here.
if not (root and path_parts):
return 0
default = 0
for pat in self.general.forbidden:
if pat[0] == '!':
default = 1
if fnmatch.fnmatchcase(module, pat[1:]):
return 0
elif fnmatch.fnmatchcase(module, pat):
return 1
return default
# Give precedence to the new 'forbiddenre' stuff first.
if self.general.forbiddenre:
# Join the root and path-parts together into one path-like thing.
root_and_path = string.join([root] + path_parts, "/")
if pathtype == vclib.DIR:
root_and_path = root_and_path + '/'
# If we still have a list of strings, replace those suckers with
# lists of (compiled_regex, negation_flag)
if type(self.general.forbiddenre[0]) == type(""):
for i in range(len(self.general.forbiddenre)):
pat = self.general.forbiddenre[i]
if pat[0] == '!':
self.general.forbiddenre[i] = (re.compile(pat[1:]), 1)
else:
self.general.forbiddenre[i] = (re.compile(pat), 0)
# Do the forbiddenness test.
default = 0
for (pat, negated) in self.general.forbiddenre:
match = pat.search(root_and_path)
if negated:
default = 1
if match:
return 0
elif match:
return 1
return default
# If no 'forbiddenre' is in use, we check 'forbidden', which only
# looks at the top-most directory.
elif self.general.forbidden:
# A root and a single non-directory path component? That's not
# a module.
if len(path_parts) == 1 and pathtype != vclib.DIR:
return 0
# Do the forbiddenness test.
module = path_parts[0]
default = 0
for pat in self.general.forbidden:
if pat[0] == '!':
default = 1
if fnmatch.fnmatchcase(module, pat[1:]):
return 0
elif fnmatch.fnmatchcase(module, pat):
return 1
return default
# No forbiddenness configuration? Just allow it.
else:
return 0
def _parse_roots(config_name, config_value):
roots = { }
for root in config_value:
pos = string.find(root, ':')
if pos < 0:
raise MalformedRoot(config_name, root)
name, path = map(string.strip, (root[:pos], root[pos+1:]))
roots[name] = path
return roots
class MalformedRoot(Exception):
def __init__(self, config_name, value_given):
Exception.__init__(self, config_name, value_given)
self.config_name = config_name
self.value_given = value_given
def __str__(self):
return "malformed configuration: '%s' uses invalid syntax: %s" \
% (self.config_name, self.value_given)
class _sub_config:
pass

View File

@@ -1,70 +1,41 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2007 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://www.lyra.org/viewcvs/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://www.lyra.org/viewcvs/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
CONF_PATHNAME = None
#########################################################################
import os
import sys
import string
import time
import fnmatch
import re
import config
import dbi
import rlog
## load configuration file, the data is used globally here
if CONF_PATHNAME:
_cfg_pathname = CONF_PATHNAME
else:
# developer assistance: running from a CVS working copy
_cfg_pathname = os.path.join(os.path.dirname(__file__), os.pardir, 'cgi',
'viewcvs.conf')
cfg = config.Config()
cfg.set_defaults()
cfg.load_config(_cfg_pathname)
## error
error = "cvsdb error"
## cached (active) database connections
gCheckinDatabase = None
gCheckinDatabaseReadOnly = None
## CheckinDatabase provides all interfaces needed to the SQL database
## back-end; it needs to be subclassed, and have its "Connect" method
## defined to actually be complete; it should run well off of any DBI 2.0
## complient database interface
class CheckinDatabase:
def __init__(self, host, user, passwd, database):
def __init__(self, host, port, user, passwd, database, row_limit):
self._host = host
self._port = port
self._user = user
self._passwd = passwd
self._database = database
self._row_limit = row_limit
## database lookup caches
self._get_cache = {}
@@ -73,7 +44,9 @@ class CheckinDatabase:
def Connect(self):
self.db = dbi.connect(
self._host, self._user, self._passwd, self._database)
self._host, self._port, self._user, self._passwd, self._database)
cursor = self.db.cursor()
cursor.execute("SET AUTOCOMMIT=1")
def sql_get_id(self, table, column, value, auto_set):
sql = "SELECT id FROM %s WHERE %s=%%s" % (table, column)
@@ -264,14 +237,7 @@ class CheckinDatabase:
self.AddCommit(commit)
def AddCommit(self, commit):
## MORE TIME HELL: the MySQLdb module doesn't construct times
## correctly when created with TimestampFromTicks -- it doesn't
## account for daylight savings time, so we use Python's time
## module to do the conversion
temp = time.localtime(commit.GetTime())
ci_when = dbi.Timestamp(
temp[0], temp[1], temp[2], temp[3], temp[4], temp[5])
ci_when = dbi.DateTimeFromTicks(commit.GetTime())
ci_type = commit.GetTypeString()
who_id = self.GetAuthorID(commit.GetAuthor())
repository_id = self.GetRepositoryID(commit.GetRepository())
@@ -280,8 +246,8 @@ class CheckinDatabase:
revision = commit.GetRevision()
sticky_tag = "NULL"
branch_id = self.GetBranchID(commit.GetBranch())
plus_count = commit.GetPlusCount()
minus_count = commit.GetMinusCount()
plus_count = commit.GetPlusCount() or '0'
minus_count = commit.GetMinusCount() or '0'
description_id = self.GetDescriptionID(commit.GetDescription())
sql = "REPLACE INTO checkins"\
@@ -295,67 +261,60 @@ class CheckinDatabase:
cursor = self.db.cursor()
cursor.execute(sql, sql_args)
def SQLQueryListString(self, sqlString, query_entry_list):
def SQLQueryListString(self, field, query_entry_list):
sqlList = []
for query_entry in query_entry_list:
data = query_entry.data
## figure out the correct match type
if query_entry.match == "exact":
match = "="
elif query_entry.match == "like":
match = " LIKE "
elif query_entry.match == "glob":
match = " REGEXP "
# use fnmatch to translate the glob into a regexp
data = fnmatch.translate(data)
if data[0] != '^': data = '^' + data
elif query_entry.match == "regex":
match = " REGEXP "
elif query_entry.match == "notregex":
match = " NOT REGEXP "
sqlList.append(sqlString % (match, query_entry.data))
sqlList.append("%s%s%s" % (field, match, self.db.literal(data)))
return "(%s)" % (string.join(sqlList, " OR "))
def CreateSQLQueryString(self, query):
tableList = ["checkins"]
tableList = [("checkins", None)]
condList = []
## XXX: this is to exclude .ver files -- RN specific hack --JMP
tableList.append("files")
temp = "(checkins.fileid=files.id AND files.file NOT LIKE \"%.ver\")"
condList.append(temp)
## XXX
if len(query.repository_list):
tableList.append("repositories")
sql = "(checkins.repositoryid=repositories.id AND "\
"repositories.repository%s\"%s\")"
temp = self.SQLQueryListString(sql, query.repository_list)
tableList.append(("repositories",
"(checkins.repositoryid=repositories.id)"))
temp = self.SQLQueryListString("repositories.repository",
query.repository_list)
condList.append(temp)
if len(query.branch_list):
tableList.append("branches")
sql = "(checkins.branchid=branches.id AND "\
"branches.branch%s\"%s\")"
temp = self.SQLQueryListString(sql, query.branch_list)
tableList.append(("branches", "(checkins.branchid=branches.id)"))
temp = self.SQLQueryListString("branches.branch",
query.branch_list)
condList.append(temp)
if len(query.directory_list):
tableList.append("dirs")
sql = "(checkins.dirid=dirs.id AND dirs.dir%s\"%s\")"
temp = self.SQLQueryListString(sql, query.directory_list)
tableList.append(("dirs", "(checkins.dirid=dirs.id)"))
temp = self.SQLQueryListString("dirs.dir", query.directory_list)
condList.append(temp)
if len(query.file_list):
tableList.append("files")
sql = "(checkins.fileid=files.id AND files.file%s\"%s\")"
temp = self.SQLQueryListString(sql, query.file_list)
tableList.append(("files", "(checkins.fileid=files.id)"))
temp = self.SQLQueryListString("files.file", query.file_list)
condList.append(temp)
if len(query.author_list):
tableList.append("people")
sql = "(checkins.whoid=people.id AND people.who%s\"%s\")"
temp = self.SQLQueryListString(sql, query.author_list)
tableList.append(("people", "(checkins.whoid=people.id)"))
temp = self.SQLQueryListString("people.who", query.author_list)
condList.append(temp)
if query.from_date:
@@ -367,27 +326,38 @@ class CheckinDatabase:
condList.append(temp)
if query.sort == "date":
order_by = "ORDER BY checkins.ci_when DESC"
order_by = "ORDER BY checkins.ci_when DESC,descid"
elif query.sort == "author":
order_by = "ORDER BY checkins.whoid"
tableList.append(("people", "(checkins.whoid=people.id)"))
order_by = "ORDER BY people.who,descid"
elif query.sort == "file":
order_by = "ORDER BY checkins.fileid"
tableList.append(("files", "(checkins.fileid=files.id)"))
order_by = "ORDER BY files.file,descid"
## exclude duplicates from the table list
for table in tableList[:]:
while tableList.count(table) > 1:
tableList.remove(table)
## exclude duplicates from the table list, and split out join
## conditions from table names. In future, the join conditions
## might be handled by INNER JOIN statements instead of WHERE
## clauses, but MySQL 3.22 apparently doesn't support them well.
tables = []
joinConds = []
for (table, cond) in tableList:
if table not in tables:
tables.append(table)
if cond is not None: joinConds.append(cond)
tables = string.join(tableList, ",")
conditions = string.join(condList, " AND ")
tables = string.join(tables, ",")
conditions = string.join(joinConds + condList, " AND ")
conditions = conditions and "WHERE %s" % conditions
## limit the number of rows requested or we could really slam
## a server with a large database
limit = ""
if cfg.cvsdb.row_limit:
limit = "LIMIT %s" % (str(cfg.cvsdb.row_limit))
if query.limit:
limit = "LIMIT %s" % (str(query.limit))
elif self._row_limit:
limit = "LIMIT %s" % (str(self._row_limit))
sql = "SELECT checkins.* FROM %s WHERE %s %s %s" % (
sql = "SELECT checkins.* FROM %s %s %s %s" % (
tables, conditions, order_by, limit)
return sql
@@ -406,28 +376,23 @@ class CheckinDatabase:
dbFileID, dbRevision, dbStickyTag, dbBranchID, dbAddedLines,
dbRemovedLines, dbDescID) = row
commit = CreateCommit()
## TIME, TIME, TIME is all fucked up; dateobject.gmticks()
## is broken, dateobject.ticks() returns somthing like
## GMT ticks, except it forgets about daylight savings
## time -- we handle it ourself in the following painful way
gmt_time = time.mktime(
(dbCI_When.year, dbCI_When.month, dbCI_When.day,
dbCI_When.hour, dbCI_When.minute, dbCI_When.second,
0, 0, dbCI_When.dst))
commit.SetTime(gmt_time)
commit.SetFile(self.GetFile(dbFileID))
commit.SetDirectory(self.GetDirectory(dbDirID))
commit = LazyCommit(self)
if dbType == 'Add':
commit.SetTypeAdd()
elif dbType == 'Remove':
commit.SetTypeRemove()
else:
commit.SetTypeChange()
commit.SetTime(dbi.TicksFromDateTime(dbCI_When))
commit.SetFileID(dbFileID)
commit.SetDirectoryID(dbDirID)
commit.SetRevision(dbRevision)
commit.SetRepository(self.GetRepository(dbRepositoryID))
commit.SetAuthor(self.GetAuthor(dbAuthorID))
commit.SetBranch(self.GetBranch(dbBranchID))
commit.SetRepositoryID(dbRepositoryID)
commit.SetAuthorID(dbAuthorID)
commit.SetBranchID(dbBranchID)
commit.SetPlusCount(dbAddedLines)
commit.SetMinusCount(dbRemovedLines)
commit.SetDescription(self.GetDescription(dbDescID))
commit.SetDescriptionID(dbDescID)
query.AddCommit(commit)
@@ -482,37 +447,18 @@ class Commit:
self.__type = Commit.CHANGE
def SetRepository(self, repository):
## clean up repository path; make sure it doesn't end with a
## path seperator
while len(repository) and repository[-1] == os.sep:
repository = repository[:-1]
self.__repository = repository
def GetRepository(self):
return self.__repository
def SetDirectory(self, dir):
## clean up directory path; make sure it doesn't begin
## or end with a path seperator
while len(dir) and dir[0] == os.sep:
dir = dir[1:]
while len(dir) and dir[-1] == os.sep:
dir = dir[:-1]
self.__directory = dir
def GetDirectory(self):
return self.__directory
def SetFile(self, file):
## clean up filename; make sure it doesn't begin
## or end with a path seperator
while len(file) and file[0] == os.sep:
file = file[1:]
while len(file) and file[-1] == os.sep:
file = file[:-1]
self.__file = file
def GetFile(self):
@@ -537,10 +483,7 @@ class Commit:
return self.__author
def SetBranch(self, branch):
if not branch:
self.__branch = ''
else:
self.__branch = branch
self.__branch = branch or ''
def GetBranch(self):
return self.__branch
@@ -583,6 +526,67 @@ class Commit:
elif self.__type == Commit.REMOVE:
return 'Remove'
## LazyCommit overrides a few methods of Commit to only retrieve
## it's properties as they are needed
class LazyCommit(Commit):
def __init__(self, db):
Commit.__init__(self)
self.__db = db
def SetFileID(self, dbFileID):
self.__dbFileID = dbFileID
def GetFileID(self):
return self.__dbFileID
def GetFile(self):
return self.__db.GetFile(self.__dbFileID)
def SetDirectoryID(self, dbDirID):
self.__dbDirID = dbDirID
def GetDirectoryID(self):
return self.__dbDirID
def GetDirectory(self):
return self.__db.GetDirectory(self.__dbDirID)
def SetRepositoryID(self, dbRepositoryID):
self.__dbRepositoryID = dbRepositoryID
def GetRepositoryID(self):
return self.__dbRepositoryID
def GetRepository(self):
return self.__db.GetRepository(self.__dbRepositoryID)
def SetAuthorID(self, dbAuthorID):
self.__dbAuthorID = dbAuthorID
def GetAuthorID(self):
return self.__dbAuthorID
def GetAuthor(self):
return self.__db.GetAuthor(self.__dbAuthorID)
def SetBranchID(self, dbBranchID):
self.__dbBranchID = dbBranchID
def GetBranchID(self):
return self.__dbBranchID
def GetBranch(self):
return self.__db.GetBranch(self.__dbBranchID)
def SetDescriptionID(self, dbDescID):
self.__dbDescID = dbDescID
def GetDescriptionID(self):
return self.__dbDescID
def GetDescription(self):
return self.__db.GetDescription(self.__dbDescID)
## QueryEntry holds data on one match-type in the SQL database
## match is: "exact", "like", or "regex"
class QueryEntry:
@@ -608,6 +612,9 @@ class CheckinDatabaseQuery:
self.from_date = None
self.to_date = None
## limit on number of rows to return
self.limit = None
## list of commits -- filled in by CVS query
self.commit_list = []
@@ -634,115 +641,94 @@ class CheckinDatabaseQuery:
self.sort = sort
def SetFromDateObject(self, ticks):
self.from_date = dbi.TimestampFromTicks(ticks)
self.from_date = dbi.DateTimeFromTicks(ticks)
def SetToDateObject(self, ticks):
self.to_date = dbi.TimestampFromTicks(ticks)
self.to_date = dbi.DateTimeFromTicks(ticks)
def SetFromDateHoursAgo(self, hours_ago):
ticks = time.time() - (3600 * hours_ago)
self.from_date = dbi.TimestampFromTicks(ticks)
self.from_date = dbi.DateTimeFromTicks(ticks)
def SetFromDateDaysAgo(self, days_ago):
ticks = time.time() - (86400 * days_ago)
self.from_date = dbi.TimestampFromTicks(ticks)
self.from_date = dbi.DateTimeFromTicks(ticks)
def SetToDateDaysAgo(self, days_ago):
ticks = time.time() - (86400 * days_ago)
self.to_date = dbi.TimestampFromTicks(ticks)
self.to_date = dbi.DateTimeFromTicks(ticks)
def SetLimit(self, limit):
self.limit = limit;
def AddCommit(self, commit):
self.commit_list.append(commit)
if self.commit_cb:
self.commit_cb(commit)
def SetCommitCB(self, callback):
self.commit_cb = callback
##
## entrypoints
##
def CreateCheckinDatabase(host, user, passwd, database):
return CheckinDatabase(host, user, passwd, database)
def CreateCommit():
return Commit()
def CreateCheckinQuery():
return CheckinDatabaseQuery()
def ConnectDatabaseReadOnly():
global gCheckinDatabaseReadOnly
if gCheckinDatabaseReadOnly:
return gCheckinDatabaseReadOnly
gCheckinDatabaseReadOnly = CreateCheckinDatabase(
cfg.cvsdb.host,
cfg.cvsdb.readonly_user,
cfg.cvsdb.readonly_passwd,
cfg.cvsdb.database_name)
gCheckinDatabaseReadOnly.Connect()
return gCheckinDatabaseReadOnly
def ConnectDatabase(cfg, readonly=0):
if readonly:
user = cfg.cvsdb.readonly_user
passwd = cfg.cvsdb.readonly_passwd
else:
user = cfg.cvsdb.user
passwd = cfg.cvsdb.passwd
db = CheckinDatabase(cfg.cvsdb.host, cfg.cvsdb.port, user, passwd,
cfg.cvsdb.database_name, cfg.cvsdb.row_limit)
db.Connect()
return db
def ConnectDatabase():
global gCheckinDatabase
gCheckinDatabase = CreateCheckinDatabase(
cfg.cvsdb.host,
cfg.cvsdb.user,
cfg.cvsdb.passwd,
cfg.cvsdb.database_name)
gCheckinDatabase.Connect()
return gCheckinDatabase
def ConnectDatabaseReadOnly(cfg):
return ConnectDatabase(cfg, 1)
def RLogDataToCommitList(repository, rlog_data):
def GetCommitListFromRCSFile(repository, path_parts, revision=None):
commit_list = []
## the filename in rlog_data contains the entire path of the
## repository; we strip that out here
temp = rlog_data.filename[len(repository):]
directory, file = os.path.split(temp)
directory = string.join(path_parts[:-1], "/")
file = path_parts[-1]
for rlog_entry in rlog_data.rlog_entry_list:
revs = repository.itemlog(path_parts, revision, {"cvs_pass_rev": 1})
for rev in revs:
commit = CreateCommit()
commit.SetRepository(repository)
commit.SetRepository(repository.rootpath)
commit.SetDirectory(directory)
commit.SetFile(file)
commit.SetRevision(rlog_entry.revision)
commit.SetAuthor(rlog_entry.author)
commit.SetDescription(rlog_entry.description)
commit.SetTime(rlog_entry.time)
commit.SetPlusCount(rlog_entry.pluscount)
commit.SetMinusCount(rlog_entry.minuscount)
commit.SetBranch(rlog_data.LookupBranch(rlog_entry))
commit.SetRevision(rev.string)
commit.SetAuthor(rev.author)
commit.SetDescription(rev.log)
commit.SetTime(rev.date)
if rlog_entry.type == rlog_entry.CHANGE:
commit.SetTypeChange()
elif rlog_entry.type == rlog_entry.ADD:
if rev.changed:
# extract the plus/minus and drop the sign
plus, minus = string.split(rev.changed)
commit.SetPlusCount(plus[1:])
commit.SetMinusCount(minus[1:])
if rev.dead:
commit.SetTypeRemove()
else:
commit.SetTypeChange()
else:
commit.SetTypeAdd()
elif rlog_entry.type == rlog_entry.REMOVE:
commit.SetTypeRemove()
commit_list.append(commit)
# if revision is on a branch which has at least one tag
if len(rev.number) > 2 and rev.branches:
commit.SetBranch(rev.branches[0].name)
return commit_list
def GetCommitListFromRCSFile(repository, filename):
try:
rlog_data = rlog.GetRLogData(cfg, filename)
except rlog.error, e:
raise error, e
commit_list = RLogDataToCommitList(repository, rlog_data)
return commit_list
def GetUnrecordedCommitList(repository, filename):
commit_list = GetCommitListFromRCSFile(repository, filename)
db = ConnectDatabase()
def GetUnrecordedCommitList(repository, path_parts, db):
commit_list = GetCommitListFromRCSFile(repository, path_parts)
unrecorded_commit_list = []
for commit in commit_list:
@@ -751,3 +737,31 @@ def GetUnrecordedCommitList(repository, filename):
unrecorded_commit_list.append(commit)
return unrecorded_commit_list
_re_likechars = re.compile(r"([_%\\])")
def EscapeLike(literal):
"""Escape literal string for use in a MySQL LIKE pattern"""
return re.sub(_re_likechars, r"\\\1", literal)
def FindRepository(db, path):
"""Find repository path in database given path to subdirectory
Returns normalized repository path and relative directory path"""
path = os.path.normpath(path)
dirs = []
while path:
rep = os.path.normcase(path)
if db.GetRepositoryID(rep, 0) is None:
path, pdir = os.path.split(path)
if not pdir:
return None, None
dirs.append(pdir)
else:
break
dirs.reverse()
return rep, dirs
def CleanRepository(path):
"""Return normalized top-level repository path"""
return os.path.normcase(os.path.normpath(path))

View File

@@ -1,71 +1,63 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
import sys
import time
import types
import re
import compat
import MySQLdb
# set to 1 to store commit times in UTC, or 0 to use the ViewVC machine's
# local timezone. Using UTC is recommended because it ensures that the
# database will remain valid even if it is moved to another machine or the host
# computer's time zone is changed. UTC also avoids the ambiguity associated
# with daylight saving time (for example if a computer in New York recorded the
# local time 2002/10/27 1:30 am, there would be no way to tell whether the
# actual time was recorded before or after clocks were rolled back). Use local
# times for compatibility with databases used by ViewCVS 0.92 and earlier
# versions.
utc_time = 1
dbi_error = "dbi error"
def DateTimeFromTicks(ticks):
"""Return a MySQL DATETIME value from a unix timestamp"""
if utc_time:
t = time.gmtime(ticks)
else:
t = time.localtime(ticks)
return "%04d-%02d-%02d %02d:%02d:%02d" % t[:6]
## make some checks in MySQLdb
_no_datetime = """\
ERROR: Your version of MySQLdb requires the mxDateTime module
for the Timestamp() and TimestampFromTicks() methods.
You will need to install mxDateTime to use the ViewCVS
database.
"""
_re_datetime = re.compile('([0-9]{4})-([0-9][0-9])-([0-9][0-9]) '
'([0-9][0-9]):([0-9][0-9]):([0-9][0-9])')
if not hasattr(MySQLdb, "Timestamp") or \
not hasattr(MySQLdb, "TimestampFromTicks"):
sys.stderr.write(_no_datetime)
sys.exit(1)
def TicksFromDateTime(datetime):
"""Return a unix timestamp from a MySQL DATETIME value"""
if type(datetime) == types.StringType:
# datetime is a MySQL DATETIME string
matches = _re_datetime.match(datetime).groups()
t = tuple(map(int, matches)) + (0, 0, 0)
elif hasattr(datetime, "timetuple"):
# datetime is a Python >=2.3 datetime.DateTime object
t = datetime.timetuple()
else:
# datetime is an eGenix mx.DateTime object
t = datetime.tuple()
class Cursor:
def __init__(self, mysql_cursor):
self.__cursor = mysql_cursor
def execute(self, *args):
apply(self.__cursor.execute, args)
def fetchone(self):
try:
row = self.__cursor.fetchone()
except IndexError:
row = None
return row
if utc_time:
return compat.timegm(t)
else:
return time.mktime(t[:8] + (-1,))
class Connection:
def __init__(self, host, user, passwd, db):
self.__mysql = MySQLdb.connect(
host=host, user=user, passwd=passwd, db=db)
def cursor(self):
return Cursor(self.__mysql.cursor())
def Timestamp(year, month, date, hour, minute, second):
return MySQLdb.Timestamp(year, month, date, hour, minute, second)
def TimestampFromTicks(ticks):
return MySQLdb.TimestampFromTicks(ticks)
def connect(host, user, passwd, db):
return Connection(host, user, passwd, db)
def connect(host, port, user, passwd, db):
return MySQLdb.connect(host=host, port=port, user=user, passwd=passwd, db=db)

View File

@@ -1,22 +1,27 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# Note: a t_start/t_end pair consumes about 0.00005 seconds on a P3/700.
# the lambda form (when debugging is disabled) should be even faster.
#
if 0:
import sys
SHOW_TIMES = 0
SHOW_CHILD_PROCESSES = 0
if SHOW_TIMES:
import time
@@ -35,8 +40,150 @@ if 0:
def dump():
for name, value in _times.items():
print '%s: %.6f<br>' % (name, value)
print '%s: %.6f<br />' % (name, value)
else:
t_start = t_end = dump = lambda *args: None
class ViewVCException:
def __init__(self, msg, status=None):
self.msg = msg
self.status = status
def __str__(self):
if self.status:
return '%s: %s' % (self.status, self.msg)
return "ViewVC Unrecoverable Error: %s" % self.msg
def PrintException(server, exc_data):
status = exc_data['status']
msg = exc_data['msg']
tb = exc_data['stacktrace']
server.header(status=status)
server.write("<h3>An Exception Has Occurred</h3>\n")
s = ''
if msg:
s = '<p><pre>%s</pre></p>' % server.escape(msg)
if status:
s = s + ('<h4>HTTP Response Status</h4>\n<p><pre>\n%s</pre></p><hr />\n'
% status)
server.write(s)
server.write("<h4>Python Traceback</h4>\n<p><pre>")
server.write(server.escape(tb))
server.write("</pre></p>\n")
def GetExceptionData():
# capture the exception before doing anything else
exc_type, exc, exc_tb = sys.exc_info()
exc_dict = {
'status' : None,
'msg' : None,
'stacktrace' : None,
}
try:
import traceback, string
if isinstance(exc, ViewVCException):
exc_dict['msg'] = exc.msg
exc_dict['status'] = exc.status
tb = string.join(traceback.format_exception(exc_type, exc, exc_tb), '')
exc_dict['stacktrace'] = tb
finally:
# prevent circular reference. sys.exc_info documentation warns
# "Assigning the traceback return value to a local variable in a function
# that is handling an exception will cause a circular reference..."
# This is all based on 'exc_tb', and we're now done with it. Toss it.
del exc_tb
return exc_dict
if SHOW_CHILD_PROCESSES:
class Process:
def __init__(self, command, inStream, outStream, errStream):
self.command = command
self.debugIn = inStream
self.debugOut = outStream
self.debugErr = errStream
import sapi
if not sapi.server is None:
if not sapi.server.pageGlobals.has_key('processes'):
sapi.server.pageGlobals['processes'] = [self]
else:
sapi.server.pageGlobals['processes'].append(self)
def DumpChildren(server):
import os
if not server.pageGlobals.has_key('processes'):
return
server.header()
lastOut = None
i = 0
for k in server.pageGlobals['processes']:
i = i + 1
server.write("<table>\n")
server.write("<tr><td colspan=\"2\">Child Process%i</td></tr>" % i)
server.write("<tr>\n <td style=\"vertical-align:top\">Command Line</td> <td><pre>")
server.write(server.escape(k.command))
server.write("</pre></td>\n</tr>\n")
server.write("<tr>\n <td style=\"vertical-align:top\">Standard In:</td> <td>")
if k.debugIn is lastOut and not lastOut is None:
server.write("<em>Output from process %i</em>" % (i - 1))
elif k.debugIn:
server.write("<pre>")
server.write(server.escape(k.debugIn.getvalue()))
server.write("</pre>")
server.write("</td>\n</tr>\n")
if k.debugOut is k.debugErr:
server.write("<tr>\n <td style=\"vertical-align:top\">Standard Out & Error:</td> <td><pre>")
if k.debugOut:
server.write(server.escape(k.debugOut.getvalue()))
server.write("</pre></td>\n</tr>\n")
else:
server.write("<tr>\n <td style=\"vertical-align:top\">Standard Out:</td> <td><pre>")
if k.debugOut:
server.write(server.escape(k.debugOut.getvalue()))
server.write("</pre></td>\n</tr>\n")
server.write("<tr>\n <td style=\"vertical-align:top\">Standard Error:</td> <td><pre>")
if k.debugErr:
server.write(server.escape(k.debugErr.getvalue()))
server.write("</pre></td>\n</tr>\n")
server.write("</table>\n")
server.flush()
lastOut = k.debugOut
server.write("<table>\n")
server.write("<tr><td colspan=\"2\">Environment Variables</td></tr>")
for k, v in os.environ.items():
server.write("<tr>\n <td style=\"vertical-align:top\"><pre>")
server.write(server.escape(k))
server.write("</pre></td>\n <td style=\"vertical-align:top\"><pre>")
server.write(server.escape(v))
server.write("</pre></td>\n</tr>")
server.write("</table>")
else:
def DumpChildren(server):
pass

View File

@@ -1,18 +1,19 @@
#!/usr/bin/env python
"""ezt.py -- easy templating
ezt templates are very similar to standard HTML files. But additionaly
they contain directives sprinkled in between. With these directives
it possible to generate the dynamic content from the ezt templates.
ezt templates are simply text files in whatever format you so desire
(such as XML, HTML, etc.) which contain directives sprinkled
throughout. With these directives it is possible to generate the
dynamic content from the ezt templates.
These directives are enclosed in square brackets. If you are a
C-programmer, you might be familar with the #ifdef directives of the
C preprocessor 'cpp'. ezt provides a similar concept for HTML. Additionally
EZT has a 'for' directive, which allows to iterate (repeat) certain
These directives are enclosed in square brackets. If you are a
C-programmer, you might be familar with the #ifdef directives of the C
preprocessor 'cpp'. ezt provides a similar concept. Additionally EZT
has a 'for' directive, which allows it to iterate (repeat) certain
subsections of the template according to sequence of data items
provided by the application.
The HTML rendering is performed by the method generate() of the Template
The final rendering is performed by the method generate() of the Template
class. Building template instances can either be done using external
EZT files (convention: use the suffix .ezt for such files):
@@ -26,7 +27,7 @@ a EZT template string:
... <title>[title_string]</title></head>
... <body><h1>[title_string]</h1>
... [for a_sequence] <p>[a_sequence]</p>
... [end] <hr>
... [end] <hr />
... The [person] is [if-any state]in[else]out[end].
... </body>
... </html>
@@ -47,11 +48,32 @@ with the output fileobject to the templates generate method:
<p>list item 1</p>
<p>list item 2</p>
<p>another element</p>
<hr>
<hr />
The doctor is out.
</body>
</html>
Template syntax error reporting should be improved. Currently it is
very sparse (template line numbers would be nice):
>>> Template().parse("[if-any where] foo [else] bar [end unexpected args]")
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "ezt.py", line 220, in parse
self.program = self._parse(text)
File "ezt.py", line 275, in _parse
raise ArgCountSyntaxError(str(args[1:]))
ArgCountSyntaxError: ['unexpected', 'args']
>>> Template().parse("[if unmatched_end]foo[end]")
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "ezt.py", line 206, in parse
self.program = self._parse(text)
File "ezt.py", line 266, in _parse
raise UnmatchedEndError()
UnmatchedEndError
Directives
==========
@@ -59,19 +81,58 @@ Directives
or attributes of objects contained in the data dictionary given to the
.generate() method.
Qualified names
---------------
Qualified names have two basic forms: a variable reference, or a string
constant. References are a name from the data dictionary with optional
dotted attributes (where each intermediary is an object with attributes,
of course).
Examples:
[varname]
[ob.attr]
["string"]
Simple directives
-----------------
[QUAL_NAME]
This directive is simply replaced by the value of identifier from the data
dictionary. QUAL_NAME might be a dotted qualified name refering to some
instance attribute of objects contained in the dats dictionary.
Numbers are converted to string though.
This directive is simply replaced by the value of the qualified name.
If the value is a number it's converted to a string before being
outputted. If it is None, nothing is outputted. If it is a python file
object (i.e. any object with a "read" method), it's contents are
outputted. If it is a callback function (any callable python object
is assumed to be a callback function), it is invoked and passed an EZT
Context object as an argument.
[QUAL_NAME QUAL_NAME ...]
If the first value is a callback function, it is invoked with an EZT
Context object as a first argument, and the rest of the values as
additional arguments.
Otherwise, the first value defines a substitution format, specifying
constant text and indices of the additional arguments. The arguments
are substituted and the result is inserted into the output stream.
Example:
["abc %0 def %1 ghi %0" foo bar.baz]
Note that the first value can be any type of qualified name -- a string
constant or a variable reference. Use %% to substitute a percent sign.
Argument indices are 0-based.
[include "filename"] or [include QUAL_NAME]
This directive is replaced by content of the named include file.
This directive is replaced by content of the named include file. Note
that a string constant is more efficient -- the target file is compiled
inline. In the variable form, the target file is compiled and executed
at runtime.
Block directives
----------------
@@ -79,40 +140,67 @@ Directives
[for QUAL_NAME] ... [end]
The text within the [for ...] directive and the corresponding [end]
is repeated for each element in the sequence referred to by the qualified
name in the for directive. Within the for block this identifiers now
refers to the actual item indexed by this loop iteration.
is repeated for each element in the sequence referred to by the
qualified name in the for directive. Within the for block this
identifiers now refers to the actual item indexed by this loop
iteration.
[if-any QUAL_NAME] ... [else] ... [end]
[if-any QUAL_NAME [QUAL_NAME2 ...]] ... [else] ... [end]
Test if the value QUAL_NAME is not None or an empty string or list.
The [else] clause is optional. CAUTION: Numeric values are converted to string,
so if QUAL_NAME refers to a numeric value 0, the then-clause is
substituted!
Test if any QUAL_NAME value is not None or an empty string or list.
The [else] clause is optional. CAUTION: Numeric values are
converted to string, so if QUAL_NAME refers to a numeric value 0,
the then-clause is substituted!
[if-index odd] ... [else] ... [end]
[if-index even] ... [else] ... [end]
[if-index first] ... [else] ... [end]
[if-index last] ... [else] ... [end]
[if-index NUMBER] ... [else] ... [end]
[if-index INDEX_FROM_FOR odd] ... [else] ... [end]
[if-index INDEX_FROM_FOR even] ... [else] ... [end]
[if-index INDEX_FROM_FOR first] ... [else] ... [end]
[if-index INDEX_FROM_FOR last] ... [else] ... [end]
[if-index INDEX_FROM_FOR NUMBER] ... [else] ... [end]
These five directives work similar to [if-any], but are only useful
within a [for ...]-block (see above). The odd/even directives are
for example useful to choose different background colors for adjacent rows
in a table. Similar the first/last directives might be used to
remove certain parts (for example "Diff to previous" doesn't make sense,
if there is no previous).
These five directives work similar to [if-any], but are only useful
within a [for ...]-block (see above). The odd/even directives are
for example useful to choose different background colors for
adjacent rows in a table. Similar the first/last directives might
be used to remove certain parts (for example "Diff to previous"
doesn't make sense, if there is no previous).
[is QUAL_NAME STRING] ... [else] ... [end]
[is QUAL_NAME QUAL_NAME] ... [else] ... [end]
The [is ...] directive is similar to the other conditional directives
above. But it allows to compare two value references or a value reference
with some constant string.
The [is ...] directive is similar to the other conditional
directives above. But it allows to compare two value references or
a value reference with some constant string.
[define VARIABLE] ... [end]
The [define ...] directive allows you to create and modify template
variables from within the template itself. Essentially, any data
between inside the [define ...] and its matching [end] will be
expanded using the other template parsing and output generation
rules, and then stored as a string value assigned to the variable
VARIABLE. The new (or changed) variable is then available for use
with other mechanisms such as [is ...] or [if-any ...], as long as
they appear later in the template.
[format STRING] ... [end]
The format directive controls how the values substituted into
templates are escaped before they are put into the output stream. It
has no effect on the literal text of the templates, only the output
from [QUAL_NAME ...] directives. STRING can be one of "raw" "html"
or "xml". The "raw" mode leaves the output unaltered. The "html" and
"xml" modes escape special characters using entity escapes (like
&quot; and &gt;)
[format CALLBACK]
Python applications using EZT can provide custom formatters as callback
variables. "[format CALLBACK][QUAL_NAME][end]" is in most cases
equivalent to "[CALLBACK QUAL_NAME]"
"""
#
# Copyright (C) 2001 Greg Stein. All Rights Reserved.
# Copyright (C) 2001-2007 Greg Stein. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -139,15 +227,26 @@ Directives
#
#
# This software is maintained by Greg and is available at:
# http://viewcvs.sourceforge.net/
# it is also used by the following projects:
# http://edna.sourceforge.net/
# http://svn.webdav.org/repos/projects/ezt/trunk/
#
import string
import re
from types import StringType, IntType, FloatType
from types import StringType, IntType, FloatType, LongType, TupleType
import os
import cgi
try:
import cStringIO
except ImportError:
import StringIO
cStringIO = StringIO
#
# Formatting types
#
FORMAT_RAW = 'raw'
FORMAT_HTML = 'html'
FORMAT_XML = 'xml'
#
# This regular expression matches three alternatives:
@@ -170,7 +269,7 @@ _re_parse = re.compile(r'\[(%s(?: +%s)*)\]|(\[\[\])|\[#[^\]]*\]' % (_item, _item
_re_args = re.compile(r'"(?:[^\\"]|\\.)*"|[-\w.]+')
# block commands and their argument counts
_block_cmd_specs = { 'if-any':1, 'if-index':2, 'for':1, 'is':2 }
_block_cmd_specs = { 'if-index':2, 'for':1, 'is':2, 'define':1, 'format':1 }
_block_cmds = _block_cmd_specs.keys()
# two regular expresssions for compressing whitespace. the first is used to
@@ -187,36 +286,47 @@ _re_subst = re.compile('%(%|[0-9]+)')
class Template:
def __init__(self, fname=None):
def __init__(self, fname=None, compress_whitespace=1,
base_format=FORMAT_RAW):
self.compress_whitespace = compress_whitespace
if fname:
self.parse_file(fname)
self.parse_file(fname, base_format)
def parse_file(self, fname):
"""fname -> a string object with pathname of file containg an EZT template.
def parse_file(self, fname, base_format=FORMAT_RAW):
"fname -> a string object with pathname of file containg an EZT template."
self.parse(_FileReader(fname), base_format)
def parse(self, text_or_reader, base_format=FORMAT_RAW):
"""Parse the template specified by text_or_reader.
The argument should be a string containing the template, or it should
specify a subclass of ezt.Reader which can read templates. The base
format for printing values is given by base_format.
"""
self.program = self._parse_file(fname)
if not isinstance(text_or_reader, Reader):
# assume the argument is a plain text string
text_or_reader = _TextReader(text_or_reader)
def parse(self, text):
"""text -> a string object containing the HTML template.
parse the template program into: (TEXT DIRECTIVE BRACKET)* TEXT
DIRECTIVE will be '[directive]' or None
BRACKET will be '[[]' or None
"""
self.program = self._parse(text)
self.program = self._parse(text_or_reader, base_format=base_format)
def generate(self, fp, data):
ctx = _context()
if hasattr(data, '__getitem__') or callable(getattr(data, 'keys', None)):
# a dictionary-like object was passed. convert it to an
# attribute-based object.
class _data_ob:
def __init__(self, d):
vars(self).update(d)
data = _data_ob(data)
ctx = Context(fp)
ctx.data = data
ctx.for_index = { }
self._execute(self.program, fp, ctx)
ctx.for_iterators = { }
ctx.defines = { }
self._execute(self.program, ctx)
def _parse_file(self, fname, for_names=None, file_args=()):
return self._parse(open(fname, "rt").read(), for_names, file_args,
os.path.dirname(fname))
def _parse(self, text, for_names=None, file_args=(), base=None):
"""text -> string object containing the HTML template.
def _parse(self, reader, for_names=None, file_args=(), base_format=None):
"""text -> string object containing the template.
This is a private helper function doing the real work for method parse.
It returns the parsed template as a 'program'. This program is a sequence
@@ -225,12 +335,16 @@ class Template:
Note: comment directives [# ...] are automatically dropped by _re_parse.
"""
parts = _re_parse.split(text)
# parse the template program into: (TEXT DIRECTIVE BRACKET)* TEXT
parts = _re_parse.split(reader.text)
program = [ ]
stack = [ ]
if not for_names:
for_names = [ ]
for_names = [ ]
if base_format:
program.append((self._cmd_format, _printers[base_format]))
for i in range(len(parts)):
piece = parts[i]
@@ -238,7 +352,8 @@ class Template:
if which == 0:
# TEXT. append if non-empty.
if piece:
piece = _re_whitespace.sub(' ', _re_newline.sub('\n', piece))
if self.compress_whitespace:
piece = _re_whitespace.sub(' ', _re_newline.sub('\n', piece))
program.append(piece)
elif which == 2:
# BRACKET directive. append '[' if present.
@@ -250,7 +365,7 @@ class Template:
cmd = args[0]
if cmd == 'else':
if len(args) > 1:
raise ArgCountSyntaxError()
raise ArgCountSyntaxError(str(args[1:]))
### check: don't allow for 'for' cmd
idx = stack[-1][1]
true_section = program[idx:]
@@ -258,133 +373,138 @@ class Template:
stack[-1][3] = true_section
elif cmd == 'end':
if len(args) > 1:
raise ArgCountSyntaxError()
raise ArgCountSyntaxError(str(args[1:]))
# note: true-section may be None
cmd, idx, args, true_section = stack.pop()
try:
cmd, idx, args, true_section = stack.pop()
except IndexError:
raise UnmatchedEndError()
else_section = program[idx:]
func = getattr(self, '_cmd_' + re.sub('-', '_', cmd))
program[idx:] = [ (func, (args, true_section, else_section)) ]
if cmd == 'for':
for_names.pop()
if cmd == 'format':
program.append((self._cmd_end_format, None))
else:
func = getattr(self, '_cmd_' + re.sub('-', '_', cmd))
program[idx:] = [ (func, (args, true_section, else_section)) ]
if cmd == 'for':
for_names.pop()
elif cmd in _block_cmds:
if len(args) > _block_cmd_specs[cmd] + 1:
raise ArgCountSyntaxError()
### this assumes arg1 is always a ref
args[1] = _prepare_ref(args[1], for_names, file_args)
raise ArgCountSyntaxError(str(args[1:]))
### this assumes arg1 is always a ref unless cmd is 'define'
if cmd != 'define':
args[1] = _prepare_ref(args[1], for_names, file_args)
# handle arg2 for the 'is' command
if cmd == 'is':
args[2] = _prepare_ref(args[2], for_names, file_args)
elif cmd == 'for':
for_names.append(args[1][0])
for_names.append(args[1][0]) # append the refname
elif cmd == 'format':
if args[1][0]:
# argument is a variable reference
printer = args[1]
else:
# argument is a string constant referring to built-in printer
printer = _printers.get(args[1][1])
if not printer:
raise UnknownFormatConstantError(str(args[1:]))
program.append((self._cmd_format, printer))
# remember the cmd, current pos, args, and a section placeholder
stack.append([cmd, len(program), args[1:], None])
elif cmd == 'include':
if args[1][0] == '"':
include_filename = args[1][1:-1]
if base:
include_filename = os.path.join(base, include_filename)
f_args = [ ]
for arg in args[2:]:
f_args.append(_prepare_ref(arg, for_names, file_args))
program.extend(self._parse_file(include_filename, for_names,
f_args))
program.extend(self._parse(reader.read_other(include_filename),
for_names, f_args))
else:
if len(args) != 2:
raise ArgCountSyntaxError()
raise ArgCountSyntaxError(str(args))
program.append((self._cmd_include,
(_prepare_ref(args[1], for_names, file_args),
base)))
reader)))
elif cmd == 'if-any':
f_args = [ ]
for arg in args[1:]:
f_args.append(_prepare_ref(arg, for_names, file_args))
stack.append(['if-any', len(program), f_args, None])
else:
# implied PRINT command
if len(args) > 1:
f_args = [ ]
for arg in args:
f_args.append(_prepare_ref(arg, for_names, file_args))
program.append((self._cmd_format, (f_args[0], f_args[1:])))
else:
program.append((self._cmd_print,
_prepare_ref(args[0], for_names, file_args)))
f_args = [ ]
for arg in args:
f_args.append(_prepare_ref(arg, for_names, file_args))
program.append((self._cmd_print, f_args))
if stack:
### would be nice to say which blocks...
raise UnclosedBlocksError()
return program
def _execute(self, program, fp, ctx):
def _execute(self, program, ctx):
"""This private helper function takes a 'program' sequence as created
by the method '_parse' and executes it step by step. strings are written
to the file object 'fp' and functions are called.
"""
for step in program:
if isinstance(step, StringType):
fp.write(step)
ctx.fp.write(step)
else:
step[0](step[1], fp, ctx)
step[0](step[1], ctx)
def _cmd_print(self, valref, fp, ctx):
value = _get_value(valref, ctx)
def _cmd_print(self, valrefs, ctx):
value = _get_value(valrefs[0], ctx)
args = map(lambda valref, ctx=ctx: _get_value(valref, ctx), valrefs[1:])
_write_value(value, args, ctx)
# if the value has a 'read' attribute, then it is a stream: copy it
if hasattr(value, 'read'):
while 1:
chunk = value.read(16384)
if not chunk:
break
fp.write(chunk)
else:
fp.write(value)
def _cmd_format(self, printer, ctx):
if type(printer) is TupleType:
printer = _get_value(printer, ctx)
ctx.printers.append(printer)
def _cmd_format(self, (valref, args), fp, ctx):
fmt = _get_value(valref, ctx)
parts = _re_subst.split(fmt)
for i in range(len(parts)):
piece = parts[i]
if i%2 == 1 and piece != '%':
idx = int(piece)
if idx < len(args):
piece = _get_value(args[idx], ctx)
else:
piece = '<undef>'
fp.write(piece)
def _cmd_end_format(self, valref, ctx):
ctx.printers.pop()
def _cmd_include(self, (valref, base), fp, ctx):
def _cmd_include(self, (valref, reader), ctx):
fname = _get_value(valref, ctx)
if base:
fname = os.path.join(base, fname)
### note: we don't have the set of for_names to pass into this parse.
### I don't think there is anything to do but document it.
self._execute(self._parse_file(fname), fp, ctx)
self._execute(self._parse(reader.read_other(fname)), ctx)
def _cmd_if_any(self, args, fp, ctx):
"If the value is a non-empty string or non-empty list, then T else F."
((valref,), t_section, f_section) = args
value = _get_value(valref, ctx)
self._do_if(value, t_section, f_section, fp, ctx)
def _cmd_if_any(self, args, ctx):
"If any value is a non-empty string or non-empty list, then T else F."
(valrefs, t_section, f_section) = args
value = 0
for valref in valrefs:
if _get_value(valref, ctx):
value = 1
break
self._do_if(value, t_section, f_section, ctx)
def _cmd_if_index(self, args, fp, ctx):
def _cmd_if_index(self, args, ctx):
((valref, value), t_section, f_section) = args
list, idx = ctx.for_index[valref[0]]
iterator = ctx.for_iterators[valref[0]]
if value == 'even':
value = idx % 2 == 0
value = iterator.index % 2 == 0
elif value == 'odd':
value = idx % 2 == 1
value = iterator.index % 2 == 1
elif value == 'first':
value = idx == 0
value = iterator.index == 0
elif value == 'last':
value = idx == len(list)-1
value = iterator.is_last()
else:
value = idx == int(value)
self._do_if(value, t_section, f_section, fp, ctx)
value = iterator.index == int(value)
self._do_if(value, t_section, f_section, ctx)
def _cmd_is(self, args, fp, ctx):
def _cmd_is(self, args, ctx):
((left_ref, right_ref), t_section, f_section) = args
value = _get_value(right_ref, ctx)
value = string.lower(_get_value(left_ref, ctx)) == string.lower(value)
self._do_if(value, t_section, f_section, fp, ctx)
self._do_if(value, t_section, f_section, ctx)
def _do_if(self, value, t_section, f_section, fp, ctx):
def _do_if(self, value, t_section, f_section, ctx):
if t_section is None:
t_section = f_section
f_section = None
@@ -393,19 +513,27 @@ class Template:
else:
section = f_section
if section is not None:
self._execute(section, fp, ctx)
self._execute(section, ctx)
def _cmd_for(self, args, fp, ctx):
def _cmd_for(self, args, ctx):
((valref,), unused, section) = args
list = _get_value(valref, ctx)
if isinstance(list, StringType):
raise NeedSequenceError()
refname = valref[0]
ctx.for_index[refname] = idx = [ list, 0 ]
for item in list:
self._execute(section, fp, ctx)
idx[1] = idx[1] + 1
del ctx.for_index[refname]
ctx.for_iterators[refname] = iterator = _iter(list)
for unused in iterator:
self._execute(section, ctx)
del ctx.for_iterators[refname]
def _cmd_define(self, args, ctx):
((name,), unused, section) = args
origfp = ctx.fp
ctx.fp = cStringIO.StringIO()
if section is not None:
self._execute(section, ctx)
ctx.defines[name] = ctx.fp.getvalue()
ctx.fp = origfp
def boolean(value):
"Return a value suitable for [if-any bool_var] usage in a template."
@@ -418,34 +546,48 @@ def _prepare_ref(refname, for_names, file_args):
"""refname -> a string containing a dotted identifier. example:"foo.bar.bang"
for_names -> a list of active for sequences.
Returns a `value reference', a 3-Tupel made out of (refname, start, rest),
Returns a `value reference', a 3-tuple made out of (refname, start, rest),
for fast access later.
"""
# is the reference a string constant?
if refname[0] == '"':
return None, refname[1:-1], None
parts = string.split(refname, '.')
start = parts[0]
rest = parts[1:]
# if this is an include-argument, then just return the prepared ref
if refname[:3] == 'arg':
if start[:3] == 'arg':
try:
idx = int(refname[3:])
idx = int(start[3:])
except ValueError:
pass
else:
if idx < len(file_args):
return file_args[idx]
orig_refname, start, more_rest = file_args[idx]
if more_rest is None:
# the include-argument was a string constant
return None, start, None
# prepend the argument's "rest" for our further processing
rest[:0] = more_rest
# rewrite the refname to ensure that any potential 'for' processing
# has the correct name
### this can make it hard for debugging include files since we lose
### the 'argNNN' names
if not rest:
return start, start, [ ]
refname = start + '.' + string.join(rest, '.')
if for_names:
# From last to first part, check if this reference is part of a for loop
for i in range(len(parts), 0, -1):
name = string.join(parts[:i], '.')
if name in for_names:
return refname, name, parts[i:]
parts = string.split(refname, '.')
start = parts[0]
rest = parts[1:]
while rest and (start in for_names):
# check if the next part is also a "for name"
name = start + '.' + rest[0]
if name in for_names:
start = name
del rest[0]
else:
break
return refname, start, rest
def _get_value((refname, start, rest), ctx):
@@ -459,11 +601,14 @@ def _get_value((refname, start, rest), ctx):
if rest is None:
# it was a string constant
return start
if ctx.for_index.has_key(start):
list, idx = ctx.for_index[start]
ob = list[idx]
elif ctx.data.has_key(start):
ob = ctx.data[start]
# get the starting object
if ctx.for_iterators.has_key(start):
ob = ctx.for_iterators[start].last_item
elif ctx.defines.has_key(start):
ob = ctx.defines[start]
elif hasattr(ctx.data, start):
ob = getattr(ctx.data, start)
else:
raise UnknownReference(refname)
@@ -475,7 +620,9 @@ def _get_value((refname, start, rest), ctx):
raise UnknownReference(refname)
# make sure we return a string instead of some various Python types
if isinstance(ob, IntType) or isinstance(ob, FloatType):
if isinstance(ob, IntType) \
or isinstance(ob, LongType) \
or isinstance(ob, FloatType):
return str(ob)
if ob is None:
return ''
@@ -483,20 +630,173 @@ def _get_value((refname, start, rest), ctx):
# string or a sequence
return ob
class _context:
def _write_value(value, args, ctx):
# value is a callback function, generates its own output
if callable(value):
apply(value, [ctx] + list(args))
return
# pop printer in case it recursively calls _write_value
printer = ctx.printers.pop()
try:
# if the value has a 'read' attribute, then it is a stream: copy it
if hasattr(value, 'read'):
while 1:
chunk = value.read(16384)
if not chunk:
break
printer(ctx, chunk)
# value is a substitution pattern
elif args:
parts = _re_subst.split(value)
for i in range(len(parts)):
piece = parts[i]
if i%2 == 1 and piece != '%':
idx = int(piece)
if idx < len(args):
piece = args[idx]
else:
piece = '<undef>'
printer(ctx, piece)
# plain old value, write to output
else:
printer(ctx, value)
finally:
ctx.printers.append(printer)
class Context:
"""A container for the execution context"""
def __init__(self, fp):
self.fp = fp
self.printers = []
def write(self, value, args=()):
_write_value(value, args, self)
class ArgCountSyntaxError(Exception):
pass
class Reader:
"Abstract class which allows EZT to detect Reader objects."
class UnknownReference(Exception):
pass
class _FileReader(Reader):
"""Reads templates from the filesystem."""
def __init__(self, fname):
self.text = open(fname, 'rb').read()
self._dir = os.path.dirname(fname)
def read_other(self, relative):
return _FileReader(os.path.join(self._dir, relative))
class NeedSequenceError(Exception):
pass
class _TextReader(Reader):
"""'Reads' a template from provided text."""
def __init__(self, text):
self.text = text
def read_other(self, relative):
raise BaseUnavailableError()
class UnclosedBlocksError(Exception):
pass
class _Iterator:
"""Specialized iterator for EZT that counts items and can look ahead
Implements standard iterator interface and provides an is_last() method
and two public members:
index - integer index of the current item
last_item - last item returned by next()"""
def __init__(self, sequence):
self._iter = iter(sequence)
def next(self):
if hasattr(self, '_next_item'):
self.last_item = self._next_item
del self._next_item
else:
self.last_item = self._iter.next() # may raise StopIteration
if hasattr(self, 'index'):
self.index = self.index + 1
else:
self.index = 0
return self.last_item
def is_last(self):
"""Return true if the current item is the last in the sequence"""
# the only way we can tell if the current item is last is to call next()
# and store the return value so it doesn't get lost
if not hasattr(self, '_next_item'):
try:
self._next_item = self._iter.next()
except StopIteration:
return 1
return 0
def __iter__(self):
return self
class _OldIterator:
"""Alternate implemention of _Iterator for old Pythons without iterators
This class implements the sequence protocol, instead of the iterator
interface, so it's really not an iterator at all. But it can be used in
python "for" loops as a drop-in replacement for _Iterator. It also provides
the is_last() method and "last_item" and "index" members described in the
_Iterator docstring."""
def __init__(self, sequence):
self._seq = sequence
def __getitem__(self, index):
self.last_item = self._seq[index] # may raise IndexError
self.index = index
return self.last_item
def is_last(self):
return self.index + 1 >= len(self._seq)
try:
iter
except NameError:
_iter = _OldIterator
else:
_iter = _Iterator
class EZTException(Exception):
"""Parent class of all EZT exceptions."""
class ArgCountSyntaxError(EZTException):
"""A bracket directive got the wrong number of arguments."""
class UnknownReference(EZTException):
"""The template references an object not contained in the data dictionary."""
class NeedSequenceError(EZTException):
"""The object dereferenced by the template is no sequence (tuple or list)."""
class UnclosedBlocksError(EZTException):
"""This error may be simply a missing [end]."""
class UnmatchedEndError(EZTException):
"""This error may be caused by a misspelled if directive."""
class BaseUnavailableError(EZTException):
"""Base location is unavailable, which disables includes."""
class UnknownFormatConstantError(EZTException):
"""The format specifier is an unknown value."""
def _raw_printer(ctx, s):
ctx.fp.write(s)
def _html_printer(ctx, s):
ctx.fp.write(cgi.escape(s))
_printers = {
FORMAT_RAW : _raw_printer,
FORMAT_HTML : _html_printer,
FORMAT_XML : _html_printer,
}
# --- standard test environment ---
def test_parse():

190
lib/idiff.py Normal file
View File

@@ -0,0 +1,190 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# idiff: display differences between files highlighting intraline changes
#
# -----------------------------------------------------------------------
from __future__ import generators
import difflib
import sys
import re
import ezt
import cgi
def sidebyside(fromlines, tolines, context):
"""Generate side by side diff"""
### for some reason mdiff chokes on \n's in input lines
line_strip = lambda line: line.rstrip("\n")
fromlines = map(line_strip, fromlines)
tolines = map(line_strip, tolines)
gap = False
for fromdata, todata, flag in difflib._mdiff(fromlines, tolines, context):
if fromdata is None and todata is None and flag is None:
gap = True
else:
from_item = _mdiff_split(flag, fromdata)
to_item = _mdiff_split(flag, todata)
yield _item(gap=ezt.boolean(gap), columns=(from_item, to_item))
gap = False
_re_mdiff = re.compile("\0([+-^])(.*?)\1")
def _mdiff_split(flag, (line_number, text)):
"""Break up row from mdiff output into segments"""
segments = []
pos = 0
while True:
m = _re_mdiff.search(text, pos)
if not m:
segments.append(_item(text=cgi.escape(text[pos:]), type=None))
break
if m.start() > pos:
segments.append(_item(text=cgi.escape(text[pos:m.start()]), type=None))
if m.group(1) == "+":
segments.append(_item(text=cgi.escape(m.group(2)), type="add"))
elif m.group(1) == "-":
segments.append(_item(text=cgi.escape(m.group(2)), type="remove"))
elif m.group(1) == "^":
segments.append(_item(text=cgi.escape(m.group(2)), type="change"))
pos = m.end()
return _item(segments=segments, line_number=line_number)
def unified(fromlines, tolines, context):
"""Generate unified diff"""
diff = difflib.Differ().compare(fromlines, tolines)
lastrow = None
for row in _trim_context(diff, context):
if row[0].startswith("? "):
yield _differ_split(lastrow, row[0])
lastrow = None
else:
if lastrow:
yield _differ_split(lastrow, None)
lastrow = row
if lastrow:
yield _differ_split(lastrow, None)
def _trim_context(lines, context_size):
"""Trim context lines that don't surround changes from Differ results
yields (line, leftnum, rightnum, gap) tuples"""
# circular buffer to hold context lines
context_buffer = [None] * (context_size or 0)
context_start = context_len = 0
# number of context lines left to print after encountering a change
context_owed = 0
# current line numbers
leftnum = rightnum = 0
# whether context lines have been dropped
gap = False
for line in lines:
row = save = None
if line.startswith("- "):
leftnum = leftnum + 1
row = line, leftnum, None
context_owed = context_size
elif line.startswith("+ "):
rightnum = rightnum + 1
row = line, None, rightnum
context_owed = context_size
else:
if line.startswith(" "):
leftnum = leftnum = leftnum + 1
rightnum = rightnum = rightnum + 1
if context_owed > 0:
context_owed = context_owed - 1
elif context_size is not None:
save = True
row = line, leftnum, rightnum
if save:
# don't yield row right away, store it in buffer
context_buffer[(context_start + context_len) % context_size] = row
if context_len == context_size:
context_start = (context_start + 1) % context_size
gap = True
else:
context_len = context_len + 1
else:
# yield row, but first drain stuff in buffer
context_len == context_size
while context_len:
yield context_buffer[context_start] + (gap,)
gap = False
context_start = (context_start + 1) % context_size
context_len = context_len - 1
yield row + (gap,)
gap = False
_re_differ = re.compile(r"[+-^]+")
def _differ_split(row, guide):
"""Break row into segments using guide line"""
line, left_number, right_number, gap = row
if left_number and right_number:
type = ""
elif left_number:
type = "remove"
elif right_number:
type = "add"
segments = []
pos = 2
if guide:
assert guide.startswith("? ")
for m in _re_differ.finditer(guide, pos):
if m.start() > pos:
segments.append(_item(text=cgi.escape(line[pos:m.start()]), type=None))
segments.append(_item(text=cgi.escape(line[m.start():m.end()]),
type="change"))
pos = m.end()
segments.append(_item(text=cgi.escape(line[pos:]), type=None))
return _item(gap=ezt.boolean(gap), type=type, segments=segments,
left_number=left_number, right_number=right_number)
class _item:
def __init__(self, **kw):
vars(self).update(kw)
try:
### Using difflib._mdiff function here was the easiest way of obtaining
### intraline diffs for use in ViewVC, but it doesn't exist prior to
### Python 2.4 and is not part of the public difflib API, so for now
### fall back if it doesn't exist.
difflib._mdiff
except AttributeError:
sidebyside = None

View File

@@ -1,13 +1,12 @@
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
@@ -19,12 +18,63 @@
# the arguments.
#
# -----------------------------------------------------------------------
#
import os
import sys
import sapi
import threading
import string
if sys.platform == "win32":
import win32popen
import win32event
import win32process
import debug
import StringIO
def popen(cmd, args, mode, capture_err=1):
if sys.platform == "win32":
command = win32popen.CommandLine(cmd, args)
if string.find(mode, 'r') >= 0:
hStdIn = None
if debug.SHOW_CHILD_PROCESSES:
dbgIn, dbgOut = None, StringIO.StringIO()
handle, hStdOut = win32popen.MakeSpyPipe(0, 1, (dbgOut,))
if capture_err:
hStdErr = hStdOut
dbgErr = dbgOut
else:
dbgErr = StringIO.StringIO()
x, hStdErr = win32popen.MakeSpyPipe(None, 1, (dbgErr,))
else:
handle, hStdOut = win32popen.CreatePipe(0, 1)
if capture_err:
hStdErr = hStdOut
else:
hStdErr = win32popen.NullFile(1)
else:
if debug.SHOW_CHILD_PROCESSES:
dbgIn, dbgOut, dbgErr = StringIO.StringIO(), StringIO.StringIO(), StringIO.StringIO()
hStdIn, handle = win32popen.MakeSpyPipe(1, 0, (dbgIn,))
x, hStdOut = win32popen.MakeSpyPipe(None, 1, (dbgOut,))
x, hStdErr = win32popen.MakeSpyPipe(None, 1, (dbgErr,))
else:
hStdIn, handle = win32popen.CreatePipe(0, 1)
hStdOut = None
hStdErr = None
phandle, pid, thandle, tid = win32popen.CreateProcess(command, hStdIn, hStdOut, hStdErr)
if debug.SHOW_CHILD_PROCESSES:
debug.Process(command, dbgIn, dbgOut, dbgErr)
return _pipe(win32popen.File2FileObject(handle, mode), phandle)
# flush the stdio buffers since we are about to change the FD under them
sys.stdout.flush()
sys.stderr.flush()
@@ -35,18 +85,18 @@ def popen(cmd, args, mode, capture_err=1):
# in the parent
# close the descriptor that we don't need and return the other one.
if mode == 'r':
if string.find(mode, 'r') >= 0:
os.close(w)
return _pipe(os.fdopen(r, 'r'), pid)
return _pipe(os.fdopen(r, mode), pid)
os.close(r)
return _pipe(os.fdopen(w, 'w'), pid)
return _pipe(os.fdopen(w, mode), pid)
# in the child
# we'll need /dev/null for the discarded I/O
null = os.open('/dev/null', os.O_RDWR)
if mode == 'r':
if string.find(mode, 'r') >= 0:
# hook stdout/stderr to the "write" channel
os.dup2(w, 1)
# "close" stdin; the child shouldn't use it
@@ -75,14 +125,82 @@ def popen(cmd, args, mode, capture_err=1):
os.execvp(cmd, (cmd,) + tuple(args))
except:
# aid debugging, if the os.execvp above fails for some reason:
import string
print "<h2>exec failed:</h2><pre>", cmd, string.join(args), "</pre>"
raise
# crap. shouldn't be here.
sys.exit(127)
def pipe_cmds(cmds):
def pipe_cmds(cmds, out=None):
"""Executes a sequence of commands. The output of each command is directed to
the input of the next command. A _pipe object is returned for writing to the
first command's input. The output of the last command is directed to the
"out" file object or the standard output if "out" is None. If "out" is not an
OS file descriptor, a separate thread will be spawned to send data to its
write() method."""
if out is None:
out = sys.stdout
if sys.platform == "win32":
### FIXME: windows implementation ignores "out" argument, always
### writing last command's output to standard out
if debug.SHOW_CHILD_PROCESSES:
dbgIn = StringIO.StringIO()
hStdIn, handle = win32popen.MakeSpyPipe(1, 0, (dbgIn,))
i = 0
for cmd in cmds:
i = i + 1
dbgOut, dbgErr = StringIO.StringIO(), StringIO.StringIO()
if i < len(cmds):
nextStdIn, hStdOut = win32popen.MakeSpyPipe(1, 1, (dbgOut,))
x, hStdErr = win32popen.MakeSpyPipe(None, 1, (dbgErr,))
else:
ehandle = win32event.CreateEvent(None, 1, 0, None)
nextStdIn, hStdOut = win32popen.MakeSpyPipe(None, 1, (dbgOut, sapi.server.file()), ehandle)
x, hStdErr = win32popen.MakeSpyPipe(None, 1, (dbgErr,))
command = win32popen.CommandLine(cmd[0], cmd[1:])
phandle, pid, thandle, tid = win32popen.CreateProcess(command, hStdIn, hStdOut, hStdErr)
if debug.SHOW_CHILD_PROCESSES:
debug.Process(command, dbgIn, dbgOut, dbgErr)
dbgIn = dbgOut
hStdIn = nextStdIn
else:
hStdIn, handle = win32popen.CreatePipe(1, 0)
spool = None
i = 0
for cmd in cmds:
i = i + 1
if i < len(cmds):
nextStdIn, hStdOut = win32popen.CreatePipe(1, 1)
else:
# very last process
nextStdIn = None
if sapi.server.inheritableOut:
# send child output to standard out
hStdOut = win32popen.MakeInheritedHandle(win32popen.FileObject2File(sys.stdout),0)
ehandle = None
else:
ehandle = win32event.CreateEvent(None, 1, 0, None)
x, hStdOut = win32popen.MakeSpyPipe(None, 1, (sapi.server.file(),), ehandle)
command = win32popen.CommandLine(cmd[0], cmd[1:])
phandle, pid, thandle, tid = win32popen.CreateProcess(command, hStdIn, hStdOut, None)
hStdIn = nextStdIn
return _pipe(win32popen.File2FileObject(handle, 'wb'), phandle, ehandle)
# flush the stdio buffers since we are about to change the FD under them
sys.stdout.flush()
sys.stderr.flush()
@@ -91,6 +209,8 @@ def pipe_cmds(cmds):
null = os.open('/dev/null', os.O_RDWR)
child_pids = []
for cmd in cmds[:-1]:
r, w = os.pipe()
pid = os.fork()
@@ -122,6 +242,7 @@ def pipe_cmds(cmds):
sys.exit(127)
# in the parent
child_pids.append(pid)
# we don't need these any more
os.close(prev_r)
@@ -133,7 +254,10 @@ def pipe_cmds(cmds):
# no longer needed
os.close(null)
# done with most of the commands. set up the last command to write to stdout
# done with most of the commands. set up the last command to write to "out"
if not hasattr(out, 'fileno'):
r, w = os.pipe()
pid = os.fork()
if not pid:
# in the child (the last command)
@@ -141,6 +265,18 @@ def pipe_cmds(cmds):
# hook up stdin to the "read" channel
os.dup2(prev_r, 0)
# hook up stdout to "out"
if hasattr(out, 'fileno'):
if out.fileno() != 1:
os.dup2(out.fileno(), 1)
out.close()
else:
# "out" can't be hooked up directly, so use a pipe and a thread
os.dup2(w, 1)
os.close(r)
os.close(w)
# close these extra descriptors
os.close(prev_r)
os.close(parent_w)
@@ -153,21 +289,64 @@ def pipe_cmds(cmds):
sys.exit(127)
child_pids.append(pid)
# not needed any more
os.close(prev_r)
# write into the first pipe, wait on the final process
return _pipe(os.fdopen(parent_w, 'w'), pid)
if not hasattr(out, 'fileno'):
os.close(w)
thread = _copy(r, out)
thread.start()
else:
thread = None
# write into the first pipe, wait on the final process
return _pipe(os.fdopen(parent_w, 'w'), child_pids, thread=thread)
class _copy(threading.Thread):
def __init__(self, srcfd, destfile):
self.srcfd = srcfd
self.destfile = destfile
threading.Thread.__init__(self)
def run(self):
try:
while 1:
s = os.read(self.srcfd, 1024)
if not s:
break
self.destfile.write(s)
finally:
os.close(self.srcfd)
class _pipe:
"Wrapper for a file which can wait() on a child process at close time."
def __init__(self, file, child_pid):
def __init__(self, file, child_pid, done_event = None, thread = None):
self.file = file
self.child_pid = child_pid
if sys.platform == "win32":
if done_event:
self.wait_for = (child_pid, done_event)
else:
self.wait_for = (child_pid,)
else:
self.thread = thread
def eof(self):
### should be calling file.eof() here instead of file.close(), there
### may be data in the pipe or buffer after the process exits
if sys.platform == "win32":
r = win32event.WaitForMultipleObjects(self.wait_for, 1, 0)
if r == win32event.WAIT_OBJECT_0:
self.file.close()
self.file = None
return win32process.GetExitCodeProcess(self.child_pid)
return None
if self.thread and self.thread.isAlive():
return None
pid, status = os.waitpid(self.child_pid, os.WNOHANG)
if pid:
self.file.close()
@@ -179,12 +358,22 @@ class _pipe:
if self.file:
self.file.close()
self.file = None
return os.waitpid(self.child_pid, 0)[1]
if sys.platform == "win32":
win32event.WaitForMultipleObjects(self.wait_for, 1, win32event.INFINITE)
return win32process.GetExitCodeProcess(self.child_pid)
else:
if self.thread:
self.thread.join()
if type(self.child_pid) == type([]):
for pid in self.child_pid:
exit = os.waitpid(pid, 0)[1]
return exit
else:
return os.waitpid(self.child_pid, 0)[1]
return None
def __getattr__(self, name):
return getattr(self.file, name)
def __del__(self):
if self.file:
self.close()
self.close()

612
lib/py2html.py Normal file → Executable file
View File

@@ -1,6 +1,6 @@
#!/usr/local/bin/python -u
#!/usr/bin/python -u
""" Python Highlighter for HTML Version: 0.5
""" Python Highlighter Version: 0.8
py2html.py [options] files...
@@ -10,8 +10,8 @@
-stdout read from files, write to stdout
-files read from files, write to filename+'.html' (default)
-format:
html output HTML page (default)
rawhtml output pure HTML (without headers, titles, etc.)
html output XHTML page (default)
rawhtml output pure XHTML (without headers, titles, etc.)
-mode:
color output in color (default)
mono output b/w (for printing)
@@ -20,12 +20,12 @@
-header:file use contents of file as header
-footer:file use contents of file as footer
-URL replace all occurances of 'URL: link' with
'<A HREF="link">link</A>'; this is always enabled
in CGI mode
'<a href="link">link</a>'; this is always enabled
in CGI mode
-v verbose
Takes the input, assuming it is Python code and formats it into
colored HTML. When called without parameters the script tries to
colored XHTML. When called without parameters the script tries to
work in CGI mode. It looks for a field 'script=URL' and tries to
use that URL as input file. If it can't find this field, the path
info (the part of the URL following the CGI script name) is
@@ -34,47 +34,43 @@
* Uses Just van Rossum's PyFontify version 0.3 to tag Python scripts.
You can get it via his homepage on starship:
URL: http://starship.skyport.net/crew/just
URL: http://starship.python.net/crew/just
"""
__comments__ = """
The following snippet is a small shell script I use for viewing
Python scripts per less on Unix:
Python scripts via less on Unix:
pyless:
#!/bin/sh
# Browse pretty printed Python code using ANSI codes for highlighting
py2html -stdout -format:ansi -mode:mono $* | less -r
py2html -stdout -format:ansi -mode:color $* | less -r
History:
0.8: Added patch by Patrick Lynch to have py2html.py use style
sheets for markup
0.7: Added patch by Ville Skytt<74> to make py2html.py output
valid XHTML.
0.6: Fixed a bug in .escape_html(); thanks to Vespe Savikko for
finding this one.
0.5: Added a few suggestions by Kevin Ng to make the CGI version
a little more robust.
"""
__copyright__ = """
-----------------------------------------------------------------------------
(c) Copyright by Marc-Andre Lemburg, 1998 (mailto:mal@lemburg.com)
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee or royalty is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation or portions thereof, including modifications,
that you make.
THE AUTHOR MARC-ANDRE LEMBURG DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
__copyright__ = """\
Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
Copyright (c) 2000-2002, eGenix.com Software GmbH; mailto:info@egenix.com
Distributed under the terms and conditions of the eGenix.com Public
License. See http://www.egenix.com/files/python/mxLicense.html for
details, or contact the author. All Rights Reserved.\
"""
__version__ = '0.5'
__version__ = '0.8'
__cgifooter__ = ('\n<PRE># code highlighted using <A HREF='
'"http://starship.skyport.net/~lemburg/">py2html.py</A> '
'version %s</PRE>\n' % __version__)
__cgifooter__ = ('\n<pre># code highlighted using <a href='
'"http://www.lemburg.com/files/python/">py2html.py</a> '
'version %s</pre>\n' % __version__)
import sys,string,re
@@ -86,21 +82,25 @@ sys.path.append('.')
# URL of the input form the user is redirected to in case no script=xxx
# form field is given. The URL *must* be absolute. Leave blank to
# have the script issue an error instead.
INPUT_FORM = 'http://starship.skyport.net/~lemburg/SoftwareDescriptions.html#py2html.py'
INPUT_FORM = 'http://www.lemburg.com/files/python/SoftwareDescriptions.html#py2html.py'
# HTML DOCTYPE and XML namespace
HTML_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
HTML_XMLNS = ' xmlns="http://www.w3.org/1999/xhtml"'
### Helpers
def fileio(file, mode='rb', data=None, close=0):
if type(file) == type(''):
f = open(file,mode)
close = 1
f = open(file,mode)
close = 1
else:
f = file
f = file
if data:
f.write(data)
f.write(data)
else:
data = f.read()
data = f.read()
if close: f.close()
return data
@@ -112,35 +112,36 @@ class PrettyPrint:
* supports tagging Python scripts in the following ways:
# format/mode | color mono
# --------------------------
# rawhtml | x x (HTML without headers, etc.)
# html | x x (a HTML page with HEAD&BODY:)
# ansi | x (with Ansi-escape sequences)
# format/mode | color mono
# --------------------------
# rawhtml | x x (HTML without headers, etc.)
# html | x x (a HTML page with HEAD&BODY:)
# ansi | x x (with Ansi-escape sequences)
* interfaces:
* interfaces:
file_filter -- takes two files: input & output (may be stdin/stdout)
filter -- takes a string and returns the highlighted version
* to create an instance use:
file_filter -- takes two files: input & output (may be stdin/stdout)
filter -- takes a string and returns the highlighted version
c = PrettyPrint(tagfct,format,mode)
* to create an instance use:
where format and mode must be strings according to the
above table if you plan to use PyFontify.fontify as
tagfct
c = PrettyPrint(tagfct,format,mode)
where format and mode must be strings according to the
above table if you plan to use PyFontify.fontify as
tagfct
* the tagfct has to take one argument, text, and return a taglist
(format: [(id,left,right,sublist),...], where id is the
"name" given to the slice left:right in text and sublist is a
taglist for tags inside the slice or None)
(format: [(id,left,right,sublist),...], where id is the
"name" given to the slice left:right in text and sublist is a
taglist for tags inside the slice or None)
"""
# misc settings
title = ''
bgcolor = '#FFFFFF'
css = ''
header = ''
footer = ''
replace_URLs = 0
@@ -149,19 +150,19 @@ class PrettyPrint:
def __init__(self,tagfct=None,format='html',mode='color'):
self.tag = tagfct
self.set_mode = getattr(self,'set_mode_'+format+'_'+mode)
self.filter = getattr(self,'filter_'+format)
self.set_mode()
self.tag = tagfct
self.set_mode = getattr(self,'set_mode_%s_%s' % (format, mode))
self.filter = getattr(self,'filter_%s' % format)
def file_filter(self,infile,outfile):
text = fileio(infile,'r')
if type(infile) == type('') and self.title == '':
self.title = infile
fileio(outfile,'w',self.filter(text))
self.set_mode()
text = fileio(infile,'r')
if type(infile) == type('') and self.title == '':
self.title = infile
fileio(outfile,'w',self.filter(text))
### set pre- and postfixes for formats & modes
### Set pre- and postfixes for formats & modes
#
# These methods must set self.formats to a dictionary having
# an entry for every tag returned by the tagging function.
@@ -175,134 +176,185 @@ class PrettyPrint:
def set_mode_html_color(self):
self.formats = {
'all':('<PRE>','</PRE>'),
'comment':('<FONT COLOR=#1111CC>','</FONT>'),
'keyword':('<FONT COLOR=#3333CC><B>','</B></FONT>'),
'parameter':('<FONT COLOR=#000066>','</FONT>'),
'identifier':( lambda x,strip=string.strip:
'<A NAME="%s"><FONT COLOR=#CC0000><B>' % (strip(x)),
'</B></FONT></A>'),
'string':('<FONT COLOR=#115511>','</FONT>')
}
self.css = """
<STYLE TYPE="text/css">
<!--
body{ background: %s; }
.PY_KEYWORD{ color: #0000C0; font-weight: bold; }
.PY_COMMENT{ color: #000080; }
.PY_PARAMETER{ color: #C00000; }
.PY_IDENTIFIER{ color: #C00000; font-weight: bold; }
.PY_STRING{ color: #008000; }
-->
</STYLE> """ % self.bgcolor
self.formats = {
'all':('<pre>','</pre>'),
'comment':('<span class="PY_COMMENT">','</span>'),
'keyword':('<span class="PY_KEYWORD">','</span>'),
'parameter':('<span class="PY_PARAMETER">','</span>'),
'identifier':( lambda x,strip=string.strip:
'<a name="%s"><span class="PY_IDENTIFIER">' % (strip(x)),
'</span></a>'),
'string':('<span class="PY_STRING">','</span>')
}
set_mode_rawhtml_color = set_mode_html_color
def set_mode_html_mono(self):
self.formats = {
'all':('<PRE>','</PRE>'),
'comment':('',''),
'keyword':( '<U>','</U>'),
'parameter':('',''),
'identifier':( lambda x,strip=string.strip:
'<A NAME="%s"><B>' % (strip(x)),
'</B>'),
'string':('','')
}
self.css = """
<STYLE TYPE="text/css">
<!--
body{ background-color: %s }
.PY_KEYWORD{ text-decoration: underline }
.PY_COMMENT{ }
.PY_PARAMETER{ }
.PY_IDENTIFIER{ font-weight: bold}
.PY_STRING{ font-style: italic}
-->
</STYLE> """ % self.bgcolor
self.formats = {
'all':('<pre>','</pre>'),
'comment':('<span class="PY_COMMENT">','</span>'),
'keyword':( '<span class="PY_KEYWORD">','</span>'),
'parameter':('<span class="PY_PARAMETER">','</span>'),
'identifier':( lambda x,strip=string.strip:
'<a name="%s"><span class="PY_IDENTIFIER">' % (strip(x)),
'</span></a>'),
'string':('<span class="PY_STRING">','</span>')
}
set_mode_rawhtml_mono = set_mode_html_mono
def set_mode_ansi_mono(self):
self.formats = {
'all':('',''),
'comment':('\033[2m','\033[m'),
'keyword':('\033[4m','\033[m'),
'parameter':('',''),
'identifier':('\033[1m','\033[m'),
'string':('','')
}
self.formats = {
'all':('',''),
'comment':('\033[2m','\033[m'),
'keyword':('\033[4m','\033[m'),
'parameter':('',''),
'identifier':('\033[1m','\033[m'),
'string':('','')
}
### filter for Python scripts given as string
def set_mode_ansi_color(self):
self.formats = {
'all':('',''),
'comment':('\033[34;2m','\033[m'),
'keyword':('\033[1;34m','\033[m'),
'parameter':('',''),
'identifier':('\033[1;31m','\033[m'),
'string':('\033[32;2m','\033[m')
}
### Filters for Python scripts given as string
def escape_html(self,text):
t = (('<','&lt;'),('>','&gt;'))
for x,y in t:
text = string.join(string.split(text,x),y)
return text
t = (('&','&amp;'),('<','&lt;'),('>','&gt;'))
for x,y in t:
text = string.join(string.split(text,x),y)
return text
def filter_html(self,text):
output = self.fontify(self.escape_html(text))
if self.replace_URLs:
output = re.sub('URL:([ \t]+)([^ \n\r<]+)',
'URL:\\1<A HREF="\\2">\\2</A>',output)
html = """<HTML><HEAD><TITLE>%s</TITLE></HEAD>
<BODY BGCOLOR=%s>
<!--header-->%s
<!--script-->%s
<!--footer-->%s
</BODY>\n"""%(self.title,self.bgcolor,self.header,output,self.footer)
return html
output = self.fontify(self.escape_html(text))
if self.replace_URLs:
output = re.sub('URL:([ \t]+)([^ \n\r<]+)',
'URL:\\1<a href="\\2">\\2</a>',output)
html = """%s<html%s>
<head>
<title>%s</title>
<!--css-->
%s
</head>
<body>
<!--header-->
%s
<!--script-->
%s
<!--footer-->
%s
</body></html>\n"""%(HTML_DOCTYPE,
HTML_XMLNS,
self.title,
self.css,
self.header,
output,
self.footer)
return html
def filter_rawhtml(self,text):
output = self.fontify(self.escape_html(text))
if self.replace_URLs:
output = re.sub('URL:([ \t]+)([^ \n\r<]+)',
'URL:\\1<A HREF="\\2">\\2</A>',output)
return self.header+output+self.footer
output = self.fontify(self.escape_html(text))
if self.replace_URLs:
output = re.sub('URL:([ \t]+)([^ \n\r<]+)',
'URL:\\1<a href="\\2">\\2</a>',output)
return self.header + output + self.footer
def filter_ansi(self,text):
output = self.fontify(text)
return self.header+output+self.footer
output = self.fontify(text)
return self.header + output + self.footer
### fontify engine
### Fontify engine
def fontify(self,pytext):
# parse
taglist = self.tag(pytext)
# parse
taglist = self.tag(pytext)
# prepend special 'all' tag:
taglist[:0] = [('all',0,len(pytext),None)]
# prepend special 'all' tag:
taglist[:0] = [('all',0,len(pytext),None)]
# prepare splitting
splits = []
addsplits(splits,pytext,self.formats,taglist)
# prepare splitting
splits = []
addsplits(splits,pytext,self.formats,taglist)
# do splitting & inserting
splits.sort()
l = []
li = 0
for ri,dummy,insert in splits:
if ri > li: l.append(pytext[li:ri])
l.append(insert)
li = ri
if li < len(pytext): l.append(pytext[li:])
return string.join(l,'')
# do splitting & inserting
splits.sort()
l = []
li = 0
for ri,dummy,insert in splits:
if ri > li: l.append(pytext[li:ri])
l.append(insert)
li = ri
if li < len(pytext): l.append(pytext[li:])
return string.join(l,'')
def addsplits(splits,text,formats,taglist):
# helper for fontify()
""" Helper for .fontify()
"""
for id,left,right,sublist in taglist:
try:
pre,post = formats[id]
except KeyError:
# sys.stderr.write('Warning: no format for %s specified\n'%repr(id))
pre,post = '',''
if type(pre) != type(''):
pre = pre(text[left:right])
if type(post) != type(''):
post = post(text[left:right])
# len(splits) is a dummy used to make sorting stable
splits.append((left,len(splits),pre))
if sublist:
addsplits(splits,text,formats,sublist)
splits.append((right,len(splits),post))
try:
pre,post = formats[id]
except KeyError:
# sys.stderr.write('Warning: no format for %s specified\n'%repr(id))
pre,post = '',''
if type(pre) != type(''):
pre = pre(text[left:right])
if type(post) != type(''):
post = post(text[left:right])
# len(splits) is a dummy used to make sorting stable
splits.append((left,len(splits),pre))
if sublist:
addsplits(splits,text,formats,sublist)
splits.append((right,len(splits),post))
def write_html_error(titel,text):
print """\
<HTML><HEADER><TITLE>%s</TITLE></HEADER>
<BODY>
<H2>%s</H2>
%s<html%s><head><title>%s</title></head>
<body>
<h2>%s</h2>
%s
</BODY></HTML>
""" % (titel,titel,text)
</body></html>
""" % (HTML_DOCTYPE,HTML_XMLNS,titel,titel,text)
def redirect_to(url):
@@ -310,13 +362,13 @@ def redirect_to(url):
sys.stdout.write('Status: 302\r\n')
sys.stdout.write('Location: %s\r\n\r\n' % url)
print """
<HTML><HEAD>
<TITLE>302 Moved Temporarily</TITLE>
</HEAD><BODY>
<H1>302 Moved Temporarily</H1>
The document has moved to <A HREF="%s">%s</A>.<P>
</BODY></HTML>
""" % (url,url)
%s<html%s><head>
<title>302 Moved Temporarily</title>
</head><body>
<h1>302 Moved Temporarily</h1>
The document has moved to <a href="%s">%s</a>.<p></p>
</body></html>
""" % (HTML_DOCTYPE,HTML_XMLNS,url,url)
def main(cmdline):
@@ -326,162 +378,162 @@ def main(cmdline):
options = []
optvalues = {}
for o in cmdline[1:]:
if o[0] == '-':
if ':' in o:
k,v = tuple(string.split(o,':'))
optvalues[k] = v
options.append(k)
else:
options.append(o)
else:
break
if o[0] == '-':
if ':' in o:
k,v = tuple(string.split(o,':'))
optvalues[k] = v
options.append(k)
else:
options.append(o)
else:
break
files = cmdline[len(options)+1:]
# create converting object
### create converting object
# load fontifier
if '-marcs' in options:
# use mxTextTool's tagging engine
from mxTextTools import tag
from mxTextTools.Examples.Python import python_script
tagfct = lambda text,tag=tag,pytable=python_script: \
tag(text,pytable)[1]
print "Py2HTML: using Marc's tagging engine"
# use mxTextTool's tagging engine as fontifier
from mx.TextTools import tag
from mx.TextTools.Examples.Python import python_script
tagfct = lambda text,tag=tag,pytable=python_script: \
tag(text,pytable)[1]
print "Py2HTML: using Marc's tagging engine"
else:
# load Just's
try:
import PyFontify
if PyFontify.__version__ < '0.3': raise ValueError
tagfct = PyFontify.fontify
except:
print """
# load Just's fontifier
try:
import PyFontify
if PyFontify.__version__ < '0.3': raise ValueError
tagfct = PyFontify.fontify
except:
print """
Sorry, but this script needs the PyFontify.py module version 0.3;
You can download it from Just's homepage at
URL: http://starship.skyport.net/crew/just
URL: http://starship.python.net/crew/just
"""
sys.exit()
sys.exit()
if '-format' in options:
format = optvalues['-format']
format = optvalues['-format']
else:
# use default
format = 'html'
# use default
format = 'html'
if '-mode' in options:
mode = optvalues['-mode']
mode = optvalues['-mode']
else:
# use default
mode = 'color'
# use default
mode = 'color'
c = PrettyPrint(tagfct,format,mode)
convert = c.file_filter
# start working
### start working
if '-title' in options:
c.title = optvalues['-title']
c.title = optvalues['-title']
if '-bgcolor' in options:
c.bgcolor = optvalues['-bgcolor']
c.bgcolor = optvalues['-bgcolor']
if '-header' in options:
try:
f = open(optvalues['-header'])
c.header = f.read()
f.close()
except IOError:
if verbose: print 'IOError: header file not found'
try:
f = open(optvalues['-header'])
c.header = f.read()
f.close()
except IOError:
if verbose: print 'IOError: header file not found'
if '-footer' in options:
try:
f = open(optvalues['-footer'])
c.footer = f.read()
f.close()
except IOError:
if verbose: print 'IOError: footer file not found'
try:
f = open(optvalues['-footer'])
c.footer = f.read()
f.close()
except IOError:
if verbose: print 'IOError: footer file not found'
if '-URL' in options:
c.replace_URLs = 1
c.replace_URLs = 1
if '-' in options:
convert(sys.stdin,sys.stdout)
sys.exit()
convert(sys.stdin,sys.stdout)
sys.exit()
if '-h' in options:
print __doc__
sys.exit()
print __doc__
sys.exit()
if len(files) == 0:
# Turn URL processing on
c.replace_URLs = 1
# Try CGI processing...
import cgi,urllib,urlparse,os
form = cgi.FieldStorage()
if not form.has_key('script'):
# Ok, then try pathinfo
if not os.environ.has_key('PATH_INFO'):
if INPUT_FORM:
redirect_to(INPUT_FORM)
else:
sys.stdout.write('Content-Type: text/html\r\n\r\n')
write_html_error('Missing Parameter',
'Missing script=URL field in request')
sys.exit(1)
url = os.environ['PATH_INFO'][1:] # skip the leading slash
else:
url = form['script'].value
sys.stdout.write('Content-Type: text/html\r\n\r\n')
scheme, host, path, params, query, frag = urlparse.urlparse(url)
if not host:
scheme = 'http'
if os.environ.has_key('HTTP_HOST'):
host = os.environ['HTTP_HOST']
else:
host = 'localhost'
url = urlparse.urlunparse((scheme, host, path, params, query, frag))
#print url; sys.exit()
network = urllib.URLopener()
try:
tempfile,headers = network.retrieve(url)
except IOError,reason:
write_html_error('Error opening "%s"' % url,
'The given URL could not be opened. Reason: %s' %\
str(reason))
sys.exit(1)
f = open(tempfile,'rb')
c.title = url
c.footer = __cgifooter__
convert(f,sys.stdout)
f.close()
network.close()
sys.exit()
# Turn URL processing on
c.replace_URLs = 1
# Try CGI processing...
import cgi,urllib,urlparse,os
form = cgi.FieldStorage()
if not form.has_key('script'):
# Ok, then try pathinfo
if not os.environ.has_key('PATH_INFO'):
if INPUT_FORM:
redirect_to(INPUT_FORM)
else:
sys.stdout.write('Content-Type: text/html\r\n\r\n')
write_html_error('Missing Parameter',
'Missing script=URL field in request')
sys.exit(1)
url = os.environ['PATH_INFO'][1:] # skip the leading slash
else:
url = form['script'].value
sys.stdout.write('Content-Type: text/html\r\n\r\n')
scheme, host, path, params, query, frag = urlparse.urlparse(url)
if not host:
scheme = 'http'
if os.environ.has_key('HTTP_HOST'):
host = os.environ['HTTP_HOST']
else:
host = 'localhost'
url = urlparse.urlunparse((scheme, host, path, params, query, frag))
#print url; sys.exit()
network = urllib.URLopener()
try:
tempfile,headers = network.retrieve(url)
except IOError,reason:
write_html_error('Error opening "%s"' % url,
'The given URL could not be opened. Reason: %s' %\
str(reason))
sys.exit(1)
f = open(tempfile,'rb')
c.title = url
c.footer = __cgifooter__
convert(f,sys.stdout)
f.close()
network.close()
sys.exit()
if '-stdout' in options:
filebreak = '-'*72
for f in files:
try:
if len(files) > 1:
print filebreak
print 'File:',f
print filebreak
convert(f,sys.stdout)
except IOError:
pass
filebreak = '-'*72
for f in files:
try:
if len(files) > 1:
print filebreak
print 'File:',f
print filebreak
convert(f,sys.stdout)
except IOError:
pass
else:
verbose = ('-v' in options)
if verbose:
print 'Py2HTML: working on',
for f in files:
try:
if verbose: print f,
convert(f,f+'.html')
except IOError:
if verbose: print '(IOError!)',
if verbose:
print
print 'Done.'
verbose = ('-v' in options)
if verbose:
print 'Py2HTML: working on',
for f in files:
try:
if verbose: print f,
convert(f,f+'.html')
except IOError:
if verbose: print '(IOError!)',
if verbose:
print
print 'Done.'
if __name__=='__main__':
main(sys.argv)

View File

@@ -1,47 +1,34 @@
#!/usr/bin/python
# -*- Mode: python -*-
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 2000 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2008 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://www.lyra.org/viewcvs/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://www.lyra.org/viewcvs/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# CGI script to process and display queries to CVSdb
#
# This script is part of the ViewCVS package. More information can be
# found at http://www.lyra.org/viewcvs/.
# This script is part of the ViewVC package. More information can be
# found at http://viewvc.org
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
CONF_PATHNAME = None
#########################################################################
import os
import sys
import string
import cgi
import time
import cvsdb
import viewcvs
import viewvc
import vclib
import ezt
import debug
import urllib
class FormData:
def __init__(self, form):
@@ -277,42 +264,65 @@ def form_to_cvsdb_query(form_data):
return query
def cvsroot_name_from_path(cvsroot):
## we need to resolve the cvsroot path from the database
## to the name given to it in the viewcvs.conf file
for key, value in cfg.general.cvs_roots.items():
if value == cvsroot:
return key
def prev_rev(rev):
'''Returns a string representing the previous revision of the argument.'''
r = string.split(rev, '.')
# decrement final revision component
r[-1] = str(int(r[-1]) - 1)
# prune if we pass the beginning of the branch
if len(r) > 2 and r[-1] == '0':
r = r[:-2]
return string.join(r, '.')
return None
def build_commit(desc, files):
def build_commit(server, cfg, desc, files, cvsroots, viewvc_link):
ob = _item(num_files=len(files), files=[])
if desc:
ob.desc = string.replace(cgi.escape(desc), '\n', '<br>')
ob.log = string.replace(server.escape(desc), '\n', '<br />')
else:
ob.desc = '&nbsp;'
ob.log = '&nbsp;'
for commit in files:
parts = filter(None, string.split(commit.GetDirectory(), '/'))
if parts and cfg.options.hide_cvsroot and parts[0] == 'CVSROOT':
continue
ctime = commit.GetTime()
if not ctime:
ctime = "&nbsp";
ctime = "&nbsp;"
else:
ctime = time.strftime("%y/%m/%d %H:%M", time.localtime(ctime))
if (cfg.options.use_localtime):
ctime = time.strftime("%y/%m/%d %H:%M %Z", time.localtime(ctime))
else:
ctime = time.strftime("%y/%m/%d %H:%M", time.gmtime(ctime)) \
+ ' UTC'
## make the file link
file = os.path.join(commit.GetDirectory(), commit.GetFile())
file_full_path = os.path.join(commit.GetRepository(), file)
repository = commit.GetRepository()
directory = commit.GetDirectory()
file = (directory and directory + "/") + commit.GetFile()
cvsroot_name = cvsroots.get(repository)
## skip forbidden files
if cfg.is_forbidden(cvsroot_name,
filter(None, string.split(file, "/")), vclib.FILE):
continue
## if we couldn't find the cvsroot path configured in the
## viewcvs.conf file, then don't make the link
cvsroot_name = cvsroot_name_from_path(commit.GetRepository())
## viewvc.conf file, then don't make the link
if cvsroot_name:
flink = '<a href="viewcvs.cgi/%s?cvsroot=%s">%s</a>' \
% (file, cvsroot_name, file_full_path)
flink = '[%s] <a href="%s/%s?root=%s">%s</a>' % (
cvsroot_name, viewvc_link, urllib.quote(file),
cvsroot_name, file)
if commit.GetType() == commit.CHANGE:
dlink = '%s/%s?root=%s&amp;view=diff&amp;r1=%s&amp;r2=%s' % (
viewvc_link, urllib.quote(file), cvsroot_name,
prev_rev(commit.GetRevision()), commit.GetRevision())
else:
dlink = None
else:
flink = file_full_path
flink = '[%s] %s' % (repository, file)
dlink = None
ob.files.append(_item(date=ctime,
author=commit.GetAuthor(),
@@ -321,13 +331,15 @@ def build_commit(desc, files):
branch=commit.GetBranch(),
plus=int(commit.GetPlusCount()),
minus=int(commit.GetMinusCount()),
type=commit.GetTypeString(),
difflink=dlink,
))
return ob
def run_query(form_data):
def run_query(server, cfg, form_data, viewvc_link):
query = form_to_cvsdb_query(form_data)
db = cvsdb.ConnectDatabaseReadOnly()
db = cvsdb.ConnectDatabaseReadOnly(cfg)
db.RunQuery(query)
if not query.commit_list:
@@ -336,6 +348,11 @@ def run_query(form_data):
commits = [ ]
files = [ ]
cvsroots = {}
rootitems = cfg.general.svn_roots.items() + cfg.general.cvs_roots.items()
for key, value in rootitems:
cvsroots[cvsdb.CleanRepository(value)] = key
current_desc = query.commit_list[0].GetDescription()
for commit in query.commit_list:
desc = commit.GetDescription()
@@ -343,44 +360,53 @@ def run_query(form_data):
files.append(commit)
continue
commits.append(build_commit(current_desc, files))
commits.append(build_commit(server, cfg, current_desc, files,
cvsroots, viewvc_link))
files = [ commit ]
current_desc = desc
## add the last file group to the commit list
commits.append(build_commit(current_desc, files))
commits.append(build_commit(server, cfg, current_desc, files,
cvsroots, viewvc_link))
# Strip out commits that don't have any files attached to them. The
# files probably aren't present because they've been blocked via
# forbiddenness.
def _only_with_files(commit):
return len(commit.files) > 0
commits = filter(_only_with_files, commits)
return commits
def handle_config():
viewcvs.handle_config()
global cfg
cfg = viewcvs.cfg
def main(server, cfg, viewvc_link):
try:
def main():
handle_config()
form = cgi.FieldStorage()
form = server.FieldStorage()
form_data = FormData(form)
if form_data.valid:
commits = run_query(form_data)
commits = run_query(server, cfg, form_data, viewvc_link)
query = None
else:
commits = [ ]
query = 'skipped'
script_name = server.getenv('SCRIPT_NAME', '')
data = {
'cfg' : cfg,
'address' : cfg.general.address,
'vsn' : viewcvs.__version__,
'vsn' : viewvc.__version__,
'repository' : cgi.escape(form_data.repository, 1),
'branch' : cgi.escape(form_data.branch, 1),
'directory' : cgi.escape(form_data.directory, 1),
'file' : cgi.escape(form_data.file, 1),
'who' : cgi.escape(form_data.who, 1),
'repository' : server.escape(form_data.repository, 1),
'branch' : server.escape(form_data.branch, 1),
'directory' : server.escape(form_data.directory, 1),
'file' : server.escape(form_data.file, 1),
'who' : server.escape(form_data.who, 1),
'docroot' : cfg.options.docroot is None \
and viewvc_link + '/' + viewvc.docroot_magic_path \
or cfg.options.docroot,
'sortby' : form_data.sortby,
'date' : form_data.date,
@@ -388,6 +414,7 @@ def main():
'query' : query,
'commits' : commits,
'num_commits' : len(commits),
'rss_href' : None,
}
if form_data.hours:
@@ -395,36 +422,18 @@ def main():
else:
data['hours'] = 2
template = ezt.Template()
template.parse_file(os.path.join(viewcvs.g_install_dir,
cfg.templates.query))
viewcvs.http_header()
server.header()
# generate the page
template = viewvc.get_view_template(cfg, "query")
template.generate(sys.stdout, data)
def run_cgi():
### be nice to share all this logic with viewcvs.run_cgi
try:
main()
except SystemExit, e:
# don't catch SystemExit (caused by sys.exit()). propagate the exit code
sys.exit(e[0])
pass
except:
info = sys.exc_info()
viewcvs.http_header()
print '<html><head><title>Python Exception Occurred</title></head>'
print '<body bgcolor=white><h1>Python Exception Occurred</h1>'
import traceback
lines = apply(traceback.format_exception, info)
print '<pre>'
print cgi.escape(string.join(lines, ''))
print '</pre>'
viewcvs.html_footer()
exc_info = debug.GetExceptionData()
server.header(status=exc_info['status'])
debug.PrintException(server, exc_info)
class _item:
def __init__(self, **kw):

View File

@@ -1,441 +0,0 @@
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# This software is being maintained as part of the ViewCVS project.
# Information is available at:
# http://viewcvs.sourceforge.net/
#
# This file was originally based on portions of the blame.py script by
# Curt Hagenlocher.
#
# -----------------------------------------------------------------------
import string
import time
class _TokenStream:
token_term = string.whitespace + ';'
# the algorithm is about the same speed for any CHUNK_SIZE chosen.
# grab a good-sized chunk, but not too large to overwhelm memory.
CHUNK_SIZE = 100000
# CHUNK_SIZE = 5 # for debugging, make the function grind...
def __init__(self, file):
self.rcsfile = file
self.idx = 0
self.buf = self.rcsfile.read(self.CHUNK_SIZE)
if self.buf == '':
raise RuntimeError, 'EOF'
def get(self):
"Get the next token from the RCS file."
# Note: we can afford to loop within Python, examining individual
# characters. For the whitespace and tokens, the number of iterations
# is typically quite small. Thus, a simple iterative loop will beat
# out more complex solutions.
buf = self.buf
idx = self.idx
while 1:
if idx == len(buf):
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
# signal EOF by returning None as the token
del self.buf # so we fail if get() is called again
return None
idx = 0
if buf[idx] not in string.whitespace:
break
idx = idx + 1
if buf[idx] == ';':
self.buf = buf
self.idx = idx + 1
return ';'
if buf[idx] != '@':
end = idx + 1
token = ''
while 1:
# find token characters in the current buffer
while end < len(buf) and buf[end] not in self.token_term:
end = end + 1
token = token + buf[idx:end]
if end < len(buf):
# we stopped before the end, so we have a full token
idx = end
break
# we stopped at the end of the buffer, so we may have a partial token
buf = self.rcsfile.read(self.CHUNK_SIZE)
idx = end = 0
self.buf = buf
self.idx = idx
return token
# a "string" which starts with the "@" character. we'll skip it when we
# search for content.
idx = idx + 1
chunks = [ ]
while 1:
if idx == len(buf):
idx = 0
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
raise RuntimeError, 'EOF'
i = string.find(buf, '@', idx)
if i == -1:
chunks.append(buf[idx:])
idx = len(buf)
continue
if i == len(buf) - 1:
chunks.append(buf[idx:i])
idx = 0
buf = '@' + self.rcsfile.read(self.CHUNK_SIZE)
if buf == '@':
raise RuntimeError, 'EOF'
continue
if buf[i + 1] == '@':
chunks.append(buf[idx:i+1])
idx = i + 2
continue
chunks.append(buf[idx:i])
self.buf = buf
self.idx = i + 1
return string.join(chunks, '')
# _get = get
# def get(self):
token = self._get()
print 'T:', `token`
return token
def match(self, match):
"Try to match the next token from the input buffer."
token = self.get()
if token != match:
raise RuntimeError, ('Unexpected parsing error in RCS file.\n' +
'Expected token: %s, but saw: %s' % (match, token))
def unget(self, token):
"Put this token back, for the next get() to return."
# Override the class' .get method with a function which clears the
# overridden method then returns the pushed token. Since this function
# will not be looked up via the class mechanism, it should be a "normal"
# function, meaning it won't have "self" automatically inserted.
# Therefore, we need to pass both self and the token thru via defaults.
# note: we don't put this into the input buffer because it may have been
# @-unescaped already.
def give_it_back(self=self, token=token):
del self.get
return token
self.get = give_it_back
class Parser:
def parse_rcs_admin(self):
while 1:
# Read initial token at beginning of line
token = self.ts.get()
# We're done once we reach the description of the RCS tree
if token[0] in string.digits:
self.ts.unget(token)
return
if token == "head":
self.sink.set_head_revision(self.ts.get())
self.ts.match(';')
elif token == "branch":
self.sink.set_principal_branch(self.ts.get())
self.ts.match(';')
elif token == "symbols":
while 1:
tag = self.ts.get()
if tag == ';':
break
(tag_name, tag_rev) = string.split(tag, ':')
self.sink.define_tag(tag_name, tag_rev)
elif token == "comment":
self.sink.set_comment(self.ts.get())
self.ts.match(';')
# Ignore all these other fields - We don't care about them. Also chews
# up "newphrase".
elif token in ("locks", "strict", "expand", "access"):
while 1:
tag = self.ts.get()
if tag == ';':
break
else:
pass
# warn("Unexpected RCS token: $token\n")
raise RuntimeError, "Unexpected EOF";
def parse_rcs_tree(self):
while 1:
revision = self.ts.get()
# End of RCS tree description ?
if revision == 'desc':
self.ts.unget(revision)
return
# Parse date
self.ts.match('date')
date = self.ts.get()
self.ts.match(';')
# Convert date into timestamp
date_fields = string.split(date, '.') + ['0', '0', '0']
date_fields = map(string.atoi, date_fields)
if date_fields[0] < 100:
date_fields[0] = date_fields[0] + 1900
timestamp = time.mktime(tuple(date_fields))
# Parse author
self.ts.match('author')
author = self.ts.get()
self.ts.match(';')
# Parse state
self.ts.match('state')
state = ''
while 1:
token = self.ts.get()
if token == ';':
break
state = state + token + ' '
state = state[:-1] # toss the trailing space
# Parse branches
self.ts.match('branches')
branches = [ ]
while 1:
token = self.ts.get()
if token == ';':
break
branches.append(token)
# Parse revision of next delta in chain
self.ts.match('next')
next = self.ts.get()
if next == ';':
next = None
else:
self.ts.match(';')
# there are some files with extra tags in them. for example:
# owner 640;
# group 15;
# permissions 644;
# hardlinks @configure.in@;
# this is "newphrase" in RCSFILE(5). we just want to skip over these.
while 1:
token = self.ts.get()
if token == 'desc' or token[0] in string.digits:
self.ts.unget(token)
break
# consume everything up to the semicolon
while self.ts.get() != ';':
pass
self.sink.define_revision(revision, timestamp, author, state, branches,
next)
def parse_rcs_description(self):
self.ts.match('desc')
self.sink.set_description(self.ts.get())
def parse_rcs_deltatext(self):
while 1:
revision = self.ts.get()
if revision is None:
# EOF
break
self.ts.match('log')
log = self.ts.get()
### need to add code to chew up "newphrase"
self.ts.match('text')
text = self.ts.get()
self.sink.set_revision_info(revision, log, text)
def parse(self, file, sink):
self.ts = _TokenStream(file)
self.sink = sink
self.parse_rcs_admin()
self.parse_rcs_tree()
# many sinks want to know when the tree has been completed so they can
# do some work to prep for the arrival of the deltatext
self.sink.tree_completed()
self.parse_rcs_description()
self.parse_rcs_deltatext()
# easiest for us to tell the sink it is done, rather than worry about
# higher level software doing it.
self.sink.parse_completed()
self.ts = self.sink = None
class Sink:
def set_head_revision(self, revision):
pass
def set_principal_branch(self, branch_name):
pass
def define_tag(self, name, revision):
pass
def set_comment(self, comment):
pass
def set_description(self, description):
pass
def define_revision(self, revision, timestamp, author, state,
branches, next):
pass
def set_revision_info(self, revision, log, text):
pass
def tree_completed(self):
pass
def parse_completed(self):
pass
# --------------------------------------------------------------------------
#
# TESTING AND DEBUGGING TOOLS
#
class DebugSink:
def set_head_revision(self, revision):
print 'head:', revision
def set_principal_branch(self, branch_name):
print 'branch:', branch_name
def define_tag(self, name, revision):
print 'tag:', name, '=', revision
def set_comment(self, comment):
print 'comment:', comment
def set_description(self, description):
print 'description:', description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print 'revision:', revision
print ' timestamp:', timestamp
print ' author:', author
print ' state:', state
print ' branches:', branches
print ' next:', next
def set_revision_info(self, revision, log, text):
print 'revision:', revision
print ' log:', log
print ' text:', text[:100], '...'
class DumpSink:
"""Dump all the parse information directly to stdout.
The output is relatively unformatted and untagged. It is intended as a
raw dump of the data in the RCS file. A copy can be saved, then changes
made to the parsing engine, then a comparison of the new output against
the old output.
"""
def __init__(self):
global sha
import sha
def set_head_revision(self, revision):
print revision
def set_principal_branch(self, branch_name):
print branch_name
def define_tag(self, name, revision):
print name, revision
def set_comment(self, comment):
print comment
def set_description(self, description):
print description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print revision, timestamp, author, state, branches, next
def set_revision_info(self, revision, log, text):
print revision, sha.new(log).hexdigest(), sha.new(text).hexdigest()
def tree_completed(self):
print 'tree_completed'
def parse_completed(self):
print 'parse_completed'
def dump_file(fname):
Parser().parse(open(fname), DumpSink())
def time_file(fname):
import time
p = Parser().parse
f = open(fname)
s = Sink()
t = time.time()
p(f, s)
t = time.time() - t
print t
def _usage():
print 'This is normally a module for importing, but it has a couple'
print 'features for testing as an executable script.'
print 'USAGE: %s COMMAND filename,v' % sys.argv[0]
print ' where COMMAND is one of:'
print ' dump: filename is "dumped" to stdout'
print ' time: filename is parsed with the time written to stdout'
sys.exit(1)
if __name__ == '__main__':
import sys
if len(sys.argv) != 3:
usage()
if sys.argv[1] == 'dump':
dump_file(sys.argv[2])
elif sys.argv[1] == 'time':
time_file(sys.argv[2])
else:
usage()

View File

@@ -1,339 +0,0 @@
# -*- Mode: python -*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
import os
import string
import re
import time
## RLogOutputParser uses the output of rlog to build a list of Commit
## objects describing all the checkins from a given RCS file; this
## parser is fairly optimized, and therefore can be delicate if the
## rlog output varies between versions of rlog; I don't know if it does;
## to make really fast, I should wrap the C rcslib
## there's definately not much error checking here; I'll assume things
## will go smoothly, and trap errors via exception handlers above this
## function
## exception for this class
error = 'rlog error'
class RLogData:
"Container object for all data parsed from a 'rlog' output."
def __init__(self, filename):
self.filename = filename
self.symbolic_name_hash = {}
self.rlog_entry_list = []
def LookupBranch(self, rlog_entry):
index = string.rfind(rlog_entry.revision, '.')
branch_revision = rlog_entry.revision[:index]
try:
branch = self.symbolic_name_hash[branch_revision]
except KeyError:
branch = ''
return branch
class RLogEntry:
## static constants for type of log entry; this will be changed
## to strings I guess -JMP
CHANGE = 0
ADD = 1
REMOVE = 2
## Here's the init function, which isn't needed since this class
## is fully initalized by RLogParser when creating a new log entry.
## Let's keep this initializer as a description of what is held in
## the class, but keep it commented out since it only makes things
## slow.
##
## def __init__(self):
## self.revision = ''
## self.author = ''
## self.branch = ''
## self.pluscount = ''
## self.minuscount = ''
## self.description = ''
## self.time = None
## self.type = RLogEntry.CHANGE
class RLog:
"Provides a alternative file-like interface for running 'rlog'."
def __init__(self, cfg, filename, revision, date):
self.filename = self.fix_filename(filename)
self.checkout_filename = self.create_checkout_filename(self.filename)
self.revision = revision
self.date = date
arg_list = []
if self.revision:
arg_list.append('-r%s' % (self.revision))
if self.date:
arg_list.append('-d%s' % (self.date))
temp = os.path.join(cfg.general.rcs_path, "rlog")
self.cmd = '%s %s "%s"' % (temp, string.join(arg_list), self.filename)
self.rlog = os.popen(self.cmd, 'r')
def fix_filename(self, filename):
## all RCS files have the ",v" ending
if filename[-2:] != ",v":
filename = "%s,v" % (filename)
if os.path.isfile(filename):
return filename
## check the Attic for the RCS file
path, basename = os.path.split(filename)
filename = os.path.join(path, "Attic", basename)
if os.path.isfile(filename):
return filename
raise error, "rlog file not found: %s" % (filename)
def create_checkout_filename(self, filename):
## cut off the ",v"
checkout_filename = filename[:-2]
## check if the file is in the Attic
path, basename = os.path.split(checkout_filename)
if path[-6:] != '/Attic':
return checkout_filename
## remove the "Attic" part of the path
checkout_filename = os.path.join(path[:-6], basename)
return checkout_filename
def readline(self):
try:
line = self.rlog.readline()
except AttributeError:
self.error()
if line:
return line
status = self.close()
if status:
self.error()
return None
def close(self):
status = self.rlog.close()
self.rlog = None
return status
def error(self):
raise error, "unexpected rlog exit: %s" % (self.cmd)
## constants used in the output parser
_rlog_commit_sep = '----------------------------\n'
_rlog_end = '=============================================================================\n'
## regular expression used in the output parser
_re_symbolic_name = re.compile("\s+([^:]+):\s+(.+)$")
_re_revision = re.compile("^revision\s+([0-9.]+).*")
_re_data_line = re.compile(
"^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+"\
"author:\s+([^;]+);\s+"\
"state:\s+([^;]+);\s+"\
"lines:\s+\+(\d+)\s+\-(\d+)$")
_re_data_line_add = re.compile(
"^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+"\
"author:\s+([^;]+);\s+"\
"state:\s+([^;]+);$")
class RLogOutputParser:
def __init__(self, rlog):
self.rlog = rlog
self.rlog_data = RLogData(rlog.checkout_filename)
## run the parser
self.parse_to_symbolic_names()
self.parse_symbolic_names()
self.parse_to_description()
self.parse_rlog_entries()
def parse_to_symbolic_names(self):
while 1:
line = self.rlog.readline()
if line[:15] == 'symbolic names:':
break
def parse_symbolic_names(self):
## parse all the tags int the branch_hash, it's used later to get
## the text names of non-head branches
while 1:
line = self.rlog.readline()
match = _re_symbolic_name.match(line)
if not match:
break
(tag, revision) = match.groups()
## check if the tag represents a branch, in RCS this means
## the second-to-last number is a zero
index = string.rfind(revision, '.')
if revision[index-2:index] == '.0':
revision = revision[:index-2] + revision[index:]
self.rlog_data.symbolic_name_hash[revision] = tag
def parse_to_description(self):
while 1:
line = self.rlog.readline()
if line[:12] == 'description:':
break
## eat all lines until we reach '-----' seperator
while 1:
line = self.rlog.readline()
if line == _rlog_commit_sep:
break
def parse_rlog_entries(self):
while 1:
rlog_entry = self.parse_one_rlog_entry()
if not rlog_entry:
break
self.rlog_data.rlog_entry_list.append(rlog_entry)
def parse_one_rlog_entry(self):
## revision line/first line
line = self.rlog.readline()
# Since FreeBSD's rlog outputs extra "---...---\n" before
# "===...===\n", _rlog_end may be occured here.
if not line or line == _rlog_end:
return None
## revision
match = _re_revision.match(line)
(revision,) = match.groups()
## data line
line = self.rlog.readline()
match = _re_data_line.match(line)
if not match:
match = _re_data_line_add.match(line)
if not match:
raise error, "bad rlog parser, no cookie!"
## retrieve the matched grops as a tuple in hopes
## this will be faster (ala profiler)
groups = match.groups()
year = string.atoi(groups[0])
month = string.atoi(groups[1])
day = string.atoi(groups[2])
hour = string.atoi(groups[3])
minute = string.atoi(groups[4])
second = string.atoi(groups[5])
author = groups[6]
state = groups[7]
## very strange; here's the deal: if this is a newly added file,
## then there is no plus/minus count count of lines; if there
## is, then this could be a "CHANGE" or "REMOVE", you can tell
## if the file has been removed by looking if state == 'dead'
try:
pluscount = groups[8]
minuscount = groups[9]
except IndexError:
pluscount = ''
minuscount = ''
cmit_type = RLogEntry.ADD
else:
if state == 'dead':
cmit_type = RLogEntry.REMOVE
else:
cmit_type = RLogEntry.CHANGE
## branch line: pretty much ignored if it's there
desc_line_list = []
line = self.rlog.readline()
if not line[:10] == 'branches: ':
desc_line_list.append(string.rstrip(line))
## suck up description
while 1:
line = self.rlog.readline()
## the last line printed out by rlog is '===='...
## or '------'... between entries
if line == _rlog_commit_sep or line == _rlog_end:
break
## append line to the descripton list
desc_line_list.append(string.rstrip(line))
## compute time using time routines in seconds from epoc GMT
## NOTE: mktime's arguments are in local time, and we have
## them in GMT from RCS; therefore, we have to manually
## subtract out the timezone correction
##
## XXX: Linux glib2.0.7 bug: it looks like mktime doesn't honor
## the '0' flag to force no timezone correction, so we look
## at the correction ourself and do the right thing after
## mktime mangles the date
gmt_time = \
time.mktime((year, month, day, hour, minute, second, 0, 0, -1))
if time.localtime(gmt_time)[8] == 1:
# dst time active?
# XXX: This is still wrong in those both nights,
# where the switch between DST and normal time occurs.
gmt_time = gmt_time - time.altzone
else:
gmt_time = gmt_time - time.timezone
## now create and return the RLogEntry
rlog_entry = RLogEntry()
rlog_entry.type = cmit_type
rlog_entry.revision = revision
rlog_entry.author = author
rlog_entry.description = string.join(desc_line_list, '\n')
rlog_entry.time = gmt_time
rlog_entry.pluscount = pluscount
rlog_entry.minuscount = minuscount
return rlog_entry
## entrypoints
def GetRLogData(cfg, path, revision = '', date = ''):
rlog = RLog(cfg, path, revision, date)
rlog_parser = RLogOutputParser(rlog)
return rlog_parser.rlog_data

391
lib/sapi.py Normal file
View File

@@ -0,0 +1,391 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# generic server api - currently supports normal cgi, mod_python, and
# active server pages
#
# -----------------------------------------------------------------------
import types
import string
import os
import sys
import re
# global server object. It will be either a CgiServer or a proxy to
# an AspServer or ModPythonServer object.
server = None
class Server:
def __init__(self):
self.pageGlobals = {}
def self(self):
return self
def close(self):
pass
class ThreadedServer(Server):
def __init__(self):
Server.__init__(self)
self.inheritableOut = 0
global server
if not isinstance(server, ThreadedServerProxy):
server = ThreadedServerProxy()
if not isinstance(sys.stdout, File):
sys.stdout = File(server)
server.registerThread(self)
def file(self):
return File(self)
def close(self):
server.unregisterThread()
class ThreadedServerProxy:
"""In a multithreaded server environment, ThreadedServerProxy stores the
different server objects being used to display pages and transparently
forwards access to them based on the current thread id."""
def __init__(self):
self.__dict__['servers'] = { }
global thread
import thread
def registerThread(self, server):
self.__dict__['servers'][thread.get_ident()] = server
def unregisterThread(self):
del self.__dict__['servers'][thread.get_ident()]
def self(self):
"""This function bypasses the getattr and setattr trickery and returns
the actual server object."""
return self.__dict__['servers'][thread.get_ident()]
def __getattr__(self, key):
return getattr(self.self(), key)
def __setattr__(self, key, value):
setattr(self.self(), key, value)
def __delattr__(self, key):
delattr(self.self(), key)
class File:
def __init__(self, server):
self.closed = 0
self.mode = 'w'
self.name = "<AspFile file>"
self.softspace = 0
self.server = server
def write(self, s):
self.server.write(s)
def writelines(self, list):
for s in list:
self.server.write(s)
def flush(self):
self.server.flush()
def truncate(self, size):
pass
def close(self):
pass
class CgiServer(Server):
def __init__(self, inheritableOut = 1):
Server.__init__(self)
self.headerSent = 0
self.headers = []
self.inheritableOut = inheritableOut
self.iis = os.environ.get('SERVER_SOFTWARE', '')[:13] == 'Microsoft-IIS'
if sys.platform == "win32" and inheritableOut:
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
global server
server = self
global cgi
import cgi
def addheader(self, name, value):
self.headers.append((name, value))
def header(self, content_type='text/html; charset=UTF-8', status=None):
if not self.headerSent:
self.headerSent = 1
extraheaders = ''
for (name, value) in self.headers:
extraheaders = extraheaders + '%s: %s\r\n' % (name, value)
# The only way ViewVC pages and error messages are visible under
# IIS is if a 200 error code is returned. Otherwise IIS instead
# sends the static error page corresponding to the code number.
if status is None or (status[:3] != '304' and self.iis):
status = ''
else:
status = 'Status: %s\r\n' % status
sys.stdout.write('%sContent-Type: %s\r\n%s\r\n'
% (status, content_type, extraheaders))
def redirect(self, url):
if self.iis: url = fix_iis_url(self, url)
self.addheader('Location', url)
self.header(status='301 Moved')
print 'This document is located <a href="%s">here</a>.' % url
sys.exit(0)
def escape(self, s, quote = None):
return cgi.escape(s, quote)
def getenv(self, name, value=None):
ret = os.environ.get(name, value)
if self.iis and name == 'PATH_INFO' and ret:
ret = fix_iis_path_info(self, ret)
return ret
def params(self):
return cgi.parse()
def FieldStorage(fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
return cgi.FieldStorage(fp, headers, outerboundary, environ,
keep_blank_values, strict_parsing)
def write(self, s):
sys.stdout.write(s)
def flush(self):
sys.stdout.flush()
def file(self):
return sys.stdout
class AspServer(ThreadedServer):
def __init__(self, Server, Request, Response, Application):
ThreadedServer.__init__(self)
self.headerSent = 0
self.server = Server
self.request = Request
self.response = Response
self.application = Application
def addheader(self, name, value):
self.response.AddHeader(name, value)
def header(self, content_type=None, status=None):
# Normally, setting self.response.ContentType after headers have already
# been sent simply results in an AttributeError exception, but sometimes
# it leads to a fatal ASP error. For this reason I'm keeping the
# self.headerSent member and only checking for the exception as a
# secondary measure
if not self.headerSent:
try:
self.headerSent = 1
if content_type is None:
self.response.ContentType = 'text/html; charset=UTF-8'
else:
self.response.ContentType = content_type
if status is not None: self.response.Status = status
except AttributeError:
pass
def redirect(self, url):
self.response.Redirect(url)
sys.exit()
def escape(self, s, quote = None):
return self.server.HTMLEncode(str(s))
def getenv(self, name, value = None):
ret = self.request.ServerVariables(name)()
if not type(ret) is types.UnicodeType:
return value
ret = str(ret)
if name == 'PATH_INFO':
ret = fix_iis_path_info(self, ret)
return ret
def params(self):
p = {}
for i in self.request.Form:
p[str(i)] = map(str, self.request.Form[i])
for i in self.request.QueryString:
p[str(i)] = map(str, self.request.QueryString[i])
return p
def FieldStorage(self, fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
# Code based on a very helpful usenet post by "Max M" (maxm@mxm.dk)
# Subject "Re: Help! IIS and Python"
# http://groups.google.com/groups?selm=3C7C0AB6.2090307%40mxm.dk
from StringIO import StringIO
from cgi import FieldStorage
environ = {}
for i in self.request.ServerVariables:
environ[str(i)] = str(self.request.ServerVariables(i)())
# this would be bad for uploaded files, could use a lot of memory
binaryContent, size = self.request.BinaryRead(int(environ['CONTENT_LENGTH']))
fp = StringIO(str(binaryContent))
fs = FieldStorage(fp, None, "", environ, keep_blank_values, strict_parsing)
fp.close()
return fs
def write(self, s):
t = type(s)
if t is types.StringType:
s = buffer(s)
elif not t is types.BufferType:
s = buffer(str(s))
self.response.BinaryWrite(s)
def flush(self):
self.response.Flush()
_re_status = re.compile("\\d+")
class ModPythonServer(ThreadedServer):
def __init__(self, request):
ThreadedServer.__init__(self)
self.request = request
self.headerSent = 0
global cgi
import cgi
def addheader(self, name, value):
self.request.headers_out.add(name, value)
def header(self, content_type=None, status=None):
if content_type is None:
self.request.content_type = 'text/html; charset=UTF-8'
else:
self.request.content_type = content_type
self.headerSent = 1
if status is not None:
m = _re_status.match(status)
if not m is None:
self.request.status = int(m.group())
def redirect(self, url):
import mod_python.apache
self.request.headers_out['Location'] = url
self.request.status = mod_python.apache.HTTP_MOVED_TEMPORARILY
self.request.write("You are being redirected to <a href=\"%s\">%s</a>"
% (url, url))
sys.exit()
def escape(self, s, quote = None):
return cgi.escape(s, quote)
def getenv(self, name, value = None):
try:
return self.request.subprocess_env[name]
except KeyError:
return value
def params(self):
import mod_python.util
if self.request.args is None:
return {}
else:
return mod_python.util.parse_qs(self.request.args)
def FieldStorage(self, fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
import mod_python.util
return mod_python.util.FieldStorage(self.request, keep_blank_values, strict_parsing)
def write(self, s):
self.request.write(s)
def flush(self):
pass
def fix_iis_url(server, url):
"""When a CGI application under IIS outputs a "Location" header with a url
beginning with a forward slash, IIS tries to optimise the redirect by not
returning any output from the original CGI script at all and instead just
returning the new page in its place. Because of this, the browser does
not know it is getting a different page than it requested. As a result,
The address bar that appears in the browser window shows the wrong location
and if the new page is in a different folder than the old one, any relative
links on it will be broken.
This function can be used to circumvent the IIS "optimization" of local
redirects. If it is passed a location that begins with a forward slash it
will return a URL constructed with the information in CGI environment.
If it is passed a URL or any location that doens't begin with a forward slash
it will return just argument unaltered.
"""
if url[0] == '/':
if server.getenv('HTTPS') == 'on':
dport = "443"
prefix = "https://"
else:
dport = "80"
prefix = "http://"
prefix = prefix + server.getenv('HTTP_HOST')
if server.getenv('SERVER_PORT') != dport:
prefix = prefix + ":" + server.getenv('SERVER_PORT')
return prefix + url
return url
def fix_iis_path_info(server, path_info):
"""Fix the PATH_INFO value in IIS"""
# If the viewvc cgi's are in the /viewvc/ folder on the web server and a
# request looks like
#
# /viewvc/viewvc.cgi/myproject/?someoption
#
# The CGI environment variables on IIS will look like this:
#
# SCRIPT_NAME = /viewvc/viewvc.cgi
# PATH_INFO = /viewvc/viewvc.cgi/myproject/
#
# Whereas on Apache they look like:
#
# SCRIPT_NAME = /viewvc/viewvc.cgi
# PATH_INFO = /myproject/
#
# This function converts the IIS PATH_INFO into the nonredundant form
# expected by ViewVC
return path_info[len(server.getenv('SCRIPT_NAME', '')):]

264
lib/vclib/__init__.py Normal file
View File

@@ -0,0 +1,264 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""Version Control lib is an abstract API to access versioning systems
such as CVS.
"""
import string
import types
# item types returned by Repository.itemtype().
FILE = 'FILE'
DIR = 'DIR'
# diff types recognized by Repository.rawdiff().
UNIFIED = 1
CONTEXT = 2
SIDE_BY_SIDE = 3
# ======================================================================
#
class Repository:
"""Abstract class representing a repository."""
def itemtype(self, path_parts, rev):
"""Return the type of the item (file or dir) at the given path and revision
The result will be vclib.DIR or vclib.FILE
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to check
"""
pass
def openfile(self, path_parts, rev):
"""Open a file object to read file contents at a given path and revision.
The return value is a 2-tuple of containg the file object and revision
number in canonical form.
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the file to check out
"""
def listdir(self, path_parts, rev, options):
"""Return list of files in a directory
The result is a list of DirEntry objects
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the directory to list
options is a dictionary of implementation specific options
"""
def dirlogs(self, path_parts, rev, entries, options):
"""Augment directory entries with log information
New properties will be set on all of the DirEntry objects in the entries
list. At the very least, a "rev" property will be set to a revision
number or None if the entry doesn't have a number. Other properties that
may be set include "date", "author", and "log".
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the directory listing and will effect which log
messages are returned
entries is a list of DirEntry objects returned from a previous call to
the listdir() method
options is a dictionary of implementation specific options
"""
def itemlog(self, path_parts, rev, options):
"""Retrieve an item's log information
The result is a list of Revision objects
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to return information about
options is a dictionary of implementation specific options
"""
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
"""Return a diff (in GNU diff format) of two file revisions
type is the requested diff type (UNIFIED, CONTEXT, etc)
options is a dictionary that can contain the following options plus
implementation-specific options
context - integer, number of context lines to include
funout - boolean, include C function names
ignore_white - boolean, ignore whitespace
Return value is a python file object
"""
def annotate(self, path_parts, rev):
"""Return a list of annotate file content lines and a revision.
The annotated lines are an collection of objects with the
following addressable members:
text - raw text of a line of file contents
line_number - line number on which the line is found
rev - revision in which the line was last modified
prev_rev - revision prior to 'rev'
author - author who last modified the line
date - date on which the line was last modified, in seconds
since the epoch, GMT
These object are sort by their line_number components.
"""
# ======================================================================
class DirEntry:
"Instances represent items in a directory listing"
def __init__(self, name, kind, errors=[]):
self.name = name
self.kind = kind
self.errors = errors
class Revision:
"""Instances holds information about revisions of versioned resources"""
"""Create a new Revision() item:
NUMBER: Revision in an integer-based, sortable format
STRING: Revision as a string
DATE: Seconds since Epoch (GMT) that this revision was created
AUTHOR: Author of the revision
CHANGED: Lines-changed (contextual diff) information
LOG: Log message associated with the creation of this revision
SIZE: Size (in bytes) of this revision's fulltext (files only)
"""
def __init__(self, number, string, date, author, changed, log, size):
self.number = number
self.string = string
self.date = date
self.author = author
self.changed = changed
self.log = log
self.size = size
def __cmp__(self, other):
return cmp(self.number, other.number)
# ======================================================================
class Error(Exception):
pass
class ReposNotFound(Error):
pass
class ItemNotFound(Error):
def __init__(self, path):
# use '/' rather than os.sep because this is for user consumption, and
# it was defined using URL separators
if type(path) in (types.TupleType, types.ListType):
path = string.join(path, '/')
Error.__init__(self, path)
class InvalidRevision(Error):
def __init__(self, revision=None):
if revision is None:
Error.__init__(self, "Invalid revision")
else:
Error.__init__(self, "Invalid revision " + str(revision))
# ======================================================================
# Implementation code used by multiple vclib modules
import popen
import os
import time
def _diff_args(type, options):
"""generate argument list to pass to diff or rcsdiff"""
args = []
if type == CONTEXT:
if options.has_key('context'):
args.append('--context=%i' % options['context'])
else:
args.append('-c')
elif type == UNIFIED:
if options.has_key('context'):
args.append('--unified=%i' % options['context'])
else:
args.append('-u')
elif type == SIDE_BY_SIDE:
args.append('--side-by-side')
args.append('--width=164')
else:
raise NotImplementedError
if options.get('funout', 0):
args.append('-p')
if options.get('ignore_white', 0):
args.append('-w')
return args
class _diff_fp:
"""File object reading a diff between temporary files, cleaning up
on close"""
def __init__(self, temp1, temp2, info1=None, info2=None, diff_opts=[]):
self.temp1 = temp1
self.temp2 = temp2
args = diff_opts[:]
if info1 and info2:
args.extend(["-L", self._label(info1), "-L", self._label(info2)])
args.extend([temp1, temp2])
self.fp = popen.popen("diff", args, "r")
def read(self, bytes):
return self.fp.read(bytes)
def readline(self):
return self.fp.readline()
def close(self):
try:
if self.fp:
self.fp.close()
self.fp = None
finally:
try:
if self.temp1:
os.remove(self.temp1)
self.temp1 = None
finally:
if self.temp2:
os.remove(self.temp2)
self.temp2 = None
def __del__(self):
self.close()
def _label(self, (path, date, rev)):
date = date and time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date))
return "%s\t%s\t%s" % (path, date, rev)

1101
lib/vclib/bincvs/__init__.py Normal file

File diff suppressed because it is too large Load Diff

351
lib/vclib/ccvs/__init__.py Normal file
View File

@@ -0,0 +1,351 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""
This is a Version Control library driver for locally accessible cvs-repositories.
"""
import os
import string
import re
import cStringIO
import tempfile
import vclib
import rcsparse
import blame
### The functionality shared with bincvs should probably be moved to a
### separate module
from vclib.bincvs import CVSRepository, Revision, Tag, \
_file_log, _log_path
class CCVSRepository(CVSRepository):
def dirlogs(self, path_parts, rev, entries, options):
"""see vclib.Repository.dirlogs docstring
rev can be a tag name or None. if set only information from revisions
matching the tag will be retrieved
Option values recognized by this implementation:
cvs_subdirs
boolean. true to fetch logs of the most recently modified file in each
subdirectory
Option values returned by this implementation:
cvs_tags, cvs_branches
lists of tag and branch names encountered in the directory
"""
subdirs = options.get('cvs_subdirs', 0)
dirpath = self._getpath(path_parts)
alltags = { # all the tags seen in the files of this dir
'MAIN' : '',
'HEAD' : '1.1'
}
for entry in entries:
entry.rev = entry.date = entry.author = entry.dead = entry.log = None
path = _log_path(entry, dirpath, subdirs)
if path:
entry.path = path
try:
rcsparse.Parser().parse(open(path, 'rb'), InfoSink(entry, rev, alltags))
except IOError, e:
entry.errors.append("rcsparse error: %s" % e)
except RuntimeError, e:
entry.errors.append("rcsparse error: %s" % e)
except rcsparse.RCSStopParser:
pass
branches = options['cvs_branches'] = []
tags = options['cvs_tags'] = []
for name, rev in alltags.items():
if Tag(None, rev).is_branch:
branches.append(name)
else:
tags.append(name)
def itemlog(self, path_parts, rev, options):
"""see vclib.Repository.itemlog docstring
rev parameter can be a revision number, a branch number, a tag name,
or None. If None, will return information about all revisions, otherwise,
will only return information about the specified revision or branch.
Option values returned by this implementation:
cvs_tags
dictionary of Tag objects for all tags encountered
"""
path = self.rcsfile(path_parts, 1)
sink = TreeSink()
rcsparse.Parser().parse(open(path, 'rb'), sink)
filtered_revs = _file_log(sink.revs.values(), sink.tags,
sink.default_branch, rev)
for rev in filtered_revs:
if rev.prev and len(rev.number) == 2:
rev.changed = rev.prev.next_changed
options['cvs_tags'] = sink.tags
return filtered_revs
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
temp1 = tempfile.mktemp()
open(temp1, 'wb').write(self.openfile(path_parts1, rev1)[0].getvalue())
temp2 = tempfile.mktemp()
open(temp2, 'wb').write(self.openfile(path_parts2, rev2)[0].getvalue())
r1 = self.itemlog(path_parts1, rev1, {})[-1]
r2 = self.itemlog(path_parts2, rev2, {})[-1]
info1 = (self.rcsfile(path_parts1, root=1, v=0), r1.date, r1.string)
info2 = (self.rcsfile(path_parts2, root=1, v=0), r2.date, r2.string)
diff_args = vclib._diff_args(type, options)
return vclib._diff_fp(temp1, temp2, info1, info2, diff_args)
def annotate(self, path_parts, rev=None):
source = blame.BlameSource(self.rcsfile(path_parts, 1), rev)
return source, source.revision
def openfile(self, path_parts, rev=None):
path = self.rcsfile(path_parts, 1)
sink = COSink(rev)
rcsparse.Parser().parse(open(path, 'rb'), sink)
revision = sink.last and sink.last.string
return cStringIO.StringIO(string.join(sink.sstext.text, "\n")), revision
class MatchingSink(rcsparse.Sink):
"""Superclass for sinks that search for revisions based on tag or number"""
def __init__(self, find):
"""Initialize with tag name or revision number string to match against"""
if not find or find == 'MAIN' or find == 'HEAD':
self.find = None
else:
self.find = find
self.find_tag = None
def set_principal_branch(self, branch_number):
if self.find is None:
self.find_tag = Tag(None, branch_number)
def define_tag(self, name, revision):
if name == self.find:
self.find_tag = Tag(None, revision)
def admin_completed(self):
if self.find_tag is None:
if self.find is None:
self.find_tag = Tag(None, '')
else:
try:
self.find_tag = Tag(None, self.find)
except ValueError:
pass
class InfoSink(MatchingSink):
def __init__(self, entry, tag, alltags):
MatchingSink.__init__(self, tag)
self.entry = entry
self.alltags = alltags
self.matching_rev = None
self.perfect_match = 0
def define_tag(self, name, revision):
MatchingSink.define_tag(self, name, revision)
self.alltags[name] = revision
def admin_completed(self):
MatchingSink.admin_completed(self)
if self.find_tag is None:
# tag we're looking for doesn't exist
raise rcsparse.RCSStopParser
def define_revision(self, revision, date, author, state, branches, next):
if self.perfect_match:
return
tag = self.find_tag
rev = Revision(revision, date, author, state == "dead")
# perfect match if revision number matches tag number or if revision is on
# trunk and tag points to trunk. imperfect match if tag refers to a branch
# and this revision is the highest revision so far found on that branch
perfect = ((rev.number == tag.number) or
(not tag.number and len(rev.number) == 2))
if perfect or (tag.is_branch and tag.number == rev.number[:-1] and
(not self.matching_rev or
rev.number > self.matching_rev.number)):
self.matching_rev = rev
self.perfect_match = perfect
def set_revision_info(self, revision, log, text):
if self.matching_rev:
if revision == self.matching_rev.string:
self.entry.rev = self.matching_rev.string
self.entry.date = self.matching_rev.date
self.entry.author = self.matching_rev.author
self.entry.dead = self.matching_rev.dead
self.entry.log = log
raise rcsparse.RCSStopParser
else:
raise rcsparse.RCSStopParser
class TreeSink(rcsparse.Sink):
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
def __init__(self):
self.revs = { }
self.tags = { }
self.head = None
self.default_branch = None
def set_head_revision(self, revision):
self.head = revision
def set_principal_branch(self, branch_number):
self.default_branch = branch_number
def define_tag(self, name, revision):
# check !tags.has_key(tag_name)
self.tags[name] = revision
def define_revision(self, revision, date, author, state, branches, next):
# check !revs.has_key(revision)
self.revs[revision] = Revision(revision, date, author, state == "dead")
def set_revision_info(self, revision, log, text):
# check revs.has_key(revision)
rev = self.revs[revision]
rev.log = log
changed = None
added = 0
deled = 0
if self.head != revision:
changed = 1
lines = string.split(text, '\n')
idx = 0
while idx < len(lines):
command = lines[idx]
dmatch = self.d_command.match(command)
idx = idx + 1
if dmatch:
deled = deled + string.atoi(dmatch.group(2))
else:
amatch = self.a_command.match(command)
if amatch:
count = string.atoi(amatch.group(2))
added = added + count
idx = idx + count
elif command:
raise "error while parsing deltatext: %s" % command
if len(rev.number) == 2:
rev.next_changed = changed and "+%i -%i" % (deled, added)
else:
rev.changed = changed and "+%i -%i" % (added, deled)
class StreamText:
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
def __init__(self, text):
self.text = string.split(text, "\n")
def command(self, cmd):
adjust = 0
add_lines_remaining = 0
diffs = string.split(cmd, "\n")
if diffs[-1] == "":
del diffs[-1]
if len(diffs) == 0:
return
if diffs[0] == "":
del diffs[0]
for command in diffs:
if add_lines_remaining > 0:
# Insertion lines from a prior "a" command
self.text.insert(start_line + adjust, command)
add_lines_remaining = add_lines_remaining - 1
adjust = adjust + 1
continue
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
begin = start_line + adjust - 1
del self.text[begin:begin + count]
adjust = adjust - count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
add_lines_remaining = count
else:
raise RuntimeError, 'Error parsing diff commands'
def secondnextdot(s, start):
# find the position the second dot after the start index.
return string.find(s, '.', string.find(s, '.', start) + 1)
class COSink(MatchingSink):
def __init__(self, rev):
MatchingSink.__init__(self, rev)
def set_head_revision(self, revision):
self.head = Revision(revision)
self.last = None
self.sstext = None
def admin_completed(self):
MatchingSink.admin_completed(self)
if self.find_tag is None:
raise vclib.InvalidRevision(self.find)
def set_revision_info(self, revision, log, text):
tag = self.find_tag
rev = Revision(revision)
if rev.number == tag.number:
self.log = log
depth = len(rev.number)
if rev.number == self.head.number:
assert self.sstext is None
self.sstext = StreamText(text)
elif (depth == 2 and tag.number and rev.number >= tag.number[:depth]):
assert len(self.last.number) == 2
assert rev.number < self.last.number
self.sstext.command(text)
elif (depth > 2 and rev.number[:depth-1] == tag.number[:depth-1] and
(rev.number <= tag.number or len(tag.number) == depth-1)):
assert len(rev.number) - len(self.last.number) in (0, 2)
assert rev.number > self.last.number
self.sstext.command(text)
else:
rev = None
if rev:
#print "tag =", tag.number, "rev =", rev.number, "<br>"
self.last = rev

464
lib/vclib/ccvs/blame.py Normal file
View File

@@ -0,0 +1,464 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 2000 Curt Hagenlocher <curt@hagenlocher.org>
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# blame.py: Annotate each line of a CVS file with its author,
# revision #, date, etc.
#
# -----------------------------------------------------------------------
#
# This file is based on the cvsblame.pl portion of the Bonsai CVS tool,
# developed by Steve Lamm for Netscape Communications Corporation. More
# information about Bonsai can be found at
# http://www.mozilla.org/bonsai.html
#
# cvsblame.pl, in turn, was based on Scott Furman's cvsblame script
#
# -----------------------------------------------------------------------
import string
import re
import time
import math
import rcsparse
class CVSParser(rcsparse.Sink):
# Precompiled regular expressions
trunk_rev = re.compile('^[0-9]+\\.[0-9]+$')
last_branch = re.compile('(.*)\\.[0-9]+')
is_branch = re.compile('^(.*)\\.0\\.([0-9]+)$')
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
SECONDS_PER_DAY = 86400
def __init__(self):
self.Reset()
def Reset(self):
self.last_revision = {}
self.prev_revision = {}
self.revision_date = {}
self.revision_author = {}
self.revision_branches = {}
self.next_delta = {}
self.prev_delta = {}
self.tag_revision = {}
self.timestamp = {}
self.revision_ctime = {}
self.revision_age = {}
self.revision_log = {}
self.revision_deltatext = {}
self.revision_map = [] # map line numbers to revisions
self.lines_added = {}
self.lines_removed = {}
# Map a tag to a numerical revision number. The tag can be a symbolic
# branch tag, a symbolic revision tag, or an ordinary numerical
# revision number.
def map_tag_to_revision(self, tag_or_revision):
try:
revision = self.tag_revision[tag_or_revision]
match = self.is_branch.match(revision)
if match:
branch = match.group(1) + '.' + match.group(2)
if self.last_revision.get(branch):
return self.last_revision[branch]
else:
return match.group(1)
else:
return revision
except:
return ''
# Construct an ordered list of ancestor revisions to the given
# revision, starting with the immediate ancestor and going back
# to the primordial revision (1.1).
#
# Note: The generated path does not traverse the tree the same way
# that the individual revision deltas do. In particular,
# the path traverses the tree "backwards" on branches.
def ancestor_revisions(self, revision):
ancestors = []
revision = self.prev_revision.get(revision)
while revision:
ancestors.append(revision)
revision = self.prev_revision.get(revision)
return ancestors
# Split deltatext specified by rev to each line.
def deltatext_split(self, rev):
lines = string.split(self.revision_deltatext[rev], '\n')
if lines[-1] == '':
del lines[-1]
return lines
# Extract the given revision from the digested RCS file.
# (Essentially the equivalent of cvs up -rXXX)
def extract_revision(self, revision):
path = []
add_lines_remaining = 0
start_line = 0
count = 0
while revision:
path.append(revision)
revision = self.prev_delta.get(revision)
path.reverse()
path = path[1:] # Get rid of head revision
text = self.deltatext_split(self.head_revision)
# Iterate, applying deltas to previous revision
for revision in path:
adjust = 0
diffs = self.deltatext_split(revision)
self.lines_added[revision] = 0
self.lines_removed[revision] = 0
lines_added_now = 0
lines_removed_now = 0
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if add_lines_remaining > 0:
# Insertion lines from a prior "a" command
text.insert(start_line + adjust, command)
add_lines_remaining = add_lines_remaining - 1
adjust = adjust + 1
elif dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
begin = start_line + adjust - 1
del text[begin:begin + count]
adjust = adjust - count
lines_removed_now = lines_removed_now + count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
add_lines_remaining = count
lines_added_now = lines_added_now + count
else:
raise RuntimeError, 'Error parsing diff commands'
self.lines_added[revision] = self.lines_added[revision] + lines_added_now
self.lines_removed[revision] = self.lines_removed[revision] + lines_removed_now
return text
def set_head_revision(self, revision):
self.head_revision = revision
def set_principal_branch(self, branch_name):
self.principal_branch = branch_name
def define_tag(self, name, revision):
# Create an associate array that maps from tag name to
# revision number and vice-versa.
self.tag_revision[name] = revision
def set_comment(self, comment):
self.file_description = comment
def set_description(self, description):
self.rcs_file_description = description
# Construct dicts that represent the topology of the RCS tree
# and other arrays that contain info about individual revisions.
#
# The following dicts are created, keyed by revision number:
# self.revision_date -- e.g. "96.02.23.00.21.52"
# self.timestamp -- seconds since 12:00 AM, Jan 1, 1970 GMT
# self.revision_author -- e.g. "tom"
# self.revision_branches -- descendant branch revisions, separated by spaces,
# e.g. "1.21.4.1 1.21.2.6.1"
# self.prev_revision -- revision number of previous *ancestor* in RCS tree.
# Traversal of this array occurs in the direction
# of the primordial (1.1) revision.
# self.prev_delta -- revision number of previous revision which forms
# the basis for the edit commands in this revision.
# This causes the tree to be traversed towards the
# trunk when on a branch, and towards the latest trunk
# revision when on the trunk.
# self.next_delta -- revision number of next "delta". Inverts prev_delta.
#
# Also creates self.last_revision, keyed by a branch revision number, which
# indicates the latest revision on a given branch,
# e.g. self.last_revision{"1.2.8"} == 1.2.8.5
def define_revision(self, revision, timestamp, author, state,
branches, next):
self.tag_revision[revision] = revision
branch = self.last_branch.match(revision).group(1)
self.last_revision[branch] = revision
#self.revision_date[revision] = date
self.timestamp[revision] = timestamp
# Pretty print the date string
ltime = time.localtime(self.timestamp[revision])
formatted_date = time.strftime("%d %b %Y %H:%M", ltime)
self.revision_ctime[revision] = formatted_date
# Save age
self.revision_age[revision] = ((time.time() - self.timestamp[revision])
/ self.SECONDS_PER_DAY)
# save author
self.revision_author[revision] = author
# ignore the state
# process the branch information
branch_text = ''
for branch in branches:
self.prev_revision[branch] = revision
self.next_delta[revision] = branch
self.prev_delta[branch] = revision
branch_text = branch_text + branch + ''
self.revision_branches[revision] = branch_text
# process the "next revision" information
if next:
self.next_delta[revision] = next
self.prev_delta[next] = revision
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
self.prev_revision[revision] = next
else:
self.prev_revision[next] = revision
# Construct associative arrays containing info about individual revisions.
#
# The following associative arrays are created, keyed by revision number:
# revision_log -- log message
# revision_deltatext -- Either the complete text of the revision,
# in the case of the head revision, or the
# encoded delta between this revision and another.
# The delta is either with respect to the successor
# revision if this revision is on the trunk or
# relative to its immediate predecessor if this
# revision is on a branch.
def set_revision_info(self, revision, log, text):
self.revision_log[revision] = log
self.revision_deltatext[revision] = text
def parse_cvs_file(self, rcs_pathname, opt_rev = None, opt_m_timestamp = None):
# Args in: opt_rev - requested revision
# opt_m - time since modified
# Args out: revision_map
# timestamp
# revision_deltatext
# CheckHidden(rcs_pathname)
try:
rcsfile = open(rcs_pathname, 'rb')
except:
raise RuntimeError, ('error: %s appeared to be under CVS control, ' +
'but the RCS file is inaccessible.') % rcs_pathname
rcsparse.Parser().parse(rcsfile, self)
rcsfile.close()
if opt_rev in [None, '', 'HEAD']:
# Explicitly specified topmost revision in tree
revision = self.head_revision
else:
# Symbolic tag or specific revision number specified.
revision = self.map_tag_to_revision(opt_rev)
if revision == '':
raise RuntimeError, 'error: -r: No such revision: ' + opt_rev
# The primordial revision is not always 1.1! Go find it.
primordial = revision
while self.prev_revision.get(primordial):
primordial = self.prev_revision[primordial]
# Don't display file at all, if -m option is specified and no
# changes have been made in the specified file.
if opt_m_timestamp and self.timestamp[revision] < opt_m_timestamp:
return ''
# Figure out how many lines were in the primordial, i.e. version 1.1,
# check-in by moving backward in time from the head revision to the
# first revision.
line_count = 0
if self.revision_deltatext.get(self.head_revision):
tmp_array = self.deltatext_split(self.head_revision)
line_count = len(tmp_array)
skip = 0
rev = self.prev_revision.get(self.head_revision)
while rev:
diffs = self.deltatext_split(rev)
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if skip > 0:
# Skip insertion lines from a prior "a" command
skip = skip - 1
elif dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
line_count = line_count - count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
skip = count
line_count = line_count + count
else:
raise RuntimeError, 'error: illegal RCS file'
rev = self.prev_revision.get(rev)
# Now, play the delta edit commands *backwards* from the primordial
# revision forward, but rather than applying the deltas to the text of
# each revision, apply the changes to an array of revision numbers.
# This creates a "revision map" -- an array where each element
# represents a line of text in the given revision but contains only
# the revision number in which the line was introduced rather than
# the line text itself.
#
# Note: These are backward deltas for revisions on the trunk and
# forward deltas for branch revisions.
# Create initial revision map for primordial version.
self.revision_map = [primordial] * line_count
ancestors = [revision, ] + self.ancestor_revisions(revision)
ancestors = ancestors[:-1] # Remove "1.1"
last_revision = primordial
ancestors.reverse()
for revision in ancestors:
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
diffs = self.deltatext_split(last_revision)
# Revisions on the trunk specify deltas that transform a
# revision into an earlier revision, so invert the translation
# of the 'diff' commands.
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line - 1] +
temp + self.revision_map[start_line - 1:])
elif amatch:
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
del self.revision_map[start_line:start_line + count]
skip = count
else:
raise RuntimeError, 'Error parsing diff commands'
else:
# Revisions on a branch are arranged backwards from those on
# the trunk. They specify deltas that transform a revision
# into a later revision.
adjust = 0
diffs = self.deltatext_split(revision)
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
adj_begin = start_line + adjust - 1
adj_end = start_line + adjust - 1 + count
del self.revision_map[adj_begin:adj_end]
adjust = adjust - count
elif amatch:
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
skip = count
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line + adjust] +
temp + self.revision_map[start_line + adjust:])
adjust = adjust + skip
else:
raise RuntimeError, 'Error parsing diff commands'
last_revision = revision
return revision
class BlameSource:
def __init__(self, rcs_file, opt_rev=None):
# Parse the CVS file
parser = CVSParser()
revision = parser.parse_cvs_file(rcs_file, opt_rev)
count = len(parser.revision_map)
lines = parser.extract_revision(revision)
if len(lines) != count:
raise RuntimeError, 'Internal consistency error'
# set up some state variables
self.revision = revision
self.lines = lines
self.num_lines = count
self.parser = parser
# keep track of where we are during an iteration
self.idx = -1
self.last = None
def __getitem__(self, idx):
if idx == self.idx:
return self.last
if idx >= self.num_lines:
raise IndexError("No more annotations")
if idx != self.idx + 1:
raise BlameSequencingError()
# Get the line and metadata for it.
rev = self.parser.revision_map[idx]
prev_rev = self.parser.prev_revision.get(rev)
line_number = idx + 1
author = self.parser.revision_author[rev]
thisline = self.lines[idx]
### TODO: Put a real date in here.
item = _item(text=thisline, line_number=line_number, rev=rev,
prev_rev=prev_rev, author=author, date=None)
self.last = item
self.idx = idx
return item
class BlameSequencingError(Exception):
pass
class _item:
def __init__(self, **kw):
vars(self).update(kw)

View File

@@ -0,0 +1,26 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""This package provides parsing tools for RCS files."""
from common import *
try:
from tparse import parse
except ImportError:
try:
from texttools import Parser
except ImportError:
from default import Parser
def parse(file, sink):
return Parser().parse(file, sink)

View File

@@ -0,0 +1,290 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""common.py: common classes and functions for the RCS parsing tools."""
import time
import string
### compat isn't in vclib right now. need to work up a solution
import compat
class Sink:
def set_head_revision(self, revision):
pass
def set_principal_branch(self, branch_name):
pass
def define_tag(self, name, revision):
pass
def set_access(self, accessors):
pass
def set_expansion(self, mode):
pass
def set_locking(self, mode):
"""Used to signal locking mode.
Called with mode argument 'strict' if strict locking
Not called when no locking used."""
pass
def set_locker(self, revision, locker):
pass
def set_comment(self, comment):
pass
def set_description(self, description):
pass
def define_revision(self, revision, timestamp, author, state,
branches, next):
pass
def set_revision_info(self, revision, log, text):
pass
def admin_completed(self):
pass
def tree_completed(self):
pass
def parse_completed(self):
pass
# --------------------------------------------------------------------------
#
# EXCEPTIONS USED BY RCSPARSE
#
class RCSParseError(Exception):
pass
class RCSIllegalCharacter(RCSParseError):
pass
### need more work on this one
class RCSExpected(RCSParseError):
def __init__(self, got, wanted):
RCSParseError.__init__(self, got, wanted)
class RCSStopParser(Exception):
pass
# --------------------------------------------------------------------------
#
# STANDARD TOKEN STREAM-BASED PARSER
#
class _Parser:
stream_class = None # subclasses need to define this
def parse_rcs_admin(self):
while 1:
# Read initial token at beginning of line
token = self.ts.get()
# We're done once we reach the description of the RCS tree
if token[0] in string.digits:
self.ts.unget(token)
return
if token == "head":
semi, rev = self.ts.mget(2)
self.sink.set_head_revision(rev)
if semi != ';':
raise RCSExpected(semi, ';')
elif token == "branch":
semi, branch = self.ts.mget(2)
if semi == ';':
self.sink.set_principal_branch(branch)
else:
if branch == ';':
self.ts.unget(semi);
else:
raise RCSExpected(semi, ';')
elif token == "symbols":
while 1:
tag = self.ts.get()
if tag == ';':
break
self.ts.match(':')
tag_name = tag
tag_rev = self.ts.get()
self.sink.define_tag(tag_name, tag_rev)
elif token == "comment":
semi, comment = self.ts.mget(2)
self.sink.set_comment(comment)
if semi != ';':
raise RCSExpected(semi, ';')
elif token == "expand":
semi, expand_mode = self.ts.mget(2)
self.sink.set_expansion(expand_mode)
if semi != ';':
raise RCSExpected(semi, ';')
elif token == "locks":
while 1:
tag = self.ts.get()
if tag == ';':
break
(locker, rev) = string.split(tag,':')
self.sink.set_locker(rev, locker)
tag = self.ts.get()
if tag == "strict":
self.sink.set_locking("strict")
self.ts.match(';')
else:
self.ts.unget(tag)
elif token == "access":
accessors = []
while 1:
tag = self.ts.get()
if tag == ';':
if accessors != []:
self.sink.set_access(accessors)
break
accessors = accessors + [ tag ]
# Chew up "newphrase"
else:
pass
# warn("Unexpected RCS token: $token\n")
raise RuntimeError, "Unexpected EOF"
def parse_rcs_tree(self):
while 1:
revision = self.ts.get()
# End of RCS tree description ?
if revision == 'desc':
self.ts.unget(revision)
return
# Parse date
semi, date, sym = self.ts.mget(3)
if sym != 'date':
raise RCSExpected(sym, 'date')
if semi != ';':
raise RCSExpected(semi, ';')
# Convert date into timestamp
date_fields = string.split(date, '.') + ['0', '0', '0']
date_fields = map(string.atoi, date_fields)
# need to make the date four digits for timegm
EPOCH = 1970
if date_fields[0] < EPOCH:
if date_fields[0] < 70:
date_fields[0] = date_fields[0] + 2000
else:
date_fields[0] = date_fields[0] + 1900
if date_fields[0] < EPOCH:
raise ValueError, 'invalid year'
timestamp = compat.timegm(tuple(date_fields))
# Parse author
### NOTE: authors containing whitespace are violations of the
### RCS specification. We are making an allowance here because
### CVSNT is known to produce these sorts of authors.
self.ts.match('author')
author = ''
while 1:
token = self.ts.get()
if token == ';':
break
author = author + token + ' '
author = author[:-1] # toss the trailing space
# Parse state
self.ts.match('state')
state = ''
while 1:
token = self.ts.get()
if token == ';':
break
state = state + token + ' '
state = state[:-1] # toss the trailing space
# Parse branches
self.ts.match('branches')
branches = [ ]
while 1:
token = self.ts.get()
if token == ';':
break
branches.append(token)
# Parse revision of next delta in chain
next, sym = self.ts.mget(2)
if sym != 'next':
raise RCSExpected(sym, 'next')
if next == ';':
next = None
else:
self.ts.match(';')
# there are some files with extra tags in them. for example:
# owner 640;
# group 15;
# permissions 644;
# hardlinks @configure.in@;
# this is "newphrase" in RCSFILE(5). we just want to skip over these.
while 1:
token = self.ts.get()
if token == 'desc' or token[0] in string.digits:
self.ts.unget(token)
break
# consume everything up to the semicolon
while self.ts.get() != ';':
pass
self.sink.define_revision(revision, timestamp, author, state, branches,
next)
def parse_rcs_description(self):
self.ts.match('desc')
self.sink.set_description(self.ts.get())
def parse_rcs_deltatext(self):
while 1:
revision = self.ts.get()
if revision is None:
# EOF
break
text, sym2, log, sym1 = self.ts.mget(4)
if sym1 != 'log':
print `text[:100], sym2[:100], log[:100], sym1[:100]`
raise RCSExpected(sym1, 'log')
if sym2 != 'text':
raise RCSExpected(sym2, 'text')
### need to add code to chew up "newphrase"
self.sink.set_revision_info(revision, log, text)
def parse(self, file, sink):
self.ts = self.stream_class(file)
self.sink = sink
self.parse_rcs_admin()
# let sink know when the admin section has been completed
self.sink.admin_completed()
self.parse_rcs_tree()
# many sinks want to know when the tree has been completed so they can
# do some work to prep for the arrival of the deltatext
self.sink.tree_completed()
self.parse_rcs_description()
self.parse_rcs_deltatext()
# easiest for us to tell the sink it is done, rather than worry about
# higher level software doing it.
self.sink.parse_completed()
self.ts = self.sink = None
# --------------------------------------------------------------------------

View File

@@ -0,0 +1,122 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""debug.py: various debugging tools for the rcsparse package."""
import time
from __init__ import parse
import common
class DebugSink(common.Sink):
def set_head_revision(self, revision):
print 'head:', revision
def set_principal_branch(self, branch_name):
print 'branch:', branch_name
def define_tag(self, name, revision):
print 'tag:', name, '=', revision
def set_comment(self, comment):
print 'comment:', comment
def set_description(self, description):
print 'description:', description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print 'revision:', revision
print ' timestamp:', timestamp
print ' author:', author
print ' state:', state
print ' branches:', branches
print ' next:', next
def set_revision_info(self, revision, log, text):
print 'revision:', revision
print ' log:', log
print ' text:', text[:100], '...'
class DumpSink(common.Sink):
"""Dump all the parse information directly to stdout.
The output is relatively unformatted and untagged. It is intended as a
raw dump of the data in the RCS file. A copy can be saved, then changes
made to the parsing engine, then a comparison of the new output against
the old output.
"""
def __init__(self):
global sha
import sha
def set_head_revision(self, revision):
print revision
def set_principal_branch(self, branch_name):
print branch_name
def define_tag(self, name, revision):
print name, revision
def set_comment(self, comment):
print comment
def set_description(self, description):
print description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print revision, timestamp, author, state, branches, next
def set_revision_info(self, revision, log, text):
print revision, sha.new(log).hexdigest(), sha.new(text).hexdigest()
def tree_completed(self):
print 'tree_completed'
def parse_completed(self):
print 'parse_completed'
def dump_file(fname):
parse(open(fname, 'rb'), DumpSink())
def time_file(fname):
f = open(fname, 'rb')
s = common.Sink()
t = time.time()
parse(f, s)
t = time.time() - t
print t
def _usage():
print 'This is normally a module for importing, but it has a couple'
print 'features for testing as an executable script.'
print 'USAGE: %s COMMAND filename,v' % sys.argv[0]
print ' where COMMAND is one of:'
print ' dump: filename is "dumped" to stdout'
print ' time: filename is parsed with the time written to stdout'
sys.exit(1)
if __name__ == '__main__':
import sys
if len(sys.argv) != 3:
_usage()
if sys.argv[1] == 'dump':
dump_file(sys.argv[2])
elif sys.argv[1] == 'time':
time_file(sys.argv[2])
else:
_usage()

View File

@@ -0,0 +1,240 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# This file was originally based on portions of the blame.py script by
# Curt Hagenlocher.
#
# -----------------------------------------------------------------------
import string
import common
class _TokenStream:
token_term = string.whitespace + ';'
# the algorithm is about the same speed for any CHUNK_SIZE chosen.
# grab a good-sized chunk, but not too large to overwhelm memory.
# note: we use a multiple of a standard block size
CHUNK_SIZE = 192 * 512 # about 100k
# CHUNK_SIZE = 5 # for debugging, make the function grind...
def __init__(self, file):
self.rcsfile = file
self.idx = 0
self.buf = self.rcsfile.read(self.CHUNK_SIZE)
if self.buf == '':
raise RuntimeError, 'EOF'
def get(self):
"Get the next token from the RCS file."
# Note: we can afford to loop within Python, examining individual
# characters. For the whitespace and tokens, the number of iterations
# is typically quite small. Thus, a simple iterative loop will beat
# out more complex solutions.
buf = self.buf
idx = self.idx
while 1:
if idx == len(buf):
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
# signal EOF by returning None as the token
del self.buf # so we fail if get() is called again
return None
idx = 0
if buf[idx] not in string.whitespace:
break
idx = idx + 1
if buf[idx] == ';':
self.buf = buf
self.idx = idx + 1
return ';'
if buf[idx] != '@':
end = idx + 1
token = ''
while 1:
# find token characters in the current buffer
while end < len(buf) and buf[end] not in self.token_term:
end = end + 1
token = token + buf[idx:end]
if end < len(buf):
# we stopped before the end, so we have a full token
idx = end
break
# we stopped at the end of the buffer, so we may have a partial token
buf = self.rcsfile.read(self.CHUNK_SIZE)
idx = end = 0
self.buf = buf
self.idx = idx
return token
# a "string" which starts with the "@" character. we'll skip it when we
# search for content.
idx = idx + 1
chunks = [ ]
while 1:
if idx == len(buf):
idx = 0
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
raise RuntimeError, 'EOF'
i = string.find(buf, '@', idx)
if i == -1:
chunks.append(buf[idx:])
idx = len(buf)
continue
if i == len(buf) - 1:
chunks.append(buf[idx:i])
idx = 0
buf = '@' + self.rcsfile.read(self.CHUNK_SIZE)
if buf == '@':
raise RuntimeError, 'EOF'
continue
if buf[i + 1] == '@':
chunks.append(buf[idx:i+1])
idx = i + 2
continue
chunks.append(buf[idx:i])
self.buf = buf
self.idx = i + 1
return string.join(chunks, '')
# _get = get
# def get(self):
token = self._get()
print 'T:', `token`
return token
def match(self, match):
"Try to match the next token from the input buffer."
token = self.get()
if token != match:
raise RuntimeError, ('Unexpected parsing error in RCS file.\n' +
'Expected token: %s, but saw: %s' % (match, token))
def unget(self, token):
"Put this token back, for the next get() to return."
# Override the class' .get method with a function which clears the
# overridden method then returns the pushed token. Since this function
# will not be looked up via the class mechanism, it should be a "normal"
# function, meaning it won't have "self" automatically inserted.
# Therefore, we need to pass both self and the token thru via defaults.
# note: we don't put this into the input buffer because it may have been
# @-unescaped already.
def give_it_back(self=self, token=token):
del self.get
return token
self.get = give_it_back
def mget(self, count):
"Return multiple tokens. 'next' is at the end."
result = [ ]
for i in range(count):
result.append(self.get())
result.reverse()
return result
class Parser(common._Parser):
stream_class = _TokenStream
def parse_rcs_admin(self):
while 1:
# Read initial token at beginning of line
token = self.ts.get()
# We're done once we reach the description of the RCS tree
if token[0] in string.digits:
self.ts.unget(token)
return
if token == "head":
semi, rev = self.ts.mget(2)
self.sink.set_head_revision(rev)
if semi != ';':
raise common.RCSExpected(semi, ';')
elif token == "branch":
semi, branch = self.ts.mget(2)
if semi == ';':
self.sink.set_principal_branch(branch)
else:
if branch == ';':
self.ts.unget(semi);
else:
raise common.RCSExpected(semi, ';')
elif token == "symbols":
while 1:
tag = self.ts.get()
if tag == ';':
break
(tag_name, tag_rev) = string.split(tag, ':')
self.sink.define_tag(tag_name, tag_rev)
elif token == "comment":
semi, comment = self.ts.mget(2)
self.sink.set_comment(comment)
if semi != ';':
raise common.RCSExpected(semi, ';')
elif token == "expand":
semi, expand_mode = self.ts.mget(2)
self.sink.set_expansion(expand_mode)
if semi != ';':
raise RCSExpected(semi, ';')
elif token == "locks":
while 1:
tag = self.ts.get()
if tag == ';':
break
(locker, rev) = string.split(tag,':')
self.sink.set_locker(rev, locker)
tag = self.ts.get()
if tag == "strict":
self.sink.set_locking("strict")
self.ts.match(';')
else:
self.ts.unget(tag)
elif token == "access":
accessors = []
while 1:
tag = self.ts.get()
if tag == ';':
if accessors != []:
self.sink.set_access(accessors)
break
accessors = accessors + [ tag ]
# Chew up "newphrase".
else:
pass
# warn("Unexpected RCS token: $token\n")
raise RuntimeError, "Unexpected EOF"

View File

@@ -0,0 +1,309 @@
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import string
# note: this will raise an ImportError if it isn't available. the rcsparse
# package will recognize this and switch over to the default parser.
from mx import TextTools
import common
# for convenience
_tt = TextTools
_idchar_list = map(chr, range(33, 127)) + map(chr, range(160, 256))
_idchar_list.remove('$')
_idchar_list.remove(',')
#_idchar_list.remove('.') # leave as part of 'num' symbol
_idchar_list.remove(':')
_idchar_list.remove(';')
_idchar_list.remove('@')
_idchar = string.join(_idchar_list, '')
_idchar_set = _tt.set(_idchar)
_onechar_token_set = _tt.set(':;')
_not_at_set = _tt.invset('@')
_T_TOKEN = 30
_T_STRING_START = 40
_T_STRING_SPAN = 60
_T_STRING_END = 70
_E_COMPLETE = 100 # ended on a complete token
_E_TOKEN = 110 # ended mid-token
_E_STRING_SPAN = 130 # ended within a string
_E_STRING_END = 140 # ended with string-end ('@') (could be mid-@@)
_SUCCESS = +100
_EOF = 'EOF'
_CONTINUE = 'CONTINUE'
_UNUSED = 'UNUSED'
# continuation of a token over a chunk boundary
_c_token_table = (
(_T_TOKEN, _tt.AllInSet, _idchar_set),
)
class _mxTokenStream:
# the algorithm is about the same speed for any CHUNK_SIZE chosen.
# grab a good-sized chunk, but not too large to overwhelm memory.
# note: we use a multiple of a standard block size
CHUNK_SIZE = 192 * 512 # about 100k
# CHUNK_SIZE = 5 # for debugging, make the function grind...
def __init__(self, file):
self.rcsfile = file
self.tokens = [ ]
self.partial = None
self.string_end = None
def _parse_chunk(self, buf, start=0):
"Get the next token from the RCS file."
buflen = len(buf)
assert start < buflen
# construct a tag table which refers to the buffer we need to parse.
table = (
# ignore whitespace. with or without whitespace, move to the next rule.
(None, _tt.AllInSet, _tt.whitespace_set, +1),
(_E_COMPLETE, _tt.EOF + _tt.AppendTagobj, _tt.Here, +1, _SUCCESS),
# accumulate token text and exit, or move to the next rule.
(_UNUSED, _tt.AllInSet + _tt.AppendMatch, _idchar_set, +2),
(_E_TOKEN, _tt.EOF + _tt.AppendTagobj, _tt.Here, -3, _SUCCESS),
# single character tokens exit immediately, or move to the next rule
(_UNUSED, _tt.IsInSet + _tt.AppendMatch, _onechar_token_set, +2),
(_E_COMPLETE, _tt.EOF + _tt.AppendTagobj, _tt.Here, -5, _SUCCESS),
# if this isn't an '@' symbol, then we have a syntax error (go to a
# negative index to indicate that condition). otherwise, suck it up
# and move to the next rule.
(_T_STRING_START, _tt.Is + _tt.AppendTagobj, '@'),
(None, _tt.Is, '@', +4, +1),
(buf, _tt.Is, '@', +1, -1),
(_T_STRING_END, _tt.Skip + _tt.AppendTagobj, 0, 0, +1),
(_E_STRING_END, _tt.EOF + _tt.AppendTagobj, _tt.Here, -10, _SUCCESS),
(_E_STRING_SPAN, _tt.EOF + _tt.AppendTagobj, _tt.Here, +1, _SUCCESS),
# suck up everything that isn't an AT. go to next rule to look for EOF
(buf, _tt.AllInSet, _not_at_set, 0, +1),
# go back to look for double AT if we aren't at the end of the string
(_E_STRING_SPAN, _tt.EOF + _tt.AppendTagobj, _tt.Here, -6, _SUCCESS),
)
success, taglist, idx = _tt.tag(buf, table, start)
if not success:
### need a better way to report this error
raise common.RCSIllegalCharacter()
assert idx == buflen
# pop off the last item
last_which = taglist.pop()
i = 0
tlen = len(taglist)
while i < tlen:
if taglist[i] == _T_STRING_START:
j = i + 1
while j < tlen:
if taglist[j] == _T_STRING_END:
s = _tt.join(taglist, '', i+1, j)
del taglist[i:j]
tlen = len(taglist)
taglist[i] = s
break
j = j + 1
else:
assert last_which == _E_STRING_SPAN
s = _tt.join(taglist, '', i+1)
del taglist[i:]
self.partial = (_T_STRING_SPAN, [ s ])
break
i = i + 1
# figure out whether we have a partial last-token
if last_which == _E_TOKEN:
self.partial = (_T_TOKEN, [ taglist.pop() ])
elif last_which == _E_COMPLETE:
pass
elif last_which == _E_STRING_SPAN:
assert self.partial
else:
assert last_which == _E_STRING_END
self.partial = (_T_STRING_END, [ taglist.pop() ])
taglist.reverse()
taglist.extend(self.tokens)
self.tokens = taglist
def _set_end(self, taglist, text, l, r, subtags):
self.string_end = l
def _handle_partial(self, buf):
which, chunks = self.partial
if which == _T_TOKEN:
success, taglist, idx = _tt.tag(buf, _c_token_table)
if not success:
# The start of this buffer was not a token. So the end of the
# prior buffer was a complete token.
self.tokens.insert(0, string.join(chunks, ''))
else:
assert len(taglist) == 1 and taglist[0][0] == _T_TOKEN \
and taglist[0][1] == 0 and taglist[0][2] == idx
if idx == len(buf):
#
# The whole buffer was one huge token, so we may have a
# partial token again.
#
# Note: this modifies the list of chunks in self.partial
#
chunks.append(buf)
# consumed the whole buffer
return len(buf)
# got the rest of the token.
chunks.append(buf[:idx])
self.tokens.insert(0, string.join(chunks, ''))
# no more partial token
self.partial = None
return idx
if which == _T_STRING_END:
if buf[0] != '@':
self.tokens.insert(0, string.join(chunks, ''))
return 0
chunks.append('@')
start = 1
else:
start = 0
self.string_end = None
string_table = (
(None, _tt.Is, '@', +3, +1),
(_UNUSED, _tt.Is + _tt.AppendMatch, '@', +1, -1),
(self._set_end, _tt.Skip + _tt.CallTag, 0, 0, _SUCCESS),
(None, _tt.EOF, _tt.Here, +1, _SUCCESS),
# suck up everything that isn't an AT. move to next rule to look
# for EOF
(_UNUSED, _tt.AllInSet + _tt.AppendMatch, _not_at_set, 0, +1),
# go back to look for double AT if we aren't at the end of the string
(None, _tt.EOF, _tt.Here, -5, _SUCCESS),
)
success, unused, idx = _tt.tag(buf, string_table,
start, len(buf), chunks)
# must have matched at least one item
assert success
if self.string_end is None:
assert idx == len(buf)
self.partial = (_T_STRING_SPAN, chunks)
elif self.string_end < len(buf):
self.partial = None
self.tokens.insert(0, string.join(chunks, ''))
else:
self.partial = (_T_STRING_END, chunks)
return idx
def _parse_more(self):
buf = self.rcsfile.read(self.CHUNK_SIZE)
if not buf:
return _EOF
if self.partial:
idx = self._handle_partial(buf)
if idx is None:
return _CONTINUE
if idx < len(buf):
self._parse_chunk(buf, idx)
else:
self._parse_chunk(buf)
return _CONTINUE
def get(self):
try:
return self.tokens.pop()
except IndexError:
pass
while not self.tokens:
action = self._parse_more()
if action == _EOF:
return None
return self.tokens.pop()
# _get = get
# def get(self):
token = self._get()
print 'T:', `token`
return token
def match(self, match):
if self.tokens:
token = self.tokens.pop()
if token != match:
raise RuntimeError, ('Unexpected parsing error in RCS file.\n'
'Expected token: %s, but saw: %s'
% (match, token))
else:
token = self.get()
if token != match:
raise RuntimeError, ('Unexpected parsing error in RCS file.\n'
'Expected token: %s, but saw: %s'
% (match, token))
def unget(self, token):
self.tokens.append(token)
def mget(self, count):
"Return multiple tokens. 'next' is at the end."
while len(self.tokens) < count:
action = self._parse_more()
if action == _EOF:
### fix this
raise RuntimeError, 'EOF hit while expecting tokens'
result = self.tokens[-count:]
del self.tokens[-count:]
return result
class Parser(common._Parser):
stream_class = _mxTokenStream

752
lib/vclib/svn/__init__.py Normal file
View File

@@ -0,0 +1,752 @@
# -*-python-*-
#
# Copyright (C) 1999-2008 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"Version Control lib driver for locally accessible Subversion repositories"
import vclib
import os
import os.path
import stat
import string
import cStringIO
import signal
import shutil
import time
import tempfile
import popen
import re
from svn import fs, repos, core, delta
### Require Subversion 1.2.0 or better.
if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_PATCH) < (1, 2, 0):
raise Exception, "Version requirement not met (needs 1.2.0 or better)"
def _allow_all(root, path, pool):
"""Generic authz_read_func that permits access to all paths"""
return 1
def _fs_path_join(base, relative):
# Subversion filesystem paths are '/'-delimited, regardless of OS.
joined_path = base + '/' + relative
parts = filter(None, string.split(joined_path, '/'))
return string.join(parts, '/')
def _cleanup_path(path):
"""Return a cleaned-up Subversion filesystem path"""
return string.join(filter(None, string.split(path, '/')), '/')
def _compare_paths(path1, path2):
path1_len = len (path1);
path2_len = len (path2);
min_len = min(path1_len, path2_len)
i = 0
# Are the paths exactly the same?
if path1 == path2:
return 0
# Skip past common prefix
while (i < min_len) and (path1[i] == path2[i]):
i = i + 1
# Children of paths are greater than their parents, but less than
# greater siblings of their parents
char1 = '\0'
char2 = '\0'
if (i < path1_len):
char1 = path1[i]
if (i < path2_len):
char2 = path2[i]
if (char1 == '/') and (i == path2_len):
return 1
if (char2 == '/') and (i == path1_len):
return -1
if (i < path1_len) and (char1 == '/'):
return -1
if (i < path2_len) and (char2 == '/'):
return 1
# Common prefix was skipped above, next character is compared to
# determine order
return cmp(char1, char2)
def _datestr_to_date(datestr, pool):
if datestr is None:
return None
return core.svn_time_from_cstring(datestr, pool) / 1000000
def _fs_rev_props(fsptr, rev, pool):
author = fs.revision_prop(fsptr, rev, core.SVN_PROP_REVISION_AUTHOR, pool)
msg = fs.revision_prop(fsptr, rev, core.SVN_PROP_REVISION_LOG, pool)
date = fs.revision_prop(fsptr, rev, core.SVN_PROP_REVISION_DATE, pool)
return date, author, msg
def date_from_rev(svnrepos, rev):
if (rev < 0) or (rev > svnrepos.youngest):
raise vclib.InvalidRevision(rev)
datestr = fs.revision_prop(svnrepos.fs_ptr, rev,
core.SVN_PROP_REVISION_DATE, svnrepos.pool)
return _datestr_to_date(datestr, svnrepos.pool)
def get_location(svnrepos, path, rev, old_rev):
try:
results = repos.svn_repos_trace_node_locations(svnrepos.fs_ptr, path,
rev, [old_rev],
_allow_all, svnrepos.pool)
except core.SubversionException, e:
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
raise vclib.ItemNotFound(path)
raise
try:
old_path = results[old_rev]
except KeyError:
raise vclib.ItemNotFound(path)
return _cleanup_path(old_path)
def last_rev(svnrepos, path, peg_revision, limit_revision=None):
"""Given PATH, known to exist in PEG_REVISION, find the youngest
revision older than, or equal to, LIMIT_REVISION in which path
exists. Return that revision, and the path at which PATH exists in
that revision."""
# Here's the plan, man. In the trivial case (where PEG_REVISION is
# the same as LIMIT_REVISION), this is a no-brainer. If
# LIMIT_REVISION is older than PEG_REVISION, we can use Subversion's
# history tracing code to find the right location. If, however,
# LIMIT_REVISION is younger than PEG_REVISION, we suffer from
# Subversion's lack of forward history searching. Our workaround,
# ugly as it may be, involves a binary search through the revisions
# between PEG_REVISION and LIMIT_REVISION to find our last live
# revision.
peg_revision = svnrepos._getrev(peg_revision)
limit_revision = svnrepos._getrev(limit_revision)
try:
if peg_revision == limit_revision:
return peg_revision, path
elif peg_revision > limit_revision:
fsroot = svnrepos._getroot(peg_revision)
history = fs.node_history(fsroot, path, svnrepos.scratch_pool)
while history:
path, peg_revision = fs.history_location(history,
svnrepos.scratch_pool);
if peg_revision <= limit_revision:
return max(peg_revision, limit_revision), _cleanup_path(path)
history = fs.history_prev(history, 1, svnrepos.scratch_pool)
return peg_revision, _cleanup_path(path)
else:
### Warning: this is *not* an example of good pool usage.
orig_id = fs.node_id(svnrepos._getroot(peg_revision), path,
svnrepos.scratch_pool)
while peg_revision != limit_revision:
mid = (peg_revision + 1 + limit_revision) / 2
try:
mid_id = fs.node_id(svnrepos._getroot(mid), path,
svnrepos.scratch_pool)
except core.SubversionException, e:
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
cmp = -1
else:
raise
else:
### Not quite right. Need a comparison function that only returns
### true when the two nodes are the same copy, not just related.
cmp = fs.compare_ids(orig_id, mid_id)
if cmp in (0, 1):
peg_revision = mid
else:
limit_revision = mid - 1
return peg_revision, path
finally:
svnrepos._scratch_clear()
def created_rev(svnrepos, full_name, rev):
fsroot = svnrepos._getroot(rev)
return fs.node_created_rev(fsroot, full_name, svnrepos.pool)
class Revision(vclib.Revision):
"Hold state for each revision's log entry."
def __init__(self, rev, date, author, msg, size,
filename, copy_path, copy_rev):
vclib.Revision.__init__(self, rev, str(rev), date, author, None, msg, size)
self.filename = filename
self.copy_path = copy_path
self.copy_rev = copy_rev
class NodeHistory:
def __init__(self, fs_ptr, show_all_logs):
self.histories = {}
self.fs_ptr = fs_ptr
self.show_all_logs = show_all_logs
def add_history(self, path, revision, pool):
# If filtering, only add the path and revision to the histories
# list if they were actually changed in this revision (where
# change means the path itself was changed, or one of its parents
# was copied). This is useful for omitting bubble-up directory
# changes.
if not self.show_all_logs:
rev_root = fs.revision_root(self.fs_ptr, revision, pool)
changed_paths = fs.paths_changed(rev_root, pool)
paths = changed_paths.keys()
if path not in paths:
# Look for a copied parent
test_path = path
found = 0
subpool = core.svn_pool_create(pool)
while 1:
core.svn_pool_clear(subpool)
off = string.rfind(test_path, '/')
if off < 0:
break
test_path = test_path[0:off]
if test_path in paths:
copyfrom_rev, copyfrom_path = \
fs.copied_from(rev_root, test_path, subpool)
if copyfrom_rev >= 0 and copyfrom_path:
found = 1
break
core.svn_pool_destroy(subpool)
if not found:
return
self.histories[revision] = _cleanup_path(path)
def _get_history(svnrepos, full_name, rev, options={}):
fsroot = svnrepos._getroot(rev)
show_all_logs = options.get('svn_show_all_dir_logs', 0)
if not show_all_logs:
# See if the path is a file or directory.
kind = fs.check_path(fsroot, full_name, svnrepos.pool)
if kind is core.svn_node_file:
show_all_logs = 1
# Instantiate a NodeHistory collector object.
history = NodeHistory(svnrepos.fs_ptr, show_all_logs)
# Do we want to cross copy history?
cross_copies = options.get('svn_cross_copies', 0)
# Get the history items for PATH.
repos.svn_repos_history(svnrepos.fs_ptr, full_name, history.add_history,
1, rev, cross_copies, svnrepos.pool)
return history.histories
class ChangedPath:
def __init__(self, filename, pathtype, prop_mods, text_mods,
base_path, base_rev, action, is_copy):
self.filename = filename
self.pathtype = pathtype
self.prop_mods = prop_mods
self.text_mods = text_mods
self.base_path = base_path
self.base_rev = base_rev
self.action = action
self.is_copy = is_copy
def get_revision_info(svnrepos, rev):
fsroot = svnrepos._getroot(rev)
# Get the changes for the revision
editor = repos.ChangeCollector(svnrepos.fs_ptr, fsroot, svnrepos.pool)
e_ptr, e_baton = delta.make_editor(editor, svnrepos.pool)
repos.svn_repos_replay(fsroot, e_ptr, e_baton, svnrepos.pool)
changes = editor.get_changes()
changedpaths = {}
# Copy the Subversion changes into a new hash, converting them into
# ChangedPath objects.
for path in changes.keys():
change = changes[path]
if change.path:
change.path = _cleanup_path(change.path)
if change.base_path:
change.base_path = _cleanup_path(change.base_path)
is_copy = 0
if not hasattr(change, 'action'): # new to subversion 1.4.0
action = 'modified'
if not change.path:
action = 'deleted'
elif change.added:
action = 'added'
replace_check_path = path
if change.base_path and change.base_rev:
replace_check_path = change.base_path
if changedpaths.has_key(replace_check_path) \
and changedpaths[replace_check_path].action == 'deleted':
action = 'replaced'
else:
if change.action == repos.CHANGE_ACTION_ADD:
action = 'added'
elif change.action == repos.CHANGE_ACTION_DELETE:
action = 'deleted'
elif change.action == repos.CHANGE_ACTION_REPLACE:
action = 'replaced'
else:
action = 'modified'
if (action == 'added' or action == 'replaced') \
and change.base_path \
and change.base_rev:
is_copy = 1
if change.item_kind == core.svn_node_dir:
pathtype = vclib.DIR
elif change.item_kind == core.svn_node_file:
pathtype = vclib.FILE
else:
pathtype = None
changedpaths[path] = ChangedPath(path, pathtype, change.prop_changes,
change.text_changed, change.base_path,
change.base_rev, action, is_copy)
# Actually, what we want is a sorted list of ChangedPath objects.
change_items = changedpaths.values()
change_items.sort(lambda a, b: _compare_paths(a.filename, b.filename))
# Now get the revision property info. Would use
# editor.get_root_props(), but something is broken there...
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, svnrepos.pool)
date = _datestr_to_date(datestr, svnrepos.pool)
return date, author, msg, change_items
def _log_helper(svnrepos, rev, path, pool):
rev_root = fs.revision_root(svnrepos.fs_ptr, rev, pool)
# Was this path@rev the target of a copy?
copyfrom_rev, copyfrom_path = fs.copied_from(rev_root, path, pool)
# Assemble our LogEntry
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, pool)
date = _datestr_to_date(datestr, pool)
if fs.is_file(rev_root, path, pool):
size = fs.file_length(rev_root, path, pool)
else:
size = None
entry = Revision(rev, date, author, msg, size, path,
copyfrom_path and _cleanup_path(copyfrom_path),
copyfrom_rev)
return entry
def _fetch_log(svnrepos, full_name, which_rev, options, pool):
revs = []
if options.get('svn_latest_log', 0):
rev = _log_helper(svnrepos, which_rev, full_name, pool)
if rev:
revs.append(rev)
else:
history_set = _get_history(svnrepos, full_name, which_rev, options)
history_revs = history_set.keys()
history_revs.sort()
history_revs.reverse()
subpool = core.svn_pool_create(pool)
for history_rev in history_revs:
core.svn_pool_clear(subpool)
rev = _log_helper(svnrepos, history_rev, history_set[history_rev],
subpool)
if rev:
revs.append(rev)
core.svn_pool_destroy(subpool)
return revs
def _get_last_history_rev(fsroot, path, pool):
history = fs.node_history(fsroot, path, pool)
history = fs.history_prev(history, 0, pool)
history_path, history_rev = fs.history_location(history, pool);
return history_rev
def get_logs(svnrepos, full_name, rev, files):
fsroot = svnrepos._getroot(rev)
subpool = core.svn_pool_create(svnrepos.pool)
for file in files:
core.svn_pool_clear(subpool)
path = _fs_path_join(full_name, file.name)
rev = _get_last_history_rev(fsroot, path, subpool)
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, subpool)
date = _datestr_to_date(datestr, subpool)
file.rev = str(rev)
file.date = date
file.author = author
file.log = msg
if file.kind == vclib.FILE:
file.size = fs.file_length(fsroot, path, subpool)
core.svn_pool_destroy(subpool)
def get_youngest_revision(svnrepos):
return svnrepos.youngest
def temp_checkout(svnrepos, path, rev, pool):
"""Check out file revision to temporary file"""
temp = tempfile.mktemp()
fp = open(temp, 'wb')
try:
root = svnrepos._getroot(rev)
stream = fs.file_contents(root, path, pool)
try:
while 1:
chunk = core.svn_stream_read(stream, core.SVN_STREAM_CHUNK_SIZE)
if not chunk:
break
fp.write(chunk)
finally:
core.svn_stream_close(stream)
finally:
fp.close()
return temp
class FileContentsPipe:
def __init__(self, root, path, pool):
self._pool = core.svn_pool_create(pool)
self._stream = fs.file_contents(root, path, self._pool)
self._eof = 0
def __del__(self):
core.svn_pool_destroy(self._pool)
def read(self, len=None):
chunk = None
if not self._eof:
if len is None:
buffer = cStringIO.StringIO()
try:
while 1:
hunk = core.svn_stream_read(self._stream, 8192)
if not hunk:
break
buffer.write(hunk)
chunk = buffer.getvalue()
finally:
buffer.close()
else:
chunk = core.svn_stream_read(self._stream, len)
if not chunk:
self._eof = 1
return chunk
def readline(self):
chunk = None
if not self._eof:
chunk, self._eof = core.svn_stream_readline(self._stream, '\n',
self._pool)
if not self._eof:
chunk = chunk + '\n'
if not chunk:
self._eof = 1
return chunk
def readlines(self):
lines = []
while True:
line = self.readline()
if not line:
break
lines.append(line)
return lines
def close(self):
return core.svn_stream_close(self._stream)
def eof(self):
return self._eof
_re_blameinfo = re.compile(r"\s*(\d+)\s*(.*)")
class BlameSource:
def __init__(self, svn_client_path, rootpath, fs_path, rev, first_rev):
self.idx = -1
self.line_number = 1
self.last = None
self.first_rev = first_rev
# Do a little dance to get a URL that works in both Unix-y and
# Windows worlds.
rootpath = os.path.abspath(rootpath)
if rootpath and rootpath[0] != '/':
rootpath = '/' + rootpath
if os.sep != '/':
rootpath = string.replace(rootpath, os.sep, '/')
# Make a read-only temporary directory for Subversion to use as
# its runtime config dir. (Read-only because that will prevent
# Subversion from fleshing out all the default runtime config
# contents.)
self.config_dir = self._mkdtemp()
os.chmod(self.config_dir, stat.S_IRUSR | stat.S_IXUSR)
url = 'file://' + string.join([rootpath, fs_path], "/")
fp = popen.popen(svn_client_path,
("blame",
"-r%d" % int(rev),
"--non-interactive",
"--config-dir", self.config_dir,
"%s@%d" % (url, int(rev))),
'rb', 1)
self.fp = fp
def _mkdtemp(self):
### FIXME: When we require Python 2.3, this can go away.
for i in range(10):
dir = tempfile.mktemp()
try:
os.mkdir(dir, 0700)
return dir
except OSError, e:
if e.errno == errno.EEXIST:
continue # try again
raise
raise IOError, (errno.EEXIST, "No usable temporary directory name found")
def __getitem__(self, idx):
if idx == self.idx:
return self.last
if idx != self.idx + 1:
raise BlameSequencingError()
line = self.fp.readline()
if not line:
raise IndexError("No more annotations")
m = _re_blameinfo.match(line[:17])
if not m:
raise vclib.Error("Could not parse blame output at line %i\n%s"
% (idx+1, line))
rev, author = m.groups()
text = line[18:]
rev = int(rev)
prev_rev = None
if rev > self.first_rev:
prev_rev = rev - 1
item = _item(text=text, line_number=idx+1, rev=rev,
prev_rev=prev_rev, author=author, date=None)
self.last = item
self.idx = idx
return item
def __del__(self):
try:
if self.config_dir:
shutil.rmtree(self.config_dir)
except:
pass
class BlameSequencingError(Exception):
pass
class SubversionRepository(vclib.Repository):
def __init__(self, name, rootpath, svn_path):
if not os.path.isdir(rootpath):
raise vclib.ReposNotFound(name)
# Initialize some stuff.
self.pool = None
self.apr_init = 0
self.rootpath = rootpath
self.name = name
self.svn_client_path = os.path.normpath(os.path.join(svn_path, 'svn'))
# Register a handler for SIGTERM so we can have a chance to
# cleanup. If ViewVC takes too long to start generating CGI
# output, Apache will grow impatient and SIGTERM it. While we
# don't mind getting told to bail, we want to gracefully close the
# repository before we bail.
def _sigterm_handler(signum, frame, self=self):
self._close()
sys.exit(-1)
try:
signal.signal(signal.SIGTERM, _sigterm_handler)
except ValueError:
# This is probably "ValueError: signal only works in main
# thread", which will get thrown by the likes of mod_python
# when trying to install a signal handler from a thread that
# isn't the main one. We'll just not care.
pass
# Initialize APR and get our top-level pool.
core.apr_initialize()
self.apr_init = 1
self.pool = core.svn_pool_create(None)
self.scratch_pool = core.svn_pool_create(self.pool)
# Open the repository and init some other variables.
self.repos = repos.svn_repos_open(rootpath, self.pool)
self.fs_ptr = repos.svn_repos_fs(self.repos)
self.youngest = fs.youngest_rev(self.fs_ptr, self.pool)
self._fsroots = {}
def __del__(self):
self._close()
def _close(self):
if self.pool:
core.svn_pool_destroy(self.pool)
self.pool = None
if self.apr_init:
core.apr_terminate()
self.apr_init = 0
def _scratch_clear(self):
core.svn_pool_clear(self.scratch_pool)
def itemtype(self, path_parts, rev):
rev = self._getrev(rev)
basepath = self._getpath(path_parts)
kind = fs.check_path(self._getroot(rev), basepath, self.scratch_pool)
self._scratch_clear()
if kind == core.svn_node_dir:
return vclib.DIR
if kind == core.svn_node_file:
return vclib.FILE
raise vclib.ItemNotFound(path_parts)
def openfile(self, path_parts, rev):
path = self._getpath(path_parts)
rev = self._getrev(rev)
fsroot = self._getroot(rev)
revision = str(_get_last_history_rev(fsroot, path, self.scratch_pool))
self._scratch_clear()
fp = FileContentsPipe(fsroot, path, self.pool)
return fp, revision
def listdir(self, path_parts, rev, options):
basepath = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.DIR:
raise vclib.Error("Path '%s' is not a directory." % basepath)
rev = self._getrev(rev)
fsroot = self._getroot(rev)
dirents = fs.dir_entries(fsroot, basepath, self.scratch_pool)
entries = [ ]
for entry in dirents.values():
if entry.kind == core.svn_node_dir:
kind = vclib.DIR
elif entry.kind == core.svn_node_file:
kind = vclib.FILE
entries.append(vclib.DirEntry(entry.name, kind))
self._scratch_clear()
return entries
def dirlogs(self, path_parts, rev, entries, options):
get_logs(self, self._getpath(path_parts), self._getrev(rev), entries)
def itemlog(self, path_parts, rev, options):
"""see vclib.Repository.itemlog docstring
Option values recognized by this implementation
svn_show_all_dir_logs
boolean, default false. if set for a directory path, will include
revisions where files underneath the directory have changed
svn_cross_copies
boolean, default false. if set for a path created by a copy, will
include revisions from before the copy
svn_latest_log
boolean, default false. if set will return only newest single log
entry
"""
path = self._getpath(path_parts)
rev = self._getrev(rev)
revs = _fetch_log(self, path, rev, options, self.scratch_pool)
self._scratch_clear()
revs.sort()
prev = None
for rev in revs:
rev.prev = prev
prev = rev
return revs
def annotate(self, path_parts, rev):
path = self._getpath(path_parts)
rev = self._getrev(rev)
fsroot = self._getroot(rev)
history_set = _get_history(self, path, rev, {'svn_cross_copies': 1})
history_revs = history_set.keys()
history_revs.sort()
revision = history_revs[-1]
first_rev = history_revs[0]
source = BlameSource(self.svn_client_path, self.rootpath,
path, rev, first_rev)
return source, revision
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
p1 = self._getpath(path_parts1)
p2 = self._getpath(path_parts2)
r1 = self._getrev(rev1)
r2 = self._getrev(rev2)
args = vclib._diff_args(type, options)
try:
temp1 = temp_checkout(self, p1, r1, self.pool)
temp2 = temp_checkout(self, p2, r2, self.pool)
info1 = p1, date_from_rev(self, r1), r1
info2 = p2, date_from_rev(self, r2), r2
return vclib._diff_fp(temp1, temp2, info1, info2, args)
except vclib.svn.core.SubversionException, e:
if e.apr_err == vclib.svn.core.SVN_ERR_FS_NOT_FOUND:
raise vclib.InvalidRevision
raise
def _getpath(self, path_parts):
return string.join(path_parts, '/')
def _getrev(self, rev):
if rev is None or rev == 'HEAD':
return self.youngest
try:
rev = int(rev)
except ValueError:
raise vclib.InvalidRevision(rev)
if (rev < 0) or (rev > self.youngest):
raise vclib.InvalidRevision(rev)
return rev
def _getroot(self, rev):
try:
return self._fsroots[rev]
except KeyError:
r = self._fsroots[rev] = fs.revision_root(self.fs_ptr, rev, self.pool)
return r
class _item:
def __init__(self, **kw):
vars(self).update(kw)

View File

@@ -0,0 +1,450 @@
# -*-python-*-
#
# Copyright (C) 1999-2008 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"Version Control lib driver for remotely accessible Subversion repositories."
import vclib
import sys
import os
import string
import re
import tempfile
import popen2
import time
from vclib.svn import Revision, ChangedPath, _datestr_to_date, _compare_paths, _cleanup_path
from svn import core, delta, client, wc, ra
### Require Subversion 1.3.0 or better. (for svn_ra_get_locations support)
if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_PATCH) < (1, 3, 0):
raise Exception, "Version requirement not met (needs 1.3.0 or better)"
def _rev2optrev(rev):
assert type(rev) is int
rt = core.svn_opt_revision_t()
rt.kind = core.svn_opt_revision_number
rt.value.number = rev
return rt
def date_from_rev(svnrepos, rev):
datestr = ra.svn_ra_rev_prop(svnrepos.ra_session, rev,
'svn:date', svnrepos.pool)
return _datestr_to_date(datestr, svnrepos.pool)
def get_location(svnrepos, path, rev, old_rev):
try:
results = ra.get_locations(svnrepos.ra_session, path, rev,
[old_rev], svnrepos.pool)
except core.SubversionException, e:
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
raise vclib.ItemNotFound(path)
raise
try:
old_path = results[old_rev]
except KeyError:
raise vclib.ItemNotFound(path)
return _cleanup_path(old_path)
def last_rev(svnrepos, path, peg_revision, limit_revision=None):
"""Given PATH, known to exist in PEG_REVISION, find the youngest
revision older than, or equal to, LIMIT_REVISION in which path
exists. Return that revision, and the path at which PATH exists in
that revision."""
# Here's the plan, man. In the trivial case (where PEG_REVISION is
# the same as LIMIT_REVISION), this is a no-brainer. If
# LIMIT_REVISION is older than PEG_REVISION, we can use Subversion's
# history tracing code to find the right location. If, however,
# LIMIT_REVISION is younger than PEG_REVISION, we suffer from
# Subversion's lack of forward history searching. Our workaround,
# ugly as it may be, involves a binary search through the revisions
# between PEG_REVISION and LIMIT_REVISION to find our last live
# revision.
peg_revision = svnrepos._getrev(peg_revision)
limit_revision = svnrepos._getrev(limit_revision)
if peg_revision == limit_revision:
return peg_revision, path
elif peg_revision > limit_revision:
path = get_location(svnrepos, path, peg_revision, limit_revision)
return limit_revision, path
else:
### Warning: this is *not* an example of good pool usage.
direction = 1
while peg_revision != limit_revision:
mid = (peg_revision + 1 + limit_revision) / 2
try:
path = get_location(svnrepos, path, peg_revision, mid)
except vclib.ItemNotFound:
limit_revision = mid - 1
else:
peg_revision = mid
return peg_revision, path
def created_rev(svnrepos, full_name, rev):
kind = ra.svn_ra_check_path(svnrepos.ra_session, full_name, rev,
svnrepos.pool)
if kind == core.svn_node_dir:
retval = ra.svn_ra_get_dir(svnrepos.ra_session, full_name,
rev, svnrepos.pool)
if type(retval) == type([]) and len(retval) == 3:
props = retval[2]
else: # compat with older (broken) bindings
props = retval
return int(props[core.SVN_PROP_ENTRY_COMMITTED_REV])
return core.SVN_INVALID_REVNUM
class LastHistoryCollector:
def __init__(self):
self.has_history = 0
def add_history(self, paths, revision, author, date, message, pool):
if not self.has_history:
self.has_history = 1
self.revision = revision
self.author = author
self.date = date
self.message = message
self.changes = []
if not paths:
return
changed_paths = paths.keys()
changed_paths.sort(lambda a, b: _compare_paths(a, b))
action_map = { 'D' : 'deleted',
'A' : 'added',
'R' : 'replaced',
'M' : 'modified',
}
for changed_path in changed_paths:
change = paths[changed_path]
action = action_map.get(change.action, 'modified')
### Wrong, diddily wrong wrong wrong. Can you say,
### "Manufacturing data left and right because it hurts to
### figure out the right stuff?"
if change.copyfrom_path and change.copyfrom_rev:
self.changes.append(ChangedPath(changed_path[1:], None, 0, 0,
change.copyfrom_path,
change.copyfrom_rev, action, 1))
else:
self.changes.append(ChangedPath(changed_path[1:], None, 0, 0,
changed_path[1:], 0, action, 0))
def get_history(self):
if not self.has_history:
return None, None, None, None, None
return self.revision, self.author, self.date, self.message, self.changes
def _get_rev_details(svnrepos, rev, pool):
lhc = LastHistoryCollector()
client.svn_client_log([svnrepos.rootpath],
_rev2optrev(rev), _rev2optrev(rev),
1, 0, lhc.add_history, svnrepos.ctx, pool)
return lhc.get_history()
def get_revision_info(svnrepos, rev):
rev, author, date, log, changes = \
_get_rev_details(svnrepos, rev, svnrepos.pool)
return _datestr_to_date(date, svnrepos.pool), author, log, changes
class LogCollector:
def __init__(self, path, show_all_logs):
# This class uses leading slashes for paths internally
if not path:
self.path = '/'
else:
self.path = path[0] == '/' and path or '/' + path
self.logs = []
self.show_all_logs = show_all_logs
def add_log(self, paths, revision, author, date, message, pool):
# Changed paths have leading slashes
changed_paths = paths.keys()
changed_paths.sort(lambda a, b: _compare_paths(a, b))
copyfrom_path = copyfrom_rev = this_path = None
if self.path in changed_paths:
this_path = self.path
change = paths[self.path]
if change.copyfrom_path:
this_path = change.copyfrom_path
copyfrom_path = change.copyfrom_path[1:]
copyfrom_rev = change.copyfrom_rev
for changed_path in changed_paths:
if changed_path != self.path:
# If a parent of our path was copied, our "next previous"
# (huh?) path will exist elsewhere (under the copy source).
if (string.rfind(self.path, changed_path) == 0) and \
self.path[len(changed_path)] == '/':
change = paths[changed_path]
if change.copyfrom_path:
this_path = change.copyfrom_path + self.path[len(changed_path):]
if self.show_all_logs or this_path:
date = _datestr_to_date(date, pool)
entry = Revision(revision, date, author, message, None,
self.path[1:], copyfrom_path, copyfrom_rev)
self.logs.append(entry)
if this_path:
self.path = this_path
def get_logs(svnrepos, full_name, rev, files):
dirents = svnrepos._get_dirents(full_name, rev)
subpool = core.svn_pool_create(svnrepos.pool)
rev_info_cache = { }
for file in files:
core.svn_pool_clear(subpool)
entry = dirents[file.name]
if rev_info_cache.has_key(entry.created_rev):
rev, author, date, log = rev_info_cache[entry.created_rev]
else:
### i think this needs some get_last_history action to be accurate
rev, author, date, log, changes = \
_get_rev_details(svnrepos, entry.created_rev, subpool)
rev_info_cache[entry.created_rev] = rev, author, date, log
file.rev = rev
file.author = author
file.date = _datestr_to_date(date, subpool)
file.log = log
file.size = entry.size
core.svn_pool_destroy(subpool)
def get_youngest_revision(svnrepos):
return svnrepos.youngest
def temp_checkout(svnrepos, path, rev, pool):
"""Check out file revision to temporary file"""
temp = tempfile.mktemp()
stream = core.svn_stream_from_aprfile(temp, pool)
url = svnrepos.rootpath + (path and '/' + path)
client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev),
svnrepos.ctx, pool)
core.svn_stream_close(stream)
return temp
class SelfCleanFP:
def __init__(self, path):
self._fp = open(path, 'r')
self._path = path
self._eof = 0
def read(self, len=None):
if len:
chunk = self._fp.read(len)
else:
chunk = self._fp.read()
if chunk == '':
self._eof = 1
return chunk
def readline(self):
chunk = self._fp.readline()
if chunk == '':
self._eof = 1
return chunk
def close(self):
self._fp.close()
os.remove(self._path)
def __del__(self):
self.close()
def eof(self):
return self._eof
class SubversionRepository(vclib.Repository):
def __init__(self, name, rootpath):
# Init the client app
core.apr_initialize()
pool = core.svn_pool_create(None)
core.svn_config_ensure(None, pool)
# Start populating our members
self.pool = pool
self.name = name
self.rootpath = rootpath
# Setup the client context baton, complete with non-prompting authstuffs.
ctx = client.svn_client_ctx_t()
providers = []
providers.append(client.svn_client_get_simple_provider(pool))
providers.append(client.svn_client_get_username_provider(pool))
providers.append(client.svn_client_get_ssl_server_trust_file_provider(pool))
providers.append(client.svn_client_get_ssl_client_cert_file_provider(pool))
providers.append(client.svn_client_get_ssl_client_cert_pw_file_provider(pool))
ctx.auth_baton = core.svn_auth_open(providers, pool)
ctx.config = core.svn_config_get_config(None, pool)
self.ctx = ctx
ra_callbacks = ra.svn_ra_callbacks_t()
ra_callbacks.auth_baton = ctx.auth_baton
self.ra_session = ra.svn_ra_open(self.rootpath, ra_callbacks, None,
ctx.config, pool)
self.youngest = ra.svn_ra_get_latest_revnum(self.ra_session, pool)
self._dirent_cache = { }
def __del__(self):
core.svn_pool_destroy(self.pool)
core.apr_terminate()
def itemtype(self, path_parts, rev):
path = self._getpath(path_parts[:-1])
rev = self._getrev(rev)
if not len(path_parts):
return vclib.DIR
dirents = self._get_dirents(path, rev)
try:
entry = dirents[path_parts[-1]]
if entry.kind == core.svn_node_dir:
return vclib.DIR
if entry.kind == core.svn_node_file:
return vclib.FILE
except KeyError:
raise vclib.ItemNotFound(path_parts)
def openfile(self, path_parts, rev):
rev = self._getrev(rev)
url = self.rootpath
if len(path_parts):
url = self.rootpath + '/' + self._getpath(path_parts)
tmp_file = tempfile.mktemp()
stream = core.svn_stream_from_aprfile(tmp_file, self.pool)
### rev here should be the last history revision of the URL
client.svn_client_cat(core.Stream(stream), url,
_rev2optrev(rev), self.ctx, self.pool)
core.svn_stream_close(stream)
return SelfCleanFP(tmp_file), rev
def listdir(self, path_parts, rev, options):
path = self._getpath(path_parts)
rev = self._getrev(rev)
entries = [ ]
dirents = self._get_dirents(path, rev)
for name in dirents.keys():
entry = dirents[name]
if entry.kind == core.svn_node_dir:
kind = vclib.DIR
elif entry.kind == core.svn_node_file:
kind = vclib.FILE
entries.append(vclib.DirEntry(name, kind))
return entries
def dirlogs(self, path_parts, rev, entries, options):
get_logs(self, self._getpath(path_parts), self._getrev(rev), entries)
def itemlog(self, path_parts, rev, options):
full_name = self._getpath(path_parts)
rev = self._getrev(rev)
# It's okay if we're told to not show all logs on a file -- all
# the revisions should match correctly anyway.
lc = LogCollector(full_name, options.get('svn_show_all_dir_logs', 0))
dir_url = self.rootpath
if full_name:
dir_url = dir_url + '/' + full_name
cross_copies = options.get('svn_cross_copies', 0)
client.svn_client_log([dir_url], _rev2optrev(rev), _rev2optrev(1),
1, not cross_copies, lc.add_log,
self.ctx, self.pool)
revs = lc.logs
revs.sort()
prev = None
for rev in revs:
rev.prev = prev
prev = rev
return revs
def annotate(self, path_parts, rev):
path = self._getpath(path_parts)
rev = self._getrev(rev)
url = self.rootpath + (path and '/' + path)
blame_data = []
def _blame_cb(line_no, revision, author, date,
line, pool, blame_data=blame_data):
prev_rev = None
if revision > 1:
prev_rev = revision - 1
blame_data.append(_item(text=line, line_number=line_no+1,
rev=revision, prev_rev=prev_rev,
author=author, date=None))
client.svn_client_blame(url, _rev2optrev(1), _rev2optrev(rev),
_blame_cb, self.ctx, self.pool)
return blame_data, rev
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
p1 = self._getpath(path_parts1)
p2 = self._getpath(path_parts2)
r1 = self._getrev(rev1)
r2 = self._getrev(rev2)
args = vclib._diff_args(type, options)
try:
temp1 = temp_checkout(self, p1, r1, self.pool)
temp2 = temp_checkout(self, p2, r2, self.pool)
info1 = p1, date_from_rev(self, r1), r1
info2 = p2, date_from_rev(self, r2), r2
return vclib._diff_fp(temp1, temp2, info1, info2, args)
except vclib.svn.core.SubversionException, e:
if e.apr_err == vclib.svn.core.SVN_ERR_FS_NOT_FOUND:
raise vclib.InvalidRevision
raise
def _getpath(self, path_parts):
return string.join(path_parts, '/')
def _getrev(self, rev):
if rev is None or rev == 'HEAD':
return self.youngest
try:
rev = int(rev)
except ValueError:
raise vclib.InvalidRevision(rev)
if (rev < 0) or (rev > self.youngest):
raise vclib.InvalidRevision(rev)
return rev
def _get_dirents(self, path, rev):
if path:
key = str(rev) + '/' + path
dir_url = self.rootpath + '/' + path
else:
key = str(rev)
dir_url = self.rootpath
dirents = self._dirent_cache.get(key)
if dirents:
return dirents
dirents = client.svn_client_ls(dir_url, _rev2optrev(rev), 0,
self.ctx, self.pool)
self._dirent_cache[key] = dirents
return dirents
class _item:
def __init__(self, **kw):
vars(self).update(kw)

File diff suppressed because it is too large Load Diff

3755
lib/viewvc.py Normal file

File diff suppressed because it is too large Load Diff

235
lib/win32popen.py Normal file
View File

@@ -0,0 +1,235 @@
# -*-python-*-
#
# Copyright (C) 1999-2007 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# Utilities for controlling processes and pipes on win32
#
# -----------------------------------------------------------------------
import os, sys, traceback, string, thread
try:
import win32api
except ImportError, e:
raise ImportError, str(e) + """
Did you install the Python for Windows Extensions?
http://sourceforge.net/projects/pywin32/
"""
import win32process, win32pipe, win32con
import win32event, win32file, winerror
import pywintypes, msvcrt
# Buffer size for spooling
SPOOL_BYTES = 4096
# File object to write error messages
SPOOL_ERROR = sys.stderr
#SPOOL_ERROR = open("m:/temp/error.txt", "wt")
def CommandLine(command, args):
"""Convert an executable path and a sequence of arguments into a command
line that can be passed to CreateProcess"""
cmd = "\"" + string.replace(command, "\"", "\"\"") + "\""
for arg in args:
cmd = cmd + " \"" + string.replace(arg, "\"", "\"\"") + "\""
return cmd
def CreateProcess(cmd, hStdInput, hStdOutput, hStdError):
"""Creates a new process which uses the specified handles for its standard
input, output, and error. The handles must be inheritable. 0 can be passed
as a special handle indicating that the process should inherit the current
process's input, output, or error streams, and None can be passed to discard
the child process's output or to prevent it from reading any input."""
# initialize new process's startup info
si = win32process.STARTUPINFO()
si.dwFlags = win32process.STARTF_USESTDHANDLES
if hStdInput == 0:
si.hStdInput = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE)
else:
si.hStdInput = hStdInput
if hStdOutput == 0:
si.hStdOutput = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE)
else:
si.hStdOutput = hStdOutput
if hStdError == 0:
si.hStdError = win32api.GetStdHandle(win32api.STD_ERROR_HANDLE)
else:
si.hStdError = hStdError
# create the process
phandle, pid, thandle, tid = win32process.CreateProcess \
( None, # appName
cmd, # commandLine
None, # processAttributes
None, # threadAttributes
1, # bInheritHandles
win32con.NORMAL_PRIORITY_CLASS, # dwCreationFlags
None, # newEnvironment
None, # currentDirectory
si # startupinfo
)
if hStdInput and hasattr(hStdInput, 'Close'):
hStdInput.Close()
if hStdOutput and hasattr(hStdOutput, 'Close'):
hStdOutput.Close()
if hStdError and hasattr(hStdError, 'Close'):
hStdError.Close()
return phandle, pid, thandle, tid
def CreatePipe(readInheritable, writeInheritable):
"""Create a new pipe specifying whether the read and write ends are
inheritable and whether they should be created for blocking or nonblocking
I/O."""
r, w = win32pipe.CreatePipe(None, SPOOL_BYTES)
if readInheritable:
r = MakeInheritedHandle(r)
if writeInheritable:
w = MakeInheritedHandle(w)
return r, w
def File2FileObject(pipe, mode):
"""Make a C stdio file object out of a win32 file handle"""
if string.find(mode, 'r') >= 0:
wmode = os.O_RDONLY
elif string.find(mode, 'w') >= 0:
wmode = os.O_WRONLY
if string.find(mode, 'b') >= 0:
wmode = wmode | os.O_BINARY
if string.find(mode, 't') >= 0:
wmode = wmode | os.O_TEXT
return os.fdopen(msvcrt.open_osfhandle(pipe.Detach(),wmode),mode)
def FileObject2File(fileObject):
"""Get the win32 file handle from a C stdio file object"""
return win32file._get_osfhandle(fileObject.fileno())
def DuplicateHandle(handle):
"""Duplicates a win32 handle."""
proc = win32api.GetCurrentProcess()
return win32api.DuplicateHandle(proc,handle,proc,0,0,win32con.DUPLICATE_SAME_ACCESS)
def MakePrivateHandle(handle, replace = 1):
"""Turn an inherited handle into a non inherited one. This avoids the
handle duplication that occurs on CreateProcess calls which can create
uncloseable pipes."""
### Could change implementation to use SetHandleInformation()...
flags = win32con.DUPLICATE_SAME_ACCESS
proc = win32api.GetCurrentProcess()
if replace: flags = flags | win32con.DUPLICATE_CLOSE_SOURCE
newhandle = win32api.DuplicateHandle(proc,handle,proc,0,0,flags)
if replace: handle.Detach() # handle was already deleted by the last call
return newhandle
def MakeInheritedHandle(handle, replace = 1):
"""Turn a private handle into an inherited one."""
### Could change implementation to use SetHandleInformation()...
flags = win32con.DUPLICATE_SAME_ACCESS
proc = win32api.GetCurrentProcess()
if replace: flags = flags | win32con.DUPLICATE_CLOSE_SOURCE
newhandle = win32api.DuplicateHandle(proc,handle,proc,0,1,flags)
if replace: handle.Detach() # handle was deleted by the last call
return newhandle
def MakeSpyPipe(readInheritable, writeInheritable, outFiles = None, doneEvent = None):
"""Return read and write handles to a pipe that asynchronously writes all of
its input to the files in the outFiles sequence. doneEvent can be None, or a
a win32 event handle that will be set when the write end of pipe is closed.
"""
if outFiles is None:
return CreatePipe(readInheritable, writeInheritable)
r, writeHandle = CreatePipe(0, writeInheritable)
if readInheritable is None:
readHandle, w = None, None
else:
readHandle, w = CreatePipe(readInheritable, 0)
thread.start_new_thread(SpoolWorker, (r, w, outFiles, doneEvent))
return readHandle, writeHandle
def SpoolWorker(srcHandle, destHandle, outFiles, doneEvent):
"""Thread entry point for implementation of MakeSpyPipe"""
try:
buffer = win32file.AllocateReadBuffer(SPOOL_BYTES)
while 1:
try:
#print >> SPOOL_ERROR, "Calling ReadFile..."; SPOOL_ERROR.flush()
hr, data = win32file.ReadFile(srcHandle, buffer)
#print >> SPOOL_ERROR, "ReadFile returned '%s', '%s'" % (str(hr), str(data)); SPOOL_ERROR.flush()
if hr != 0:
raise "win32file.ReadFile returned %i, '%s'" % (hr, data)
elif len(data) == 0:
break
except pywintypes.error, e:
#print >> SPOOL_ERROR, "ReadFile threw '%s'" % str(e); SPOOL_ERROR.flush()
if e.args[0] == winerror.ERROR_BROKEN_PIPE:
break
else:
raise e
#print >> SPOOL_ERROR, "Writing to %i file objects..." % len(outFiles); SPOOL_ERROR.flush()
for f in outFiles:
f.write(data)
#print >> SPOOL_ERROR, "Done writing to file objects."; SPOOL_ERROR.flush()
#print >> SPOOL_ERROR, "Writing to destination %s" % str(destHandle); SPOOL_ERROR.flush()
if destHandle:
#print >> SPOOL_ERROR, "Calling WriteFile..."; SPOOL_ERROR.flush()
hr, bytes = win32file.WriteFile(destHandle, data)
#print >> SPOOL_ERROR, "WriteFile() passed %i bytes and returned %i, %i" % (len(data), hr, bytes); SPOOL_ERROR.flush()
if hr != 0 or bytes != len(data):
raise "win32file.WriteFile() passed %i bytes and returned %i, %i" % (len(data), hr, bytes)
srcHandle.Close()
if doneEvent:
win32event.SetEvent(doneEvent)
if destHandle:
destHandle.Close()
except:
info = sys.exc_info()
SPOOL_ERROR.writelines(apply(traceback.format_exception, info), '')
SPOOL_ERROR.flush()
del info
def NullFile(inheritable):
"""Create a null file handle."""
if inheritable:
sa = pywintypes.SECURITY_ATTRIBUTES()
sa.bInheritHandle = 1
else:
sa = None
return win32file.CreateFile("nul",
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
win32file.FILE_SHARE_READ | win32file.FILE_SHARE_WRITE,
sa, win32file.OPEN_EXISTING, 0, None)

53
notes/TODO Normal file
View File

@@ -0,0 +1,53 @@
PREFACE
-------
This file will go away soon after release 0.8. Please use the SourceForge
tracker to resubmit any of the items listed below, if you think, it is
still an issue:
http://sourceforge.net/tracker/?group_id=18760
Before reporting please check, whether someone else has already done this.
Working patches increase the chance to be included into the next release.
-- PeFu / October 2001
TODO ITEMS
----------
*) add Tamminen Eero's comments on how to make Linux directly execute
the Python script. From email on Feb 19.
[ add other examples, such as my /bin/sh hack or the teeny CGI stub
importing the bulk hack ]
*) insert rcs_path into PATH before calling "rcsdiff". rcsdiff might
use "co" and needs to find it on the path.
*) show the "locked" flag (attach it to the LogEntry objects).
Idea from Russell Gordon <russell@hoopscotch.dhs.org>
*) committing with a specific revision number:
http://mailman.lyra.org/pipermail/viewcvs/2000q1/000008.html
*) add capability similar to cvs2cl.pl:
http://mailman.lyra.org/pipermail/viewcvs/2000q2/000050.html
suggestion from Chris Meyer <cmeyer@gatan.com>.
*) add a tree view of the directory structure (and files?)
*) include a ConfigParser.py to help older Python installations
*) add a check for the rcs programs/paths to viewvc-install. clarify the
dependency on RCS in the docs.
*) have a "check" mode that verifies binaries are available on rcs_path
-> alternately (probably?): use rcsparse rather than external tools
KNOWN BUGS
----------
*) time.timezone seems to not be available on some 1.5.2 installs.
I was unable to verify this. On RedHat and SuSE Linux this bug
is non existant.
*) With old repositories containing many branches, tags or thousands
or revisions, the cvsgraph feature becomes unusable (see INSTALL).
ViewVC can't do much about this, but it might be possible to
investigate the number of branches, tags and revision in advance
and disable the cvsgraph links, if the numbers exceed a certain
treshold.

85
notes/releases.txt Normal file
View File

@@ -0,0 +1,85 @@
RELEASE MANAGEMENT
ViewVC rolls releases from release branches associate with each minor
version of the software. For example, the 1.1.0 is rolled from the
1.1.x branch. The same is true for the 1.1.1, 1.1.2, ... releases.
There is a script, `tools/make-release', which creates a release
directory and the various archive files that we distribute. All other
steps required to get a ViewVC release out of the door require manual
execution (currently by C. Michael Pilato). Those steps are as
follows:
Checkout a working copy of the release branch for the release you
intend to roll, and in that working copy, perform the following steps
(X, Y, and Z below represent integral major, minor, and patch version
numbers, and not literal):
1. Review any open bug reports:
http://viewvc.tigris.org/servlets/ProjectIssues
2. Add a new subsection to the file 'docs/upgrading.html' describing
all user visible changes for users of previous releases of ViewVC.
Commit any modifications. NOTE: This step should not be necessary
for patch releases.
3. Verify that copyright years are correct in both the LICENSE.html
file and the source code.
4. Update and commit the 'CHANGES' file.
5. Test, test, test! There is no automatic testsuite available. So
just run with permuting different `viewvc.conf' settings... and
pray. Fix what needs fixin', keeping the CHANGES file in sync
with the branch.
6. At this point, the source code committed to the release branch
should exactly reflect what you wish to distribute and dub "the
release".
7. Edit the file 'lib/viewvc.py' and remove the "-dev" suffix from
__version__. The remainder should be of the form "X.Y.Z", where X,
Y, and Z are positive integers. Do NOT commit this change.
8. Update your working copy to HEAD, and tag the release:
svn update
svn cp -m "Tag the X.Y.Z final release." . \
http://viewvc.tigris.org/svn/viewvc/tags/X.Y.Z
9. Go into an empty directory and run the 'make-release' script:
tools/make-release viewvc-X.Y.Z X.Y.Z
10. Verify the archive files:
- do they have a LICENSE.html file?
- do they have necessary include documentation?
- do they *not* have unnecessary stuff?
- do they install and work correctly?
11. Upload the created archive files (tar.gz and zip) into the Files
and Documents section of the Tigris.org project, and modify the
CHECKSUMS document there accordingly. Also, drop a copy of the
archive files into the root directory of the viewvc.org website
(unversioned).
12. Update the websites (both the viewvc.org/ and www/ ones) to refer
to the new release files.
13. Edit the file 'lib/viewvc.py' again, re-adding the "-dev" suffix
and incrementing the patch number assigned to the __version__
variable, and commit:
svn ci -m "Begin a new release cycle."
14. Edit the Issue Tracker configuration options, adding a new Version
for the just-released one, and a new Milestone for the next patch
(and possibly, minor or major) release. (For the Milestone sort
key, use a packed integer XXYYZZ: 1.0.3 == 10003, 2.11.4 == 21104.)
15. Write an announcement explaining all the cool new features and
post it to the announce@ list, to the project's News area, and to
other places interested in this sort of stuff, such as Freshmeat
(http://www.freshmeat.net).

View File

@@ -1,3 +1,43 @@
[include "header.ezt" "annotate"]
[# setup page definitions][define page_title]Annotation of /[where][end][define help_href][docroot]/help_rootview.html[end][# end][include "include/header.ezt" "annotate"]
[include "include/file_header.ezt"]
<hr noshade>
<hr />
<p>
Revision [if-any revision_href]<a href="[revision_href]"><strong>[rev]</strong></a>[else]<strong>[rev]</strong>[end] -
(<a href="[view_href]"><strong>view</strong></a>)
(<a href="[download_href]"><strong>download</strong></a>)
[if-any download_text_href](<a href="[download_text_href]"><strong>as text</strong></a>)[end]
[if-any orig_path]
<br />Original Path: <a href="[orig_href]"><em>[orig_path]</em></a>
[end]
</p>
[define class1]vc_row_even[end]
[define class2]vc_row_odd[end]
[define last_rev]0[end]
[define rowclass][class1][end]
<table cellspacing="0" cellpadding="0">
[for lines]
[is lines.rev last_rev]
[else]
[is rowclass class1]
[define rowclass][class2][end]
[else]
[define rowclass][class1][end]
[end]
[end]
<tr class="[rowclass]" id="l[lines.line_number]">
<td class="vc_blame_line">[lines.line_number] :</td>
<td class="vc_blame_author">[is lines.rev last_rev]&nbsp;[else][lines.author][end]</td>
<td class="vc_blame_rev">[is lines.rev last_rev]&nbsp;[else][if-any lines.diff_url]<a href="[lines.diff_url]">[end][lines.rev][if-any lines.diff_url]</a>[end][end]</td>
<td class="vc_blame_text">[lines.text]</td>
</tr>
[define last_rev][lines.rev][end]
[end]
</table>
[include "include/footer.ezt"]

View File

@@ -1,88 +1,234 @@
[include "header.ezt" "diff"]
[# setup page definitions]
[define page_title]Diff of /[where][end]
[define help_href][docroot]/help_rootview.html[end]
[# end]
<h3 align=center>Diff for /[where] between version [rev1] and [rev2]</h3>
<table border=0 cellspacing=0 cellpadding=0 width="100%">
<tr bgcolor=white>
<th width="50%" valign=top>
version [rev1][date1]
[if-any tag1]<br>Tag: [tag1][end]
</th>
<th width="50%" valign=top>
version [rev2][date2]
[if-any tag2]<br>Tag: [tag2][end]
</th>
</tr>
[include "include/header.ezt" "diff"]
[include "include/file_header.ezt"]
[for changes]
[is changes.type "header"]
<tr bgcolor="#99cccc"><td width="50%">
<table width="100%" border=1 cellpadding=5><tr>
<td><b>Line [changes.line1]</b>&nbsp;<font
size="-1">[changes.extra]</font></td>
</tr></table></td><td width="50%">
<table width="100%" border=1 cellpadding=5><tr>
<td><b>Line [changes.line2]</b>&nbsp;<font
size="-1">[changes.extra]</font></td>
</tr></table>
</td></tr>
[else]
[is changes.type "add"]
<tr>
<td bgcolor="#cccccc">&nbsp;</td>
<td bgcolor="#aaffaa">[changes.right]</td>
</tr>
[else]
[is changes.type "remove"]
<tr>
<td bgcolor="#ffaaaa">[changes.left]</td>
<td bgcolor="#cccccc">&nbsp;</td>
</tr>
[else]
[is changes.type "change"]
<tr>
[if-any changes.have_left]<td bgcolor="#ffff77">[changes.left]</td>
[else]<td bgcolor="#eeee77">&nbsp;</td>[end]
[if-any changes.have_right]<td bgcolor="#ffff77">[changes.right]</td>
[else]<td bgcolor="#eeee77">&nbsp;</td>[end]
</tr>
[else]
[is changes.type "no-changes"]
<tr><td colspan=2>&nbsp;</td></tr>
<tr bgcolor="#cccccc"><td colspan=2 align=center>
<br><b>- No changes -</b><br>&nbsp;
</td></tr>
[else][# a line of context]
<tr><td>[changes.left]</td><td>[changes.right]</td></tr>
[end][end][end][end][end]
<h3 style="text-align:center;"></h3>
[if-any raw_diff]
<pre class="vc_raw_diff">[raw_diff]</pre>
[end]
</table><br><hr noshade width="100%">
<table border=0 cellpadding=10><tr><td>
<table border=1><tr><td>Legend:<br>
<table border=0 cellspacing=0 cellpadding=1>
<tr>
<td align=center bgcolor="#ffaaaa">Removed from v.[rev1]</td>
<td bgcolor="#cccccc">&nbsp;</td>
[if-any changes]
<table cellspacing="0" cellpadding="0">
<tr class="vc_diff_header">
<th style="width:6%;"></th>
<th style="width:47%; vertical-align:top;">
[is path_left path_right][else][path_left][end]
revision [rev_left], [date_left]
[if-any tag_left]<br />Tag: [tag_left][end]
</th>
<th style="width:47%; vertical-align:top;">
[is path_left path_right][else][path_right][end]
revision [rev_right], [date_right]
[if-any tag_right]<br />Tag: [tag_right][end]
</th>
</tr>
<tr bgcolor="#ffff77"><td align=center colspan=2>changed lines</td></tr>
<tr>
<td bgcolor="#cccccc">&nbsp;</td>
<td align=center bgcolor="#aaffaa">Added in v.[rev2]</td>
</tr>
</table></td></tr></table></td>
<td><form method="GET" action="[request.url]">
[hidden_values]
<select name="diff_format" onchange="submit()">
<option value="h" [is diff_format "h"]selected[end]>Colored Diff</option>
<option value="l" [is diff_format "l"]selected[end]>Long Colored Diff</option>
<option value="u" [is diff_format "u"]selected[end]>Unidiff</option>
<option value="c" [is diff_format "c"]selected[end]>Context Diff</option>
<option value="s" [is diff_format "s"]selected[end]>Side by Side</option>
</select>
<input type=submit value="Show">
</form></td></tr>
[for changes]
[is changes.type "header"]
<tr class="vc_diff_chunk_header" id="h[changes.line_info_right]">
<td style="width:6%;"><strong>#</strong></td>
<td style="width:47%;">
<strong>Line [changes.line_info_left]</strong>&nbsp;
<span class="vc_diff_chunk_extra">[changes.line_info_extra]</span>
</td>
<td style="width:47%;">
<strong>Line [changes.line_info_right]</strong>&nbsp;
<span class="vc_diff_chunk_extra">[changes.line_info_extra]</span>
</td>
</tr>
[else]
[is changes.type "add"]
<tr>
<td id="l[changes.line_number]">[if-any annotate_href]<a href="[annotate_href]#l[changes.line_number]">[changes.line_number]</a>[else][changes.line_number][end]</td>
<td class="vc_diff_empty">&nbsp;</td>
<td class="vc_diff_add">&nbsp;[changes.right]</td>
</tr>
[else]
[is changes.type "remove"]
<tr>
<td></td>
<td class="vc_diff_remove">&nbsp;[changes.left]</td>
<td class="vc_diff_empty">&nbsp;</td>
</tr>
[else]
[is changes.type "change"]
<tr>
[if-any changes.have_right]
<td id="l[changes.line_number]">[if-any annotate_href]<a href="[annotate_href]#l[changes.line_number]">[changes.line_number]</a>[else][changes.line_number][end]</td>
[else]
<td></td>
[end]
[if-any changes.have_left]
<td class="vc_diff_change">&nbsp;[changes.left]</td>
[else]
<td class="vc_diff_change_empty">&nbsp;</td>
[end]
[if-any changes.have_right]
<td class="vc_diff_change">&nbsp;[changes.right]</td>
[else]
<td class="vc_diff_change_empty">&nbsp;</td>
[end]
</tr>
[else]
[is changes.type "no-changes"]
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr class="vc_diff_empty">
<td colspan="3" style="text-align:center;"><br />
<strong>- No changes -</strong><br />&nbsp; </td>
</tr>
[else]
[is changes.type "binary-diff"]
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr class="vc_diff_empty">
<td colspan="3" style="text-align:center;"><br />
<strong>- Binary file revisions differ -</strong><br />&nbsp; </td>
</tr>
[else]
[is changes.type "error"]
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr class="vc_diff_empty">
<td colspan="3" style="text-align:center;"> <br />
<strong>- ViewVC depends on rcsdiff and GNU diff to create
this page. ViewVC cannot find GNU diff. Even if you
have GNU diff installed, the rcsdiff program must be
configured and compiled with the GNU diff location.
-</strong> <br />&nbsp; </td>
</tr>
[else]
<tr>
<td id="l[changes.line_number]">[if-any annotate_href]<a href="[annotate_href]#l[changes.line_number]">[changes.line_number]</a>[else][changes.line_number][end]</td>
<td class="vc_diff_nochange">&nbsp;[changes.left]</td>
<td class="vc_diff_nochange">&nbsp;[changes.right]</td>
</tr>
[end]
[end]
[end]
[end]
[end]
[end]
[end]
[end]
</table>
[end]
[if-any sidebyside]
<table class="vc_idiff">
<colgroup><col /><col class="content" /></colgroup>
<colgroup><col /><col class="content" /></colgroup>
<thead>
<tr>
<th colspan="2">
[is path_left path_right][else][path_left][end]
Revision [rev_left]
</th>
<th colspan="2">
[is path_left path_right][else][path_right][end]
Revision [rev_right]
</th>
</tr>
</thead>
<tbody>
[for sidebyside]
[if-any sidebyside.gap]
<tr>
<th>&hellip;</th><th></th>
<th>&hellip;</th><th></th>
</tr>
[end]
<tr>
[for sidebyside.columns]
<th>[sidebyside.columns.line_number]</th><td[if-any sidebyside.columns.line_number][else] class="vc_idiff_empty"[end]>[for sidebyside.columns.segments][if-any sidebyside.columns.segments.type]<span class="vc_idiff_[sidebyside.columns.segments.type]">[sidebyside.columns.segments.text]</span>[else][sidebyside.columns.segments.text][end][end]</td>
[end]
</tr>
[end]
</tbody>
</table>
[end]
[if-any unified]
<table class="vc_idiff">
<thead>
<tr>
<th>r[rev_left]</th>
<th>r[rev_right]</th>
<th></th>
</tr>
</thead>
<tbody>
[for unified]
[if-any unified.gap]
<tr>
<th>&hellip;</th>
<th>&hellip;</th>
<th></th>
</tr>
[end]
<tr>
<th>[unified.left_number]</th>
<th>[unified.right_number]</th>
<td[if-any unified.type] class="vc_idiff_[unified.type]"[end]>[for unified.segments][if-any unified.segments.type]<span class="vc_idiff_[unified.segments.type]">[unified.segments.text]</span>[else][unified.segments.text][end][end]</td>
</tr>
[end]
</tbody>
</table>
[end]
<hr style="margin-top:1em;" />
<table cellpadding="10" class="auto">
<tr>
<td>
<form method="get" action="[diff_format_action]">
<div>
[diff_format_hidden_values]
<select name="diff_format" onchange="submit()">
<option value="h" [is diff_format "h"]selected="selected"[end]>Colored Diff</option>
<option value="l" [is diff_format "l"]selected="selected"[end]>Long Colored Diff</option>
<option value="u" [is diff_format "u"]selected="selected"[end]>Unidiff</option>
<option value="c" [is diff_format "c"]selected="selected"[end]>Context Diff</option>
<option value="s" [is diff_format "s"]selected="selected"[end]>Side by Side</option>
</select>
<input type="submit" value="Show" />
</div>
</form>
</td>
<td>
[if-any raw_diff]
&nbsp;
[else]
<table style="border:solid gray 1px;" class="auto">
<tr>
<td>Legend:<br />
<table cellspacing="0" cellpadding="1">
<tr>
<td style="text-align:center;" class="vc_diff_remove">Removed from v.[rev_left]</td>
<td class="vc_diff_empty">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center;" colspan="2" class="vc_diff_change">changed lines</td>
</tr>
<tr>
<td class="vc_diff_empty">&nbsp;</td>
<td style="text-align:center;" class="vc_diff_add">Added in v.[rev_right]</td>
</tr>
</table>
</td>
</tr>
</table>
[end]
</td>
</tr>
</table>
[include "footer.ezt"]
[include "include/footer.ezt"]

View File

@@ -1,307 +0,0 @@
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head>
<!-- ViewCVS -- http://viewcvs.sourceforge.net/
by Greg Stein -- mailto:gstein@lyra.org
-->
<title>[if-any where][where][else][cfg.general.main_title][end]</title>
</head>
<body text="#000000" bgcolor="#ffffff">
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr>
<td rowspan=2><h1>[if-any where][where][else][cfg.general.main_title][end]</h1></td>
<td align=right><img src="/icons/apache_pb.gif" alt="(logo)" border=0
width=259 height=32></td>
</tr>
<tr>
<td align=right><h3><b><a target="_blank"
href="[request.script_name]/*docroot*/help_[if-any where]dir[else]root[end]view.html">ViewCVS and CVS Help</a></b></h3></td>
</tr>
</table>
[if-any where][else]
<!-- you may insert repository access instructions here -->
[if-any roots]
<h3>Project Root</h3>
<form method=GET action="./">
<select name=cvsroot onchange="submit()">
[for roots]
[is roots current_root]
<option selected>[roots]</option>
[else]
<option>[roots]</option>
[end]
[end]
</select>
<input type=submit value="Go">
</form>
[end]
[end]
<p><a name="dirlist"></a></p>
[if-any where]
<table>
<tr><td>Current directory:</td><td><b>[nav_path]</b></td></tr>
[if-any view_tag]
<tr><td>Current tag:</td><td><b>[view_tag]</b></td></tr>
[end]
[if-any search_re]
<tr><td>Current search:</td><td><b>[search_re]</b></td></tr>
[end]
[is num_files "0"]
[else]
<tr><td>Files shown:</td><td><b>[files_shown]</b></td></tr>
[end]
</table>
[end]
<hr noshade>
[# if you want a colored border around the table of directory
information, then add this additional table tag:
<table border=0 cellpadding=0 width="100%"><tr>
<td bgcolor="#999999">
]
<table width="100%" border=0 cellspacing=1 cellpadding=2>
<tr>
[if-any have_logs]
[is sortby "rev"]
<th align=left bgcolor="#88ff88">Rev.</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_rev_href]"#dirlist>Rev.</a></th>
[end]
[is sortby "file"]
<th align=left bgcolor="#88ff88"
[is cfg.options.use_cvsgraph "1"]colspan=2[end]
>File</th>
[else]
<th align=left bgcolor="#cccccc"
[is cfg.options.use_cvsgraph "1"]colspan=2[end]
><a href="./[sortby_file_href]#dirlist">File</a></th>
[end]
[is sortby "date"]
<th align=left bgcolor="#88ff88">Age</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_date_href]#dirlist">Age</a></th>
[end]
[is sortby "author"]
<th align=left bgcolor="#88ff88">Author</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_author_href]#dirlist">Author</a></th>
[end]
[is sortby "log"]
<th align=left bgcolor="#88ff88">Last log entry</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_log_href]#dirlist">Last log entry</a></th>
[end]
[else]
<th align=left bgcolor="#cccccc">File</th>
[end]
</tr>
[for rows]
<tr bgcolor="[if-index rows even]#ffffff[else]#ccccee[end]">
[is rows.type "unreadable"]
[if-any have_logs]
<td>&nbsp;</td> [# revision ]
[end]
<td><a name="[rows.anchor]">[rows.name]</a>
[if-any have_logs]
</td>
<td colspan=[is cfg.options.use_cvsgraph "1"]4[else]3[end]>
<i>this entry is unreadable</i>
</td>
[else]
- <i>this entry is unreadable</i>
[end]
</td>
[else]
[is rows.type "dir"]
[if-any have_logs]
<td>&nbsp;</td> [# revision ]
[end]
<td [if-any have_logs][is cfg.options.use_cvsgraph "1"]colspan=2[end][end]>
<a name="[rows.anchor]" href="[rows.href]">
<img src="/icons/small/dir.gif" alt="(dir)" border=0 width=16 height=16>
[rows.name]
</a>
[is rows.name "Attic/"]
&nbsp; <a href="./[show_attic_href]#dirlist">[[]show contents]</a>
[end]
</td>
[is rows.cvs "error"]
[# for an error to occur, we must have some logs. always use colspan]
<td colspan=3>
<i>Last modification unavailable - could not read CVS information</i>
</td>
[else]
[if-any have_logs]
[is rows.cvs "none"]
<td>&nbsp;</td> [# age ]
<td>&nbsp;</td> [# author ]
<td>&nbsp;</td> [# log ]
[else]
<td>&nbsp;[rows.time]</td>
[if-any rows.author]
<td>&nbsp;[rows.author]</td>
[end]
[if-any rows.show_log]
<td>&nbsp;[rows.log_file]/[rows.log_rev]<br>
&nbsp;<font size="-1">[rows.log]</font></td>
[end]
[end]
[end]
[end]
[else]
[is rows.cvs "error"]
<td>&nbsp;</td>
<td [is cfg.options.use_cvsgraph "1"]colspan=2[end]>
<a name="[rows.anchor]">[rows.name]</a>
</td>
<td colspan=3><i>CVS information is unreadable</i></td>
[else]
<td>&nbsp;<a href="[rows.href]"><b>[rows.rev]</b></a></td>
<td width="1%"><a name="[rows.anchor]" href="[rows.rev_href]&content-type=text/vnd.viewcvs-markup">
[# to display the revision in a separate window, you could use:
<a name="{rows.anchor}" href="{rows.rev_href}" target="cvs_checkout"
onClick="window.open('{rows.rev_href}', 'cvs_checkout',
'resizeable=1,scrollbars=1')"><b>{rows.rev}</b></a>
(substitute brackets for the braces)
]
<img src="/icons/small/text.gif" alt="(file)" border=0
width=16 height=16>
[rows.name]
</a>
[is rows.state "dead"]
[# don't let this phrase/link be wrapped ]
[if-any view_tag](not&nbsp;exist)[else](in&nbsp;the&nbsp;Attic)[end]&nbsp;<a href="./[hide_attic_href]#dirlist">[[]hide]</a>
[end]
</td>
[if-any rows.graph_href]
<td width="1%"><a href="[rows.graph_href]"><img
src="[request.script_name]/*docroot*/images/cvsgraph_16x16.png"
alt="(graph)" width=16 height=16 border=0>
</a></td>
[end]
<td>&nbsp;[rows.time]</td>
[if-any rows.author]
<td>&nbsp;[rows.author]</td>
[end]
[if-any rows.show_log]
<td>&nbsp;[rows.log]</td>
[end]
[end]
[end]
[end]
</tr>
[end]
</table>
[# if you are using a table border (see above), then add:
</td></tr></table>
]
[if-any no_match]
<p><b>NOTE:</b> There are [num_files] files, but none match the
current selection criteria.
[end]
[if-any unreadable]
<hr size=1 noshade>
<b>NOTE:</b> One or more files were unreadable. The files in the CVS
repository should be readable by the web server process. Please
report this condition to the administrator of this CVS repository.
[end]
[if-any selection_form]
<hr size=1 noshade>
[# this table holds the selectors on the left, and reset on the right ]
<table><tr><td>
<form method=GET action="./">
[for params]
<input type=hidden name="[params.name]" value="[params.value]">
[end]
<table>
[if-any has_tags]
<tr>
<td>Show files using tag:</td>
<td>
<select name=only_with_tag onchange="submit()">
[if-any branch_tags]
<option value="">- Branches -</option>
[for branch_tags]
[is branch_tags view_tag]
<option selected>[branch_tags]</option>
[else]
<option>[branch_tags]</option>
[end]
[end]
[end]
<option value="">- Non-branch tags -</option>
[for plain_tags]
[is plain_tags view_tag]
<option selected>[plain_tags]</option>
[else]
<option>[plain_tags]</option>
[end]
[end]
</select></td>
</tr>
[end]
[is cfg.options.use_re_search "1"]
<tr>
<td>Show files containing the regular expression:</td>
<td><input type="text" name="search" value="[search_re]">
</tr>
[end]
<tr><td>&nbsp;</td><td><input type="submit" value="Show"></td></tr>
</table>
</form>
</td>
[if-any view_tag]
<td valign=bottom><form method=GET action="./">
[for params]
<input type=hidden name="[params.name]" value="[params.value]">
[end]
<input type="submit" value="Show all files">
</form></td>
[else][if-any search_re]
<td valign=bottom><form method=GET action="./">
[for params]
<input type=hidden name="[params.name]" value="[params.value]">
[end]
<input type="submit" value="Show all files">
</form></td>
[end][end]
</tr></table>
[end]
[# if you want to disable tarball generation remove the following: ]
[if-any tarball_href]
<a href="[tarball_href]">Download tarball</a>
[end]
[include "footer.ezt"]

118
templates/dir_new.ezt Normal file
View File

@@ -0,0 +1,118 @@
[include "include/dir_header.ezt"]
<table cellspacing="1" cellpadding="2">
<thead>
<tr>
<th class="vc_header[is sortby "file"]_sort[end]" colspan="2">
<a href="[sortby_file_href]#dirlist">File
[is sortby "file"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
<th class="vc_header[is sortby "rev"]_sort[end]">
<a href="[sortby_rev_href]#dirlist">Last Change
[is sortby "rev"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
</tr>
</thead>
<tbody>
[if-any up_href]
<tr class="vc_row_odd">
<td>
<a href="[up_href]">
<img src="[docroot]/images/back_small.png" alt="" width="16" height="16"
/>&nbsp;Parent&nbsp;Directory</a>
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
[end]
[for entries]
<tr class="vc_row_[if-index entries even]even[else]odd[end]">
<td>
<a name="[entries.anchor]" href="[is entries.pathtype "dir"][entries.view_href][else][if-any entries.prefer_markup][entries.view_href][else][entries.download_href][end][end]" title="[is entries.pathtype "dir"]View Directory Contents[else][if-any entries.prefer_markup]View[else]Download[end] File Contents[end]">
<img src="[docroot]/images/[is entries.pathtype "dir"]dir[else][is entries.state "dead"]broken[else]text[end][end].png" alt="" width="16" height="16" />
[entries.name][is entries.pathtype "dir"]/[end]</a>
[is entries.state "dead"](dead)[end]
</td>
[if-any entries.errors]
<td colspan="2">[for entries.errors]<em>[entries.errors]</em>[end]</td>
[else]
<td style="width:1%; white-space: nowrap">
[# Icon column. We might want to add more icons like a tarball
# icon for directories or a diff to previous icon for files. ]
[if-any entries.log_href]
<a href="[entries.log_href]"><img
src="[docroot]/images/log.png"
alt="View Log" width="16" height="16" /></a>
[end]
[is entries.pathtype "dir"]
[is roottype "cvs"]
[# no point in showing icon when there's only one to choose from]
[else]
<a href="[entries.view_href]"><img
src="[docroot]/images/list.png"
alt="View Directory Listing" width="16" height="16" /></a>
[end]
[end]
[is entries.pathtype "file"]
[if-any entries.graph_href]
<a href="[entries.graph_href]"
title="View Revision Graph"><img
src="[docroot]/images/cvsgraph_16x16.png"
alt="View Revision Graph" width="16" height="16" />
</a>
[end]
[if-any entries.view_href]
<a href="[entries.view_href]"><img
src="[docroot]/images/view.png"
alt="View File" width="16" height="16" /></a>
[end]
[if-any entries.download_href]
<a href="[entries.download_href]"><img
src="[docroot]/images/download.png"
alt="Download File" width="16" height="16" /></a>
[end]
[if-any entries.annotate_href]
<a href="[entries.annotate_href]"><img
src="[docroot]/images/annotate.png"
alt="Annotate File" width="16" height="16" /></a>
[end]
[end]
</td>
<td>
[if-any entries.rev]
<strong>[if-any entries.revision_href]<a href="[entries.revision_href]">[entries.rev]</a>[else][entries.rev][end]</strong>
([entries.ago] ago)
by <em>[entries.author]</em>:
[entries.log]
[is entries.pathtype "dir"][is roottype "cvs"]
<em>(from [entries.log_file]/[entries.log_rev])</em>
[end][end]
[end]
</td>
[end]
</tr>
[end]
</tbody>
</table>
[include "include/dir_footer.ezt"]

View File

@@ -1,305 +1,118 @@
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head>
<!-- ViewCVS -- http://viewcvs.sourceforge.net/
by Greg Stein -- mailto:gstein@lyra.org
-->
<title>[if-any where][where][else][cfg.general.main_title][end]</title>
</head>
<body text="#000000" bgcolor="#ffffff">
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr>
<td rowspan=2><h1>[if-any where][where][else][cfg.general.main_title][end]</h1></td>
<td align=right><img src="/icons/apache_pb.gif" alt="(logo)" border=0
width=259 height=32></td>
</tr>
<tr>
<td align=right><h3><b><a target="_blank"
href="[request.script_name]/*docroot*/help_[if-any where]dir[else]root[end]view.html">ViewCVS and CVS Help</a></b></h3></td>
</tr>
</table>
[include "include/dir_header.ezt"]
[if-any where][else]
<!-- you may insert repository access instructions here -->
[if-any roots]
<h3>Project Root</h3>
<form method=GET action="./">
<select name=cvsroot onchange="submit()">
[for roots]
[is roots current_root]
<option selected>[roots]</option>
[else]
<option>[roots]</option>
[end]
[end]
</select>
<input type=submit value="Go">
</form>
[end]
[end]
<p><a name="dirlist"></a></p>
[if-any where]
<table>
<tr><td>Current directory:</td><td><b>[nav_path]</b></td></tr>
[if-any view_tag]
<tr><td>Current tag:</td><td><b>[view_tag]</b></td></tr>
[end]
[if-any search_re]
<tr><td>Current search:</td><td><b>[search_re]</b></td></tr>
[end]
[is num_files "0"]
[else]
<tr><td>Files shown:</td><td><b>[files_shown]</b></td></tr>
[end]
</table>
[end]
<hr noshade>
[# if you want a colored border around the table of directory
information, then add this additional table tag:
<table border=0 cellpadding=0 width="100%"><tr>
<td bgcolor="#999999">
]
<table width="100%" border=0 cellspacing=1 cellpadding=2>
<table cellspacing="1" cellpadding="2">
<thead>
<tr>
[if-any have_logs]
[is sortby "file"]
<th align=left bgcolor="#88ff88"
[is cfg.options.use_cvsgraph "1"]colspan=2[end]
>File</th>
[else]
<th align=left bgcolor="#cccccc"
[is cfg.options.use_cvsgraph "1"]colspan=2[end]
><a href="./[sortby_file_href]#dirlist">File</a></th>
[end]
[is sortby "rev"]
<th align=left bgcolor="#88ff88">Rev.</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_rev_href]"#dirlist>Rev.</a></th>
[end]
[is sortby "date"]
<th align=left bgcolor="#88ff88">Age</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_date_href]#dirlist">Age</a></th>
[end]
[is sortby "author"]
<th align=left bgcolor="#88ff88">Author</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_author_href]#dirlist">Author</a></th>
[end]
[is sortby "log"]
<th align=left bgcolor="#88ff88">Last log entry</th>
[else]
<th align=left bgcolor="#cccccc"
><a href="./[sortby_log_href]#dirlist">Last log entry</a></th>
[end]
[else]
<th align=left bgcolor="#cccccc">File</th>
<th class="vc_header[is sortby "file"]_sort[end]" colspan="2">
<a href="[sortby_file_href]#dirlist">File
[is sortby "file"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
<th class="vc_header[is sortby "rev"]_sort[end]">
<a href="[sortby_rev_href]#dirlist">Rev.
[is sortby "rev"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
<th class="vc_header[is sortby "date"]_sort[end]">
<a href="[sortby_date_href]#dirlist">Age
[is sortby "date"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
<th class="vc_header[is sortby "author"]_sort[end]">
<a href="[sortby_author_href]#dirlist">Author
[is sortby "author"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
[is cfg.options.show_logs "1"]
<th class="vc_header[is sortby "log"]_sort[end]">
<a href="[sortby_log_href]#dirlist">Last log entry
[is sortby "log"]
<img class="vc_sortarrow" alt="[is sortdir "down"](rev)[end]"
width="13" height="13"
src="[docroot]/images/[is sortdir "up"]up[else]down[end].png" />
[end]
</a>
</th>
[end]
</tr>
</thead>
[for rows]
<tr bgcolor="[if-index rows even]#ffffff[else]#ccccee[end]">
[is rows.type "unreadable"]
<td><a name="[rows.anchor]">[rows.name]</a>
[if-any have_logs]
</td>
<td colspan=[is cfg.options.use_cvsgraph "1"]5[else]4[end]>
<i>this entry is unreadable</i>
</td>
[else]
- <i>this entry is unreadable</i>
[end]
<tbody>
[if-any up_href]
<tr class="vc_row_odd">
<td colspan="2">
<a href="[up_href]">
<img src="[docroot]/images/back_small.png" alt="" width="16" height="16"
/>&nbsp;Parent&nbsp;Directory</a>
</td>
[else]
[is rows.type "dir"]
<td [if-any have_logs][is cfg.options.use_cvsgraph "1"]colspan=2[end][end]>
<a name="[rows.anchor]" href="[rows.href]">
<img src="/icons/small/dir.gif" alt="(dir)" border=0 width=16 height=16>
[rows.name]
</a>
[is rows.name "Attic/"]
&nbsp; <a href="./[show_attic_href]#dirlist">[[]show contents]</a>
[end]
</td>
[is rows.cvs "error"]
[# for an error to occur, we must have some logs. always use colspan]
<td colspan=4>
<i>Last modification unavailable - could not read CVS information</i>
</td>
[else]
[if-any have_logs]
<td>&nbsp;</td> [# revision ]
[is rows.cvs "none"]
<td>&nbsp;</td> [# age ]
<td>&nbsp;</td> [# author ]
<td>&nbsp;</td> [# log ]
[else]
<td>&nbsp;[rows.time]</td>
[if-any rows.author]
<td>&nbsp;[rows.author]</td>
[end]
[if-any rows.show_log]
<td>&nbsp;[rows.log_file]/[rows.log_rev]<br>
&nbsp;<font size="-1">[rows.log]</font></td>
[end]
[end]
[end]
[end]
[else]
[is rows.cvs "error"]
<td [is cfg.options.use_cvsgraph "1"]colspan=2[end]>
<a name="[rows.anchor]">[rows.name]</a>
</td>
<td colspan=4><i>CVS information is unreadable</i></td>
[else]
<td><a name="[rows.anchor]" href="[rows.href]">
<img src="/icons/small/text.gif" alt="(file)" border=0
width=16 height=16>
[rows.name]
</a>
[is rows.state "dead"]
[# don't let this phrase/link be wrapped ]
[if-any view_tag](not&nbsp;exist)[else](in&nbsp;the&nbsp;Attic)[end]&nbsp;<a href="./[hide_attic_href]#dirlist">[[]hide]</a>
[end]
</td>
[if-any rows.graph_href]
<td width="1%"><a href="[rows.graph_href]"><img
src="[request.script_name]/*docroot*/images/cvsgraph_16x16.png"
alt="(graph)" width=16 height=16 border=0>
</a></td>
[end]
<td>&nbsp;
<a href="[rows.rev_href]&content-type=text/vnd.viewcvs-markup">
<b>[rows.rev]</b>
</a>
[# to display the revision in a separate window, you could use:
<a href="{rows.rev_href}" target="cvs_checkout"
onClick="window.open('{rows.rev_href}', 'cvs_checkout',
'resizeable=1,scrollbars=1')"><b>{rows.rev}</b></a>
(substitute brackets for the braces)
]
</td>
<td>&nbsp;[rows.time]</td>
[if-any rows.author]
<td>&nbsp;[rows.author]</td>
[end]
[if-any rows.show_log]
<td>&nbsp;[rows.log]</td>
[end]
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
[is cfg.options.show_logs "1"]
<td>&nbsp;</td>
[end]
</tr>
[end]
[for entries]
<tr class="vc_row_[if-index entries even]even[else]odd[end]">
<td[if-any entries.graph_href][else] colspan="2"[end]>
[is entries.pathtype "dir"]
<a name="[entries.anchor]" href="[entries.view_href]" title="View directory contents">
[else]
<a name="[entries.anchor]" href="[entries.log_href]" title="View file revision log">
[end]
<img src="[docroot]/images/[is entries.pathtype "dir"]dir[else][is entries.state "dead"]broken[else]text[end][end].png" alt="" width="16" height="16" />
[entries.name][is entries.pathtype "dir"]/[end]</a>
[is entries.state "dead"](dead)[end]
</td>
[if-any entries.graph_href]
<td style="width:1%"><a href="[entries.graph_href]"
title="View Revision Graph"><img
src="[docroot]/images/cvsgraph_16x16.png"
alt="View Revision Graph" width="16" height="16" />
</a></td>
[end]
[if-any entries.errors]
<td colspan=[is cfg.options.show_logs "1"]4[else]3[end]>
[for entries.errors]<em>[entries.errors]</em>[end]
</td>
[else]
[is entries.pathtype "dir"]
<td>&nbsp;[if-any entries.rev]<a href="[entries.log_href]" title="View directory revision log"><strong>[entries.rev]</strong></a>[end]</td>
[else]
<td>&nbsp;[if-any entries.rev]<a href="[if-any entries.prefer_markup][entries.view_href][else][entries.download_href][end]" title="[if-any entries.prefer_markup]View[else]Download[end] file contents"><strong>[entries.rev]</strong></a>[end]</td>
[end]
<td>&nbsp;[entries.ago]</td>
<td>&nbsp;[entries.author]</td>
[is cfg.options.show_logs "1"]
[if-any entries.log]
<td>&nbsp;[entries.log][is entries.pathtype "dir"][is roottype "cvs"]
<em>(from [entries.log_file]/[entries.log_rev])</em>[end][end]</td>
[else]
<td>&nbsp;</td>
[end]
[end]
[end]
[end]
</tr>
[end]
</tbody>
</table>
[# if you are using a table border (see above), then add:
</td></tr></table>
]
[if-any no_match]
<p><b>NOTE:</b> There are [num_files] files, but none match the
current selection criteria.
[end]
[if-any unreadable]
<hr size=1 noshade>
<b>NOTE:</b> One or more files were unreadable. The files in the CVS
repository should be readable by the web server process. Please
report this condition to the administrator of this CVS repository.
[end]
[if-any selection_form]
<hr size=1 noshade>
[# this table holds the selectors on the left, and reset on the right ]
<table><tr><td>
<form method=GET action="./">
[for params]
<input type=hidden name="[params.name]" value="[params.value]">
[end]
<table>
[if-any has_tags]
<tr>
<td>Show files using tag:</td>
<td>
<select name=only_with_tag onchange="submit()">
[if-any branch_tags]
<option value="">- Branches -</option>
[for branch_tags]
[is branch_tags view_tag]
<option selected>[branch_tags]</option>
[else]
<option>[branch_tags]</option>
[end]
[end]
[end]
<option value="">- Non-branch tags -</option>
[for plain_tags]
[is plain_tags view_tag]
<option selected>[plain_tags]</option>
[else]
<option>[plain_tags]</option>
[end]
[end]
</select></td>
</tr>
[end]
[is cfg.options.use_re_search "1"]
<tr>
<td>Show files containing the regular expression:</td>
<td><input type="text" name="search" value="[search_re]">
</tr>
[end]
<tr><td>&nbsp;</td><td><input type="submit" value="Show"></td></tr>
</table>
</form>
</td>
[if-any view_tag]
<td valign=bottom><form method=GET action="./">
[for params]
<input type=hidden name="[params.name]" value="[params.value]">
[end]
<input type="submit" value="Show all files">
</form></td>
[else][if-any search_re]
<td valign=bottom><form method=GET action="./">
[for params]
<input type=hidden name="[params.name]" value="[params.value]">
[end]
<input type="submit" value="Show all files">
</form></td>
[end][end]
</tr></table>
[end]
[# if you want to disable tarball generation remove the following: ]
[if-any tarball_href]
<a href="[tarball_href]">Download tarball</a>
[end]
[include "footer.ezt"]
[include "include/dir_footer.ezt"]

View File

@@ -0,0 +1,14 @@
/************************************/
/*** ViewVC Help CSS Stylesheet ***/
/************************************/
/*** Standard Tags ***/
body {
margin: 0.5em;
}
img { border: none; }
table { width: 100%; }
td { vertical-align: top; }
col.menu { width:12em; }

View File

@@ -0,0 +1,130 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ViewVC Help: Directory View</title>
<link rel="stylesheet" href="help.css" type="text/css" />
</head>
<body>
<table>
<col class="menu" />
<col />
<tr>
<td><a href="http://viewvc.org/index.html"><img
src="images/logo.png" alt="ViewVC logotype" /></a>
</td>
<td>
<h1>ViewVC Help: Directory View</h1>
</td>
</tr>
<tr><td>
<h3>Help</h3>
<a href="help_rootview.html">General</a><br />
<strong>Directory&nbsp;View</strong><br />
<a href="help_log.html">Log&nbsp;View</a><br />
<h3>Internet</h3>
<a href="http://viewvc.org/index.html">Home</a><br />
<a href="http://viewvc.org/upgrading.html">Upgrading</a><br />
<a href="http://viewvc.org/contributing.html">Contributing</a><br />
<a href="http://viewvc.org/license-1.html">License</a><br />
</td><td colspan="2">
<p>The directory listing view should be a familiar sight to any
computer user. It shows the path of the current directory being viewed
at the top of the page. Below that is a table summarizing the
directory contents, and then comes actual contents, a sortable list of
all files and subdirectories inside the current directory.</p>
<p><a name="summary"></a>The summary table is made up of some or all
of the following rows:</p>
<ul>
<li><a name="summary-files-shown"><strong>Files Shown</strong></a>
- Number of files shown in the directory listing. This might be less
than the actual number of files in the directory if a
<a href="#option-search">regular expression search</a> is in place,
hiding files which don't meet the search criteria. In CVS directory
listings, this row will also have a link to toggle display of
<a href="help_rootview.html#dead-files">dead files</a>, if any are
present.</li>
<li><a name="summary-revision"><strong>Directory
Revision</strong></a> - For Subversion directories only.
Shown as "# of #" where the first number is the most recent
repository revision where the directory (or a path underneath it)
was modified. The second number is just the latest repository
revision. Both numbers are links to
<a href="help_rootview.html#view-rev">revision views</a></li>
<li><a name="summary-sticky-revision-tag"><strong>Sticky
Revision/Tag</strong></a> - shows the current
<a href="help_rootview.html#sticky-revision-tag">sticky revision or
tag</a> and contains form fields to set or clear it.</li>
<li><a name="summary-search"><strong>Current Search</strong></a> -
If a <a href="#option-search">regular expression search</a> is in place,
shows the search string.</li>
<li><a name="summary-query"><strong>Query</strong></a> - Provides
a link to a <a href="help_rootview.html#view-query">query form</a>
for the directory</li>
</ul>
<p><a name="list"></a>The actual directory list is a table with
filenames and directory names in one column and information about the
most recent revisions where each file or directory was modified in the
other columns. Column headers can be clicked to sort the directory
entries in order by a column, and clicked again to reverse the sort
order.</p>
<p>
<!-- If using directory.ezt template -->
File names are links to <a href="help_log.html">log views</a>
showing a list of revisions where a file was modified. Revision
numbers are links to either
<a href="help_rootview.html#view-markup">view</a>
or <a href="help_rootview.html#view-checkout">download</a> a file
(depending on its file type). The links are reversed for directories.
Directory revision numbers are links to <a href="help_log.html">log
views</a>, while directory names are links showing the contents of those
directories.
<!-- If using dir_alt.ezt template -->
<!--
File and directory names are links to retrieve their contents.
File links may be either
<a href="help_rootview.html#view-markup">view</a>
or <a href="help_rootview.html#view-download">download</a> links
depending on the file type. Directory links go to directory
listings. Revision numbers are links to <a href="help_log.html">log
views</a> showing lists of revisions where a file or directory was
modified.
-->
Also, in CVS repositories with the
<a href="help_rootview.html#view-graph">graph view</a> enabled, there
will be small
<img src="images/cvsgraph_16x16.png" width="16" height="16" alt="graph">
icons next to file names which are links to revision graphs.</p>
<p>Depending on how ViewVC is configured, there may be more options
at the bottom of directory pages:</p>
<ul>
<li><a name="option-search"><strong>Regular expression
search</strong></a> - If enabled, will show a form field accepting
a search string (a
<a href="http://doc.python.org/lib/re-syntax.html">python regular
expression</a>). Once submitted, only files that have at least
one occurance of the expression will show up in directory listings.
</li>
<li><a name="option-tarball"><strong>Tarball download</strong></a> -
If enabled, will show a link to download a gzipped tar archive of
the directory contents.</li>
</ul>
</td></tr></table>
<hr />
<address><a href="mailto:users@viewvc.tigris.org">ViewVC Users Mailinglist</a></address>
</body>
</html>

View File

@@ -0,0 +1,74 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ViewVC Help: Log View</title>
<link rel="stylesheet" href="help.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<table>
<col class="menu" />
<col />
<tr>
<td><a href="http://viewvc.org/index.html"><img
src="images/logo.png" alt="ViewVC logotype" /></a>
</td>
<td>
<h1>ViewVC Help: Log View</h1>
</td>
</tr>
<tr><td>
<h3>Help</h3>
<a href="help_rootview.html">General</a><br />
<a href="help_dirview.html">Directory&nbsp;View</a><br />
<strong>Log&nbsp;View</strong><br />
<h3>Internet</h3>
<a href="http://viewvc.org/index.html">Home</a><br />
<a href="http://viewvc.org/upgrading.html">Upgrading</a><br />
<a href="http://viewvc.org/contributing.html">Contributing</a><br />
<a href="http://viewvc.org/license-1.html">License</a><br />
</td><td colspan="2">
<p>
The log view displays the revision history of the selected source
file or directory. For each revision the following information is
displayed:
<ul>
<li>The revision number. In Subversion repositories, this is a
link to the <a href="help_rootview.html#view-rev">revision
view</a></li>
<li>For files, links to
<a href="help_rootview.html#view-markup">view</a>,
<a href="help_rootview.html#view-checkout">download</a>, and
<a href="help_rootview.html#view-annotate">annotate</a> the
revision. For directories, a link to
<a href="help_dirview.html">list directory contents</a></li>
<li>A link to select the revision for diffs (see below)</li>
<li>The date and age of the change</li>
<li>The author of the modification</li>
<li>The CVS branch (usually <em>MAIN</em>, if not on a branch)</li>
<li>Possibly a list of CVS tags bound to the revision (if any)</li>
<li>The size of the change measured in added and removed lines of
code. (CVS only)</li>
<li>The size of the file in bytes at the time of the revision
(Subversion only)</li>
<li>Links to view diffs to the previous revision or possibly to
an arbitrary selected revision (if any, see above)</li>
<li>If the revision is the result of a copy, the path and revision
copied from</li>
<li>If the revision precedes a copy or rename, the path at the
time of the revision</li>
<li>And last but not least, the commit log message which should tell
about the reason for the change.</li>
</ul>
<p>
At the bottom of the page you will find a form which allows
to request diffs between arbitrary revisions.
</p>
</td></tr></table>
<hr />
<address><a href="mailto:users@viewvc.tigris.org">ViewVC Users Mailinglist</a></address>
</body>
</html>

View File

@@ -1,31 +1,34 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head>
<title>ViewCVS Help: Query The Commit Database</title>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ViewVC Help: Query The Commit Database</title>
<link rel="stylesheet" href="help.css" type="text/css" />
</head>
<body background="images/chalk.jpg">
<table width="100%" border=0 cellspacing=5 cellpadding=0>
<body>
<table>
<col class="menu" />
<col />
<tr>
<td width="1%"><a href=".."><img border=0
src="images/logo.png"></a>
<td><a href=".."><img
src="images/logo.png" alt="ViewVC logotype" /></a>
</td>
<td><h1>ViewCVS Help: Query The Commit Database</h1></td>
<td><h1>ViewVC Help: Query The Commit Database</h1></td>
</tr>
<tr><td width="1%" valign="top" bgcolor="#ffffff">
<tr><td>
<h3>Other&nbsp;Help:</h3>
<a href="help_rootview.html">General</a><br>
<a href="help_dirview.html">Directory&nbsp;View</a><br>
<a href="help_log.html">Classic&nbsp;Log&nbsp;View</a><br>
<a href="help_logtable.html">Alternative&nbsp;Log&nbsp;View</a><br>
<b>Query&nbsp;Database</b>
<a href="help_rootview.html">General</a><br />
<a href="help_dirview.html">Directory&nbsp;View</a><br />
<a href="help_log.html">Classic&nbsp;Log&nbsp;View</a><br />
<a href="help_logtable.html">Alternative&nbsp;Log&nbsp;View</a><br />
<strong>Query&nbsp;Database</strong>
<h3>Internet</h3>
<a href="http://viewcvs.sf.net/index.html">Home</a><br>
<a href="http://viewcvs.sf.net/upgrading.html">Upgrading</a><br>
<a href="http://viewcvs.sf.net/contributing.html">Contributing</a><br>
<a href="http://viewcvs.sf.net/license-1.html">License</a><br>
</td><td colspan=2>
<a href="http://viewvc.org/index.html">Home</a><br />
<a href="http://viewvc.org/upgrading.html">Upgrading</a><br />
<a href="http://viewvc.org/contributing.html">Contributing</a><br />
<a href="http://viewvc.org/license-1.html">License</a><br />
</td><td colspan="2">
<p>
Select your parameters for querying the CVS commit database in the
@@ -37,8 +40,8 @@
<p>
Any of the text entry fields can take a comma-seperated list of
search arguments. For example, to search for all commits from
authors <i>jpaint</i> and <i>gstein</i>, just type: <code>jpaint,
gstein</code> in the <i>Author</i> input box. If you are searching
authors <em>jpaint</em> and <em>gstein</em>, just type: <code>jpaint,
gstein</code> in the <em>Author</em> input box. If you are searching
for items containing spaces or quotes, you will need to quote your
request. For example, the same search above with quotes is:
<code>"jpaint", "gstein"</code>.
@@ -52,8 +55,8 @@
command character for regular expressions is <code>r</code>, and is
passed directly to MySQL, so you'll need to refer to the MySQL
manual for the exact regex syntax. It is very similar to Perl. A
wildard search for all files with a <i>.py</i> extention is:
<code>l"%.py"</code> in the <i>File</i> input box. The same search done
wildard search for all files with a <em>.py</em> extention is:
<code>l"%.py"</code> in the <em>File</em> input box. The same search done
with a regular expression is: <code>r".*\.py"</code>.
</p>
<p>

View File

@@ -0,0 +1,169 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ViewVC Help: General</title>
<link rel="stylesheet" href="help.css" type="text/css" />
</head>
<body>
<table>
<col class="menu" />
<col />
<tr>
<td><a href=".."><img
src="images/logo.png" alt="ViewVC logotype" /></a>
</td>
<td>
<h1>ViewVC Help: General</h1>
</td>
</tr>
<tr><td>
<h3>Help</h3>
<strong>General</strong><br />
<a href="help_dirview.html">Directory&nbsp;View</a><br />
<a href="help_log.html">Log&nbsp;View</a><br />
<h3>Internet</h3>
<a href="http://viewvc.org/index.html">Home</a><br />
<a href="http://viewvc.org/upgrading.html">Upgrading</a><br />
<a href="http://viewvc.org/contributing.html">Contributing</a><br />
<a href="http://viewvc.org/license-1.html">License</a><br />
</td><td colspan="2">
<p><em>ViewVC</em> is a WWW interface for CVS and Subversion
repositories. It allows you to browse the files and directories in a
repository while showing you metadata from the repository history: log
messages, modification dates, author names, revision numbers, copy
history, and so on. It provides several different views of repository
data to help you find the information you are looking for:</p>
<ul>
<li><a name="view-dir" href="help_dirview.html"><strong>Directory
View</strong></a> - Shows a list of files and subdirectories in a
directory of the repository, along with metadata like author names and
log entries.</li>
<li><a name="view-log" href="help_log.html"><strong>Log
View</strong></a> - Shows a revision by revision list of all the
changes that have made to a file or directory in the repository, with
metadata and links to views of each revision.</li>
<li><a name="view-markup"><strong>File Contents View (Markup
View)</strong></a> - Shows the contents of a file at a particular
revision, with revision information at the top of the page. File
revisions which are GIF, PNG, or JPEG images are displayed inline on
the page. Other file types are displayed as marked up text. The markup
may be limited to turning URLs and email addresses into links, or
configured to show colorized source code.</li>
<li><a name="view-checkout"><strong>File Download (Checkout
View)</strong></a> - Retrieves the unaltered contents of a file
revision. Browsers may try to display the file, or just save it to
disk.</li>
<li><a name="view-annotate"><strong>File Annotate View</strong></a> -
Shows the contents of a file revision and breaks it down line by line,
showing the revision number where each one was last modified, along
with links and other information. <em>This view is disabled in some
ViewVC configurations</em></li>
<li><a name="view-diff"><strong>File Diff View</strong></a> - Shows
the changes made between two revisions of a file</li>
<li><a name="view-tarball"><strong>Directory Tarball View</strong> -
Retrieves a gzipped tar archive containing the contents of a
directory.<em>This view is disabled in the default ViewVC
configuration.</em></li>
<li><a name="view-query"><strong>Directory Query View</strong></a> -
Shows information about changes made to all subdirectories and files
under a parent directory, sorted and filtered by criteria you specify.
<em>This view is disabled in the default ViewVC configuration.</em>
</li>
<li><a name="view-rev"><strong>Revision View</strong> - Shows
information about a revision including log message, author, and a list
of changed paths. <em>For Subversion repositories only.</em></li>
<li><a name="view-graph"><strong>Graph View</strong></a> - Shows a
graphical representation of a file's revisions and branches complete
with tag and author names and links to markup and diff pages.
<em>For CVS repositories only, and disabled in the default
configuration.</em></li>
</ul>
<h3><a name="multiple-repositories">Multiple Repositories</a></h3>
<p>A single installation of ViewVC is often used to provide access to
more than one repository. In these installations, ViewVC shows a
<em>Project Root</em> drop down box in the top right corner of every
generated page to allow for quick access to any repository.</p>
<h3><a name="sticky-revision-tag">Sticky Revision and Tag</a></h3>
<p>By default, ViewVC will show the files and directories and revisions
that currently exist in the repository. But it's also possible to browse
the contents of a repository at a point in its past history by choosing
a "sticky tag" (in CVS) or a "sticky revision" (in Subversion) from the
forms at the top of directory and log pages. They're called sticky
because once they're chosen, they stick around when you navigate to
other pages, until you reset them. When they're set, directory and log
pages only show revisions preceding the specified point in history. In
CVS, when a tag refers to a branch or a revision on a branch, only
revisions from the branch history are shown, including branch points and
their preceding revisions.</p>
<h3><a name="dead-files">Dead Files</a></h3>
<p>In CVS directory listings, ViewVC can optionally display dead files.
Dead files are files which used to be in a directory but are currently
deleted, or files which just don't exist in the currently selected
<a href="#sticky-revision-tag">sticky tag</a>. Dead files cannot be
shown in Subversion repositories. The only way to see a deleted file in
a Subversion directory is to navigate to a sticky revision where the
file previously existed.</p>
<h3><a name="artificial-tags">Artificial Tags</a></h3>
<p>In CVS Repositories, ViewVC adds artificial tags <em>HEAD</em> and
<em>MAIN</em> to tag listings and accepts them in place of revision
numbers and real tag names in all URLs. <em>MAIN</em> acts like a branch
tag pointing at the default branch, while <em>HEAD</em> acts like a
revision tag pointing to the latest revision on the default branch. The
default branch is usually just the trunk, but may be set to other
branches inside individual repository files. CVS will always check out
revisions from a file's default branch when no other branch is specified
on the command line.</p>
<h3><a name="more-information">More Information</a></h3>
<p>More information about <em>ViewVC</em> is available from
<a href="http://viewvc.org/">viewvc.org</a>.
See the links below for guides to CVS and Subversion</p>
<h4>Documentation about CVS</h4>
<blockquote>
<p>
<a href="http://cvsbook.red-bean.com/"><em>Open Source
Development with CVS</em></a><br />
<a href="http://www.loria.fr/~molli/cvs/doc/cvs_toc.html">CVS
User's Guide</a><br />
<a href="http://cellworks.washington.edu/pub/docs/cvs/tutorial/cvs_tutorial_1.html">Another CVS tutorial</a><br />
<a href="http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/cvs/">Yet another CVS tutorial (a little old, but nice)</a><br />
<a href="http://www.cs.utah.edu/dept/old/texinfo/cvs/FAQ.txt">An old but very useful FAQ about CVS</a>
</p>
</blockquote>
<h4>Documentation about Subversion</h3>
<blockquote>
<p>
<a href="http://svnbook.red-bean.com/"><em>Version Control with
Subversion</em></a><br />
</p>
</blockquote>
</td></tr></table>
<hr />
<address><a href="mailto:users@viewvc.tigris.org">ViewVC Users Mailinglist</a></address>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

View File

Before

Width:  |  Height:  |  Size: 755 B

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Some files were not shown because too many files have changed in this diff Show More