mirror of
https://github.com/vitalif/viewvc-4intranet
synced 2019-04-16 04:14:59 +03:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8b0bcade3b | ||
![]() |
3f09d2e039 | ||
![]() |
ef501bd217 | ||
![]() |
e0342ff46e | ||
![]() |
d3210a1fec | ||
![]() |
2ba682c141 | ||
![]() |
6f67d8874a | ||
![]() |
88ef87c6af | ||
![]() |
dae7542569 | ||
![]() |
ea28160e45 | ||
![]() |
384d0dc1a6 | ||
![]() |
95927627b2 | ||
![]() |
d95ceab8a3 | ||
![]() |
1aff68d647 | ||
![]() |
4a3e55dac7 | ||
![]() |
171fadee27 | ||
![]() |
bef839ab4e | ||
![]() |
6647de80c3 | ||
![]() |
99e1a51e20 | ||
![]() |
c25dd8c213 | ||
![]() |
6cc6bde99f | ||
![]() |
d4c351e01f | ||
![]() |
7a5a7cfb69 | ||
![]() |
38b429220e | ||
![]() |
f42e157e88 | ||
![]() |
4312ecd3fa | ||
![]() |
504ca48e0f | ||
![]() |
0c0ec82ca2 | ||
![]() |
58a237b14c | ||
![]() |
24d1a691dc | ||
![]() |
51011abec8 | ||
![]() |
0bbe7f5751 | ||
![]() |
1df169ab24 | ||
![]() |
98e7612420 | ||
![]() |
70b0076d88 | ||
![]() |
e23b88d389 | ||
![]() |
336ee6b95d | ||
![]() |
642130cf93 | ||
![]() |
1e3c57f2e0 |
31
CHANGES
31
CHANGES
@@ -1,3 +1,34 @@
|
|||||||
|
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)
|
Version 1.0.1 (released 20-Jul-2006)
|
||||||
|
|
||||||
* fix exception on log page when use_pagesize is enabled
|
* fix exception on log page when use_pagesize is enabled
|
||||||
|
336
INSTALL
336
INSTALL
@@ -1,11 +1,12 @@
|
|||||||
CONTENTS
|
CONTENTS
|
||||||
--------
|
--------
|
||||||
TO THE IMPATIENT
|
TO THE IMPATIENT
|
||||||
|
SECURITY INFORMATION
|
||||||
INSTALLING VIEWVC
|
INSTALLING VIEWVC
|
||||||
APACHE CONFIGURATION
|
APACHE CONFIGURATION
|
||||||
UPGRADING VIEWVC
|
UPGRADING VIEWVC
|
||||||
SQL CHECKIN DATABASE
|
SQL CHECKIN DATABASE
|
||||||
ENSCRIPT AND HIGHLIGHT CONFIGURATION
|
ENABLING SYNTAX COLORATION
|
||||||
CVSGRAPH CONFIGURATION
|
CVSGRAPH CONFIGURATION
|
||||||
IF YOU HAVE PROBLEMS...
|
IF YOU HAVE PROBLEMS...
|
||||||
|
|
||||||
@@ -50,24 +51,58 @@ Congratulations on getting this far. :-)
|
|||||||
* CvsGraph 1.5.0 or later, graphical CVS revision tree generator
|
* CvsGraph 1.5.0 or later, graphical CVS revision tree generator
|
||||||
(http://www.akhphd.au.dk/~bertho/cvsgraph/)
|
(http://www.akhphd.au.dk/~bertho/cvsgraph/)
|
||||||
|
|
||||||
GUI Operation:
|
Quick sanity check:
|
||||||
|
|
||||||
If you just want to see what your CVS repository looks like with
|
If you just want to see what your repository looks like when seen
|
||||||
ViewVC, type "bin/standalone.py -g -r /PATH/TO/CVS/ROOT". This
|
through ViewVC, type:
|
||||||
will start a tiny webserver serving at http://localhost:7467/.
|
|
||||||
PLEASE NOTE: This requires Python with thread support enabled and
|
|
||||||
the Tkinter GUI. If you don't have one of these, omit the '-g' option.
|
|
||||||
|
|
||||||
|
$ 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:
|
Standard operation:
|
||||||
|
|
||||||
To start installing right away (on UNIX): type "./viewvc-install"
|
To start installing right away (on UNIX): type "./viewvc-install"
|
||||||
in the current directory and answer the prompts. When it
|
in the current directory and answer the prompts. When it
|
||||||
finishes, edit the file viewvc.conf in the installation directory
|
finishes, edit the file viewvc.conf in the installation directory
|
||||||
to tell viewvc the paths to your CVS and Subversion repositories. Next,
|
to tell ViewVC the paths to your CVS and Subversion repositories.
|
||||||
configure your web server to run <INSTALL>/cgi/viewvc.cgi, as
|
Next, configure your web server (in the way appropriate to that browser)
|
||||||
appropriate for your web server. The section `INSTALLING VIEWVC'
|
to run <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi. The section
|
||||||
below is still recommended reading.
|
`INSTALLING VIEWVC' below is still recommended reading.
|
||||||
|
|
||||||
|
|
||||||
|
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
|
INSTALLING VIEWVC
|
||||||
@@ -107,8 +142,11 @@ installation instructions.
|
|||||||
3) Edit <VIEWVC_INSTALLATION_DIRECTORY>/viewvc.conf for your specific
|
3) Edit <VIEWVC_INSTALLATION_DIRECTORY>/viewvc.conf for your specific
|
||||||
configuration. In particular, examine the following configuration options:
|
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
|
default_root
|
||||||
|
root_as_url_component
|
||||||
rcs_path
|
rcs_path
|
||||||
mime_types_file
|
mime_types_file
|
||||||
|
|
||||||
@@ -118,22 +156,22 @@ installation instructions.
|
|||||||
then edit the files in <VIEWVC_INSTALLATION_DIRECTORY>/templates.
|
then edit the files in <VIEWVC_INSTALLATION_DIRECTORY>/templates.
|
||||||
You need knowledge about HTML to edit the templates.
|
You need knowledge about HTML to edit the templates.
|
||||||
|
|
||||||
4) The CGI programs are in <VIEWVC_INSTALLATION_DIRECTORY>/www/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
|
symlink to this directory from somewhere in your published HTTP server
|
||||||
path if your webserver is configured to follow symbolic links. You can
|
path if your webserver is configured to follow symbolic links. You can
|
||||||
also copy the installed <VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/*.cgi
|
also copy the installed <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
|
||||||
scripts after the install (unlike the other files in ViewVC, the scripts
|
scripts after the install (unlike the other files in ViewVC, the scripts
|
||||||
under www/ can be moved).
|
under bin/ can be moved).
|
||||||
|
|
||||||
If you are using Apache, then see below at the section
|
If you are using Apache, then see below at the section titled
|
||||||
titled APACHE CONFIGURATION.
|
APACHE CONFIGURATION.
|
||||||
|
|
||||||
NOTE: for security reasons, it is not advisable to install ViewVC
|
NOTE: for security reasons, it is not advisable to install ViewVC
|
||||||
directly into your published HTTP directory tree (due to the MySQL
|
directly into your published HTTP directory tree (due to the MySQL
|
||||||
passwords in viewvc.conf).
|
passwords in viewvc.conf).
|
||||||
|
|
||||||
5) That's it for repository browsing. Instructions for getting the
|
That's it for repository browsing. Instructions for getting the SQL
|
||||||
SQL checkin database working are below.
|
checkin database working are below.
|
||||||
|
|
||||||
|
|
||||||
APACHE CONFIGURATION
|
APACHE CONFIGURATION
|
||||||
@@ -149,26 +187,26 @@ Either METHOD A:
|
|||||||
2) The ScriptAlias directive is very useful for pointing
|
2) The ScriptAlias directive is very useful for pointing
|
||||||
directly to the viewvc.cgi script. Simply insert a line containing
|
directly to the viewvc.cgi script. Simply insert a line containing
|
||||||
|
|
||||||
ScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/viewvc.cgi
|
ScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi
|
||||||
|
|
||||||
into your httpd.conf file. Choose the location in httpd.conf where
|
into your httpd.conf file. Choose the location in httpd.conf where
|
||||||
also the other ScriptAlias lines reside. Some examples:
|
also the other ScriptAlias lines reside. Some examples:
|
||||||
|
|
||||||
ScriptAlias /viewvc /usr/local/viewvc-1.0/www/cgi/viewvc.cgi
|
ScriptAlias /viewvc /usr/local/viewvc-1.0/bin/cgi/viewvc.cgi
|
||||||
ScriptAlias /query /usr/local/viewvc-1.0/www/cgi/query.cgi
|
ScriptAlias /query /usr/local/viewvc-1.0/bin/cgi/query.cgi
|
||||||
|
|
||||||
continue with step 3).
|
continue with step 3).
|
||||||
|
|
||||||
or alternatively METHOD B:
|
or alternatively METHOD B:
|
||||||
2) Copy the CGI scripts from
|
2) Copy the CGI scripts from
|
||||||
<VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/*.cgi
|
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
|
||||||
to the /cgi-bin/ directory configured in your httpd.conf file.
|
to the /cgi-bin/ directory configured in your httpd.conf file.
|
||||||
|
|
||||||
continue with step 3).
|
continue with step 3).
|
||||||
|
|
||||||
and then there's METHOD C:
|
and then there's METHOD C:
|
||||||
2) Copy the CGI scripts from
|
2) Copy the CGI scripts from
|
||||||
<VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/*.cgi
|
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
|
||||||
to the directory of your choosing in the Document Root adding the following
|
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:
|
apache directives for the directory in httpd.conf or an .htaccess file:
|
||||||
|
|
||||||
@@ -183,7 +221,7 @@ and then there's METHOD C:
|
|||||||
|
|
||||||
or if you've got Mod_Python installed you can use METHOD D:
|
or if you've got Mod_Python installed you can use METHOD D:
|
||||||
2) Copy the Python scripts and .htaccess file from
|
2) Copy the Python scripts and .htaccess file from
|
||||||
<VIEWVC_INSTALLATION_DIRECTORY>/www/mod_python/
|
<VIEWVC_INSTALLATION_DIRECTORY>/bin/mod_python/
|
||||||
to a directory being served by apache.
|
to a directory being served by apache.
|
||||||
|
|
||||||
In httpd.conf, make sure that "AllowOverride All" or at least
|
In httpd.conf, make sure that "AllowOverride All" or at least
|
||||||
@@ -206,28 +244,27 @@ or if you've got Mod_Python installed you can use METHOD D:
|
|||||||
In your httpd.conf you can control access to certain modules by adding
|
In your httpd.conf you can control access to certain modules by adding
|
||||||
directives like this:
|
directives like this:
|
||||||
|
|
||||||
<Location "<url to viewvc.cgi>/<modname_you_wish_to_access_ctl>">
|
<Location "<url to viewvc.cgi>/<modname_you_wish_to_access_ctl>">
|
||||||
AllowOverride None
|
AllowOverride None
|
||||||
AuthUserFile /path/to/passwd/file
|
AuthUserFile /path/to/passwd/file
|
||||||
AuthName "Client Access"
|
AuthName "Client Access"
|
||||||
AuthType Basic
|
AuthType Basic
|
||||||
require valid-user
|
require valid-user
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
WARNING: If you enable the "checkout_magic" or "allow_tar" options, you
|
WARNING: If you enable the "checkout_magic" or "allow_tar" options, you
|
||||||
will need to add additional location directives to prevent people
|
will need to add additional location directives to prevent people
|
||||||
from sneaking in with URLs like:
|
from sneaking in with URLs like:
|
||||||
|
|
||||||
http://<server_name>/viewvc/*checkout*/<module_name>
|
http://<server_name>/viewvc/*checkout*/<module_name>
|
||||||
http://<server_name>/viewvc/~checkout~/<module_name>
|
http://<server_name>/viewvc/~checkout~/<module_name>
|
||||||
http://<server_name>/viewvc/<module_name>.tar.gz?view=tar
|
http://<server_name>/viewvc/<module_name>.tar.gz?view=tar
|
||||||
|
|
||||||
|
|
||||||
UPGRADING VIEWVC
|
UPGRADING VIEWVC
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Please read the file upgrading.html in the viewvc.org/ subdirectory or
|
Please read the file upgrading-howto.html in the docs/ subdirectory.
|
||||||
at <http://viewvc.org/upgrading.html>.
|
|
||||||
|
|
||||||
|
|
||||||
SQL CHECKIN DATABASE
|
SQL CHECKIN DATABASE
|
||||||
@@ -246,7 +283,7 @@ there are some additional steps required to get the database working.
|
|||||||
Optionally, you can create a second user with read-only access to the
|
Optionally, you can create a second user with read-only access to the
|
||||||
database.
|
database.
|
||||||
|
|
||||||
3) Run the <VIEWVC_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
|
prompt you for your MySQL user, password, and the name of database you
|
||||||
want to create. The database name defaults to "ViewVC". 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
|
creates the database and sets up the empty tables. If you run this on a
|
||||||
@@ -258,91 +295,105 @@ there are some additional steps required to get the database working.
|
|||||||
enabled = 1 # Whether to enable query support in viewvc.cgi
|
enabled = 1 # Whether to enable query support in viewvc.cgi
|
||||||
host = # MySQL database server host
|
host = # MySQL database server host
|
||||||
port = # MySQL database server port (default is 3306)
|
port = # MySQL database server port (default is 3306)
|
||||||
database_name = # the name of the database you created with
|
database_name = # name of database you created with make-database
|
||||||
# make-database
|
user = # read/write database user
|
||||||
user = # the read/write database user
|
|
||||||
passwd = # password for read/write database user
|
passwd = # password for read/write database user
|
||||||
readonly_user = # the readonly database user -- it's pretty
|
readonly_user = # read-only database user
|
||||||
# safe to use the read/write user here
|
readonly_passwd = # password for the read-only user
|
||||||
readonly_passwd = # password for the readonly user
|
|
||||||
|
|
||||||
5) Two programs are provided for updating the checkin database from a
|
Note that it's pretty safe in this instance for your read-only user
|
||||||
CVS repository, cvsdbadmin and loginfo-handler. They serve two
|
and your read-write user to be the same.
|
||||||
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.
|
|
||||||
|
|
||||||
To build a database of all the commits in the CVS repository /home/cvs,
|
5) At this point, you need to tell your version control system(s) to
|
||||||
invoke: "./cvsdbadmin rebuild /home/cvs". If you want to update
|
publish their commit information to the database. This is done
|
||||||
the checkin database, invoke: "./cvsdbadmin update /home/cvs". The
|
using utilities that ViewVC provides.
|
||||||
update mode checks to see if a commit is already in the database,
|
|
||||||
and only adds it if it is absent.
|
|
||||||
|
|
||||||
To get real-time updates, you'll want to checkout the CVSROOT module
|
To publish CVS commits into the database:
|
||||||
from your CVS repository and edit CVSROOT/loginfo. Add the line:
|
|
||||||
|
|
||||||
ALL <VIEWVC_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv}
|
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 build a database of all the commits in the CVS repository
|
||||||
to make sure to change any running under the "DEFAULT" keyword to
|
/home/cvs, invoke: "./cvsdbadmin rebuild /home/cvs". If you
|
||||||
"ALL" like the loginfo handler, and probably carefully read the
|
want to update the checkin database, invoke: "./cvsdbadmin
|
||||||
execution rules for CVSROOT/loginfo from the CVS manual.
|
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.
|
||||||
|
|
||||||
If you are running the Unix port of CVS-NT, you'll need to use a
|
To get real-time updates, you'll want to checkout the CVSROOT
|
||||||
slightly different command line:
|
module from your CVS repository and edit CVSROOT/loginfo. For
|
||||||
|
folks running CVS 1.12 or better, add this line:
|
||||||
|
|
||||||
|
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %p %{sVv}
|
||||||
|
|
||||||
|
If you are running CVS 1.11 or earlier, you'll want a slightly
|
||||||
|
different command line in CVSROOT/loginfo:
|
||||||
|
|
||||||
|
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv}
|
||||||
|
|
||||||
ALL <VIEWVC_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv} cvsnt
|
If you have other scripts invoked by CVSROOT/loginfo, you will
|
||||||
|
want to make sure to change any running under the "DEFAULT"
|
||||||
The extra 'cvsnt' parameter tells the handler script to parse the
|
keyword to "ALL" like the loginfo handler, and probably
|
||||||
commit information in a different way.
|
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
|
||||||
|
|
||||||
For Subversion repositories, there is a single script called
|
To publish Subversion commits into the database:
|
||||||
svndbadmin that performs both of the above tasks.
|
|
||||||
|
|
||||||
To build a database of all the commits in the Subversion repository
|
To build a database of all the commits in the Subversion
|
||||||
/home/svn, invoke: "./svndbadmin rebuild /home/svn". If you want
|
repository /home/svn, invoke: "./svndbadmin rebuild /home/svn".
|
||||||
to update the checkin database, invoke: "./svndbadmin update
|
If you want to update the checkin database, invoke:
|
||||||
/home/svn".
|
"./svndbadmin update /home/svn".
|
||||||
|
|
||||||
To get real time updates, you will need to add a post-commit hook
|
To get real time updates, you will need to add a post-commit
|
||||||
(for the repository example above, the script should go in
|
hook (for the repository example above, the script should go in
|
||||||
/home/svn/hooks/post-commit). The script should look something
|
/home/svn/hooks/post-commit). The script should look something
|
||||||
like this:
|
like this:
|
||||||
|
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
REPOS="$1"
|
REPOS="$1"
|
||||||
REV="$2"
|
REV="$2"
|
||||||
<VIEWVC_INSTALLATION_DIRECTORY>/svndbadmin rebuild "$REPOS" "$REV"
|
<VIEWVC_INSTALLATION_DIRECTORY>/bin/svndbadmin rebuild "$REPOS" "$REV"
|
||||||
|
|
||||||
If you allow revision property changes in your repository, create a
|
If you allow revision property changes in your repository,
|
||||||
post-revprop-change hook script containing the same commands as the
|
create a post-revprop-change hook script containing the same
|
||||||
post-commit one. This will make sure that the checkin database
|
commands as the post-commit one. This will make sure that the
|
||||||
stays consistent when you change the svn:log, svn:author or
|
checkin database stays consistent when you change the svn:log,
|
||||||
svn:date revision properties.
|
svn:author or svn:date revision properties.
|
||||||
|
|
||||||
6) You should be ready to go. Click one of the "Query revision history"
|
You should be ready to go. Click one of the "Query revision history"
|
||||||
links in ViewVC directory listings and give it a try.
|
links in ViewVC directory listings and give it a try.
|
||||||
|
|
||||||
|
|
||||||
ENSCRIPT AND HIGHLIGHT CONFIGURATION
|
ENABLING SYNTAX COLORATION
|
||||||
------------------------------------
|
--------------------------
|
||||||
|
|
||||||
Enscript and Highlight are programs that can colorize source code for
|
Enscript and Highlight are two programs that can colorize source code
|
||||||
a lot of languages. ViewVC can be configured to use either one.
|
for a lot of languages. ViewVC can be configured to use either one.
|
||||||
|
|
||||||
1) Install Enscript or Highlight using your system's package manager
|
1) Install Enscript or Highlight using your system's package manager
|
||||||
or downloading from the project home pages.
|
or downloading from the project home pages.
|
||||||
|
|
||||||
2) Set the 'use_enscript' or 'use_highlight' options in viewvc.conf to 1.
|
2) Set either the 'use_enscript' or 'use_highlight' options in
|
||||||
|
viewvc.conf to 1.
|
||||||
|
|
||||||
3) You may also need to set 'enscript_path' and 'highlight_path' options
|
3) You may also need to set 'enscript_path' or 'highlight_path' option
|
||||||
if the executables are not located on the system PATH.
|
if the executables are not located on the system PATH.
|
||||||
|
|
||||||
4) That's it!
|
That's it! Now when you view the contents of recognized filetypes in
|
||||||
|
ViewVC, you should see colorized syntax.
|
||||||
|
|
||||||
|
|
||||||
CVSGRAPH CONFIGURATION
|
CVSGRAPH CONFIGURATION
|
||||||
@@ -371,36 +422,50 @@ a reasonable number of revisions and branches.
|
|||||||
4) There is a file <VIEWVC_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.
|
you may want to edit if desired to set color and font characteristics.
|
||||||
See the cvsgraph.conf documentation. No edits are required in
|
See the cvsgraph.conf documentation. No edits are required in
|
||||||
cvsgraph.conf for operation with viewvc.
|
cvsgraph.conf for operation with ViewVC.
|
||||||
|
|
||||||
|
|
||||||
SUBVERSION INTEGRATION
|
SUBVERSION INTEGRATION
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
ViewVC supports browsing of Subversion repositories. To use ViewVC
|
Unlike the CVS integration, which simply wraps the RCS and CVS utility
|
||||||
with Subversion, make sure you have both Subversion itself and
|
programs, the Subversion integration requires additional Python
|
||||||
the Subversion Python bindings installed. See Subversion's
|
libraries. To use ViewVC with Subversion, make sure you have both
|
||||||
installation notes for more details on how to build and install these
|
Subversion itself and the Subversion Python bindings installed. See
|
||||||
items.
|
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
|
Generally speaking, you'll know when your installation of Subversion's
|
||||||
bindings has been successful if you can import the 'svn.repos' module
|
bindings has been successful if you can import the 'svn.core' module
|
||||||
from within your Python interpreter:
|
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
|
||||||
Python 2.2.2 (#1, Oct 29 2002, 02:47:30)
|
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
|
[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.
|
Type "help", "copyright", "credits" or "license" for more information.
|
||||||
>>> import svn.repos
|
>>> 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
|
Note that by default, Subversion installs its bindings in a location
|
||||||
that is not in Python's default module search path (for example, on
|
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
|
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
|
need to remedy this, either by adding this path to Python's module
|
||||||
search path, or by relocation the bindings to some place in that
|
search path, or by relocating the bindings to some place in that
|
||||||
search path.
|
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
|
Configuration of the Subversion repositories happens in much the same
|
||||||
way as with CVS repositories, only with the 'svn_roots' configuration
|
way as with CVS repositories, only with the 'svn_roots' configuration
|
||||||
variable instead of the 'cvs_roots' one.
|
variable instead of the 'cvs_roots' one.
|
||||||
@@ -409,39 +474,42 @@ variable instead of the 'cvs_roots' one.
|
|||||||
IF YOU HAVE PROBLEMS ...
|
IF YOU HAVE PROBLEMS ...
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
If you've trouble to make viewvc.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
|
* View the entries in the webserver's error.log
|
||||||
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
|
|
||||||
|
|
||||||
=== If viewvc seems to work but doesn't show the expected result
|
If ViewVC seems to work but doesn't show the expected result (Typical
|
||||||
(Typical error: you can't see any files)
|
error: you can't see any files)
|
||||||
|
|
||||||
o check whether the CGI-script has read-permissions to your
|
* Check whether the CGI-script has read-permissions to your
|
||||||
CVS-Repository. The CGI-script often runs as the user 'nobody'
|
CVS-Repository. The CGI-script generally runs as the same user
|
||||||
or 'httpd' ..
|
that the web server does, often user 'nobody' or 'httpd'.
|
||||||
|
|
||||||
o does viewvc find your RCS utilities? (edit rcs_path)
|
* Does ViewVC find your RCS utilities? (edit rcs_path)
|
||||||
|
|
||||||
=== If something else happens or you can't get it to work:
|
If something else happens or you can't get it to work:
|
||||||
|
|
||||||
o check the ViewVC home page:
|
* Check the ViewVC home page:
|
||||||
|
|
||||||
http://viewvc.org/
|
http://viewvc.org/
|
||||||
|
|
||||||
o review the ViewVC mailing list archive to see if somebody else had
|
* Review the ViewVC mailing list archive to see if somebody else had
|
||||||
the same problem, and it was solved:
|
the same problem, and it was solved:
|
||||||
|
|
||||||
http://viewvc.tigris.org/servlets/SummarizeList?listName=users
|
http://viewvc.tigris.org/servlets/SummarizeList?listName=users
|
||||||
|
|
||||||
o send mail to the ViewVC mailing list: users@viewvc.tigris.org
|
* Check the ViewVC issue database to see if the problem you are
|
||||||
|
seeing is the result of a known bug:
|
||||||
|
|
||||||
NOTE: make sure you provide an accurate description of the problem
|
http://viewvc.tigris.org/issues/query.cgi
|
||||||
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.
|
||||||
|
@@ -32,9 +32,9 @@ import sys
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
if LIBRARY_DIR:
|
if LIBRARY_DIR:
|
||||||
sys.path.insert(0, LIBRARY_DIR)
|
sys.path.insert(0, LIBRARY_DIR)
|
||||||
else:
|
else:
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
|
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
@@ -49,9 +49,13 @@ import vclib.bincvs
|
|||||||
DEBUG_FLAG = 0
|
DEBUG_FLAG = 0
|
||||||
|
|
||||||
## output functions
|
## output functions
|
||||||
def debug(text):
|
def debug(text):
|
||||||
if DEBUG_FLAG:
|
if DEBUG_FLAG:
|
||||||
print 'DEBUG(viewvc-loginfo):', text
|
if type(text) != (type([])):
|
||||||
|
text = [text]
|
||||||
|
for line in text:
|
||||||
|
line = line.rstrip('\n\r')
|
||||||
|
print 'DEBUG(viewvc-loginfo):', line
|
||||||
|
|
||||||
def warning(text):
|
def warning(text):
|
||||||
print 'WARNING(viewvc-loginfo):', text
|
print 'WARNING(viewvc-loginfo):', text
|
||||||
@@ -61,139 +65,158 @@ def error(text):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
_re_revisions = re.compile(
|
_re_revisions = re.compile(
|
||||||
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision number
|
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision
|
||||||
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision number
|
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision
|
||||||
r"(?:$| )" # space or end of string
|
r"(?:$| )" # space or end of string
|
||||||
)
|
)
|
||||||
|
|
||||||
def HeuristicArgParse(s, repository):
|
def Cvs1Dot12ArgParse(args):
|
||||||
"""Current versions of CVS (except for CVSNT) do not escape spaces in file
|
"""CVS 1.12 introduced a new loginfo format while provides the various
|
||||||
and directory names that are passed to the loginfo handler. Since the input
|
pieces of interesting version information to the handler script as
|
||||||
to loginfo is a space separated string, this can lead to ambiguities. This
|
individual arguments instead of as a single string."""
|
||||||
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':
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
if s[-19:] == r' - Imported sources':
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
if args[1] == '- New directory':
|
||||||
|
return None, None
|
||||||
else:
|
else:
|
||||||
if m is None:
|
directory = args.pop(0)
|
||||||
warning('Failed to interpret past position %i in the loginfo argument, '
|
files = []
|
||||||
'leftover string is "%s"' % start, pos[start:])
|
while len(args) >= 3:
|
||||||
|
files.append(args[0:3])
|
||||||
filename = s[start:m.start()]
|
args = args[3:]
|
||||||
|
return directory, files
|
||||||
old_version, new_version = m.group('old', 'new')
|
|
||||||
|
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"""
|
||||||
|
|
||||||
file_data_list.append((filename, old_version, new_version))
|
if (s[-16:] == ' - New directory'
|
||||||
|
or s[:26] == ' - New directory,NONE,NONE'):
|
||||||
|
return None, None
|
||||||
|
|
||||||
debug('File "%s", old revision %s, new revision %s'
|
if (s[-19:] == ' - Imported sources'
|
||||||
% (filename, old_version, new_version))
|
or s[-29:] == ' - Imported sources,NONE,NONE'):
|
||||||
|
return None, None
|
||||||
|
|
||||||
start = m.end()
|
file_data_list = []
|
||||||
|
start = 0
|
||||||
if start == len(s): break
|
|
||||||
|
|
||||||
return directory, file_data_list
|
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):
|
def FindLongestDirectory(s, repository):
|
||||||
"""Splits the first part of the argument string into a directory name
|
"""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
|
and a file name, either of which may contain spaces. Returns the longest
|
||||||
possible directory name that actually exists"""
|
possible directory name that actually exists"""
|
||||||
|
|
||||||
parts = string.split(s, " ")
|
parts = string.split(s, " ")
|
||||||
|
|
||||||
for i in range(len(parts)-1, 0, -1):
|
for i in range(len(parts)-1, 0, -1):
|
||||||
directory = string.join(parts[:i])
|
directory = string.join(parts[:i])
|
||||||
filename = string.join(parts[i:])
|
filename = string.join(parts[i:])
|
||||||
if os.path.isdir(os.path.join(repository, directory)):
|
if os.path.isdir(os.path.join(repository, directory)):
|
||||||
return directory, filename
|
return directory, filename
|
||||||
|
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
_re_cvsnt_revisions = re.compile(
|
_re_cvsnt_revisions = re.compile(
|
||||||
r"(?P<filename>.*)" # comma and first revision number
|
r"(?P<filename>.*)" # comma and first revision
|
||||||
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision number
|
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision
|
||||||
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision number
|
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision
|
||||||
r"$" # end of string
|
r"$" # end of string
|
||||||
)
|
)
|
||||||
|
|
||||||
def CvsNtArgParse(s, repository):
|
def CvsNtArgParse(s, repository):
|
||||||
"""CVSNT escapes all spaces in filenames and directory names with
|
"""CVSNT escapes all spaces in filenames and directory names with
|
||||||
backslashes"""
|
backslashes"""
|
||||||
|
|
||||||
if s[-18:] == r' -\ New\ directory':
|
if s[-18:] == r' -\ New\ directory':
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
if s[-21:] == r' -\ Imported\ sources':
|
if s[-21:] == r' -\ Imported\ sources':
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
file_data_list = []
|
file_data_list = []
|
||||||
|
directory, pos = NextFile(s)
|
||||||
|
|
||||||
|
debug('Directory name is "%s"' % directory)
|
||||||
|
|
||||||
directory, pos = NextFile(s)
|
while 1:
|
||||||
|
fileinfo, pos = NextFile(s, pos)
|
||||||
debug('Directory name is "%s"' % directory)
|
if fileinfo is None:
|
||||||
|
break
|
||||||
|
|
||||||
while 1:
|
m = _re_cvsnt_revisions.match(fileinfo)
|
||||||
fileinfo, pos = NextFile(s, pos)
|
if m is None:
|
||||||
if fileinfo is None:
|
warning('Can\'t parse file information in "%s"' % fileinfo)
|
||||||
break
|
continue
|
||||||
|
|
||||||
m = _re_cvsnt_revisions.match(fileinfo)
|
file_data = m.group('filename', 'old', 'new')
|
||||||
if m is None:
|
file_data_list.append(file_data)
|
||||||
warning('Can\'t parse file information in "%s"' % fileinfo)
|
|
||||||
continue
|
|
||||||
|
|
||||||
file_data = m.group('filename', 'old', 'new')
|
debug('File "%s", old revision %s, new revision %s' % file_data)
|
||||||
|
|
||||||
debug('File "%s", old revision %s, new revision %s' % file_data)
|
return directory, file_data_list
|
||||||
|
|
||||||
file_data_list.append(file_data)
|
|
||||||
|
|
||||||
return directory, file_data_list
|
|
||||||
|
|
||||||
def NextFile(s, pos = 0):
|
def NextFile(s, pos = 0):
|
||||||
escaped = 0
|
escaped = 0
|
||||||
ret = ''
|
ret = ''
|
||||||
i = pos
|
i = pos
|
||||||
while i < len(s):
|
while i < len(s):
|
||||||
c = s[i]
|
c = s[i]
|
||||||
if escaped:
|
if escaped:
|
||||||
ret += c
|
ret += c
|
||||||
escaped = 0
|
escaped = 0
|
||||||
elif c == '\\':
|
elif c == '\\':
|
||||||
escaped = 1
|
escaped = 1
|
||||||
elif c == ' ':
|
elif c == ' ':
|
||||||
return ret, i + 1
|
return ret, i + 1
|
||||||
else:
|
else:
|
||||||
ret += c
|
ret += c
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
return ret or None, i
|
return ret or None, i
|
||||||
|
|
||||||
def ProcessLoginfo(rootpath, directory, files):
|
def ProcessLoginfo(rootpath, directory, files):
|
||||||
cfg = viewvc.load_config(CONF_PATHNAME)
|
cfg = viewvc.load_config(CONF_PATHNAME)
|
||||||
@@ -235,41 +258,58 @@ if __name__ == '__main__':
|
|||||||
debug('Repository name is "%s"' % repository)
|
debug('Repository name is "%s"' % repository)
|
||||||
|
|
||||||
## parse arguments
|
## parse arguments
|
||||||
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
|
|
||||||
arg = string.rstrip(sys.stdin.readline())
|
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
argc = len(sys.argv)
|
||||||
# if there is a second argument it indicates which parser should be
|
debug('Got %d arguments:' % (argc))
|
||||||
# used to interpret the version information
|
debug(map(lambda x: ' ' + x, sys.argv))
|
||||||
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 neccessarily correct
|
|
||||||
if sys.platform == "win32":
|
|
||||||
fun = CvsNtArgParse
|
|
||||||
else:
|
|
||||||
fun = HeuristicArgParse
|
|
||||||
|
|
||||||
if len(sys.argv) > 3:
|
# if we have more than 3 arguments, we are likely using the
|
||||||
error('Bad arguments')
|
# 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)
|
repository = cvsdb.CleanRepository(repository)
|
||||||
directory, files = fun(arg, repository)
|
|
||||||
|
debug('Repository: %s' % (repository))
|
||||||
|
debug('Directory: %s' % (directory))
|
||||||
|
debug('Files: %s' % (str(files)))
|
||||||
|
|
||||||
if files is None:
|
if files is None:
|
||||||
debug('Not a checkin, nothing to do')
|
debug('Not a checkin, nothing to do')
|
||||||
else:
|
else:
|
||||||
ProcessLoginfo(repository, directory, files)
|
ProcessLoginfo(repository, directory, files)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@@ -39,7 +39,7 @@ CREATE TABLE branches (
|
|||||||
branch varchar(64) binary DEFAULT '' NOT NULL,
|
branch varchar(64) binary DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE branch (branch)
|
UNIQUE branch (branch)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS checkins;
|
DROP TABLE IF EXISTS checkins;
|
||||||
CREATE TABLE checkins (
|
CREATE TABLE checkins (
|
||||||
@@ -62,7 +62,7 @@ CREATE TABLE checkins (
|
|||||||
KEY dirid (dirid),
|
KEY dirid (dirid),
|
||||||
KEY fileid (fileid),
|
KEY fileid (fileid),
|
||||||
KEY branchid (branchid)
|
KEY branchid (branchid)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS descs;
|
DROP TABLE IF EXISTS descs;
|
||||||
CREATE TABLE descs (
|
CREATE TABLE descs (
|
||||||
@@ -71,7 +71,7 @@ CREATE TABLE descs (
|
|||||||
hash bigint(20) DEFAULT '0' NOT NULL,
|
hash bigint(20) DEFAULT '0' NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
KEY hash (hash)
|
KEY hash (hash)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS dirs;
|
DROP TABLE IF EXISTS dirs;
|
||||||
CREATE TABLE dirs (
|
CREATE TABLE dirs (
|
||||||
@@ -79,7 +79,7 @@ CREATE TABLE dirs (
|
|||||||
dir varchar(255) binary DEFAULT '' NOT NULL,
|
dir varchar(255) binary DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE dir (dir)
|
UNIQUE dir (dir)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS files;
|
DROP TABLE IF EXISTS files;
|
||||||
CREATE TABLE files (
|
CREATE TABLE files (
|
||||||
@@ -87,7 +87,7 @@ CREATE TABLE files (
|
|||||||
file varchar(255) binary DEFAULT '' NOT NULL,
|
file varchar(255) binary DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE file (file)
|
UNIQUE file (file)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS people;
|
DROP TABLE IF EXISTS people;
|
||||||
CREATE TABLE people (
|
CREATE TABLE people (
|
||||||
@@ -95,7 +95,7 @@ CREATE TABLE people (
|
|||||||
who varchar(32) binary DEFAULT '' NOT NULL,
|
who varchar(32) binary DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE who (who)
|
UNIQUE who (who)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS repositories;
|
DROP TABLE IF EXISTS repositories;
|
||||||
CREATE TABLE repositories (
|
CREATE TABLE repositories (
|
||||||
@@ -103,7 +103,7 @@ CREATE TABLE repositories (
|
|||||||
repository varchar(64) binary DEFAULT '' NOT NULL,
|
repository varchar(64) binary DEFAULT '' NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE repository (repository)
|
UNIQUE repository (repository)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS tags;
|
DROP TABLE IF EXISTS tags;
|
||||||
CREATE TABLE tags (
|
CREATE TABLE tags (
|
||||||
@@ -117,7 +117,7 @@ CREATE TABLE tags (
|
|||||||
KEY dirid (dirid),
|
KEY dirid (dirid),
|
||||||
KEY fileid (fileid),
|
KEY fileid (fileid),
|
||||||
KEY branchid (branchid)
|
KEY branchid (branchid)
|
||||||
);
|
) TYPE=MyISAM;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@@ -51,16 +51,12 @@ keywordsList = ["and", "assert", "break", "class", "continue", "def",
|
|||||||
"return", "try", "while",
|
"return", "try", "while",
|
||||||
]
|
]
|
||||||
|
|
||||||
# First a little helper, since I don't like to repeat things. (Tismer speaking)
|
|
||||||
def replace(where, what, with):
|
|
||||||
return string.join(string.split(where, what), with)
|
|
||||||
|
|
||||||
# A regexp for matching Python comments.
|
# A regexp for matching Python comments.
|
||||||
commentPat = "#.*"
|
commentPat = "#.*"
|
||||||
|
|
||||||
# A regexp for matching simple quoted strings.
|
# A regexp for matching simple quoted strings.
|
||||||
pat = "q[^q\\n]*(\\[\000-\377][^q\\n]*)*q"
|
pat = "q[^q\\n]*(\\[\000-\377][^q\\n]*)*q"
|
||||||
quotePat = replace(pat, "q", "'") + "|" + replace(pat, 'q', '"')
|
quotePat = string.replace(pat, "q", "'") + "|" + string.replace(pat, 'q', '"')
|
||||||
|
|
||||||
# A regexp for matching multi-line tripled-quoted strings. (Way to go, Tim!)
|
# A regexp for matching multi-line tripled-quoted strings. (Way to go, Tim!)
|
||||||
pat = """
|
pat = """
|
||||||
@@ -82,7 +78,8 @@ pat = """
|
|||||||
qqq
|
qqq
|
||||||
"""
|
"""
|
||||||
pat = string.join(string.split(pat), '') # get rid of whitespace
|
pat = string.join(string.split(pat), '') # get rid of whitespace
|
||||||
tripleQuotePat = replace(pat, "q", "'") + "|" + replace(pat, 'q', '"')
|
tripleQuotePat = string.replace(pat, "q", "'") + "|" \
|
||||||
|
+ string.replace(pat, 'q', '"')
|
||||||
|
|
||||||
# A regexp which matches all and only Python keywords. This will let
|
# A regexp which matches all and only Python keywords. This will let
|
||||||
# us skip the uninteresting identifier references.
|
# us skip the uninteresting identifier references.
|
||||||
|
35
lib/blame.py
35
lib/blame.py
@@ -42,25 +42,28 @@ def link_includes(text, repos, path_parts, include_url):
|
|||||||
match = re_includes.match(text)
|
match = re_includes.match(text)
|
||||||
if match:
|
if match:
|
||||||
incfile = match.group(3)
|
incfile = match.group(3)
|
||||||
|
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)
|
||||||
|
|
||||||
# check current directory and parent directory for file
|
include_path = None
|
||||||
for depth in (-1, -2):
|
try:
|
||||||
include_path = path_parts[:depth] + [incfile]
|
if repos.itemtype(include_path_parts, None) == vclib.FILE:
|
||||||
try:
|
include_path = string.join(include_path_parts, '/')
|
||||||
# will throw if path doesn't exist
|
except vclib.ItemNotFound:
|
||||||
if repos.itemtype(include_path, None) == vclib.FILE:
|
pass
|
||||||
break
|
|
||||||
except vclib.ItemNotFound:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
include_path = None
|
|
||||||
|
|
||||||
if include_path:
|
if include_path:
|
||||||
url = string.replace(include_url, '/WHERE/',
|
return '#%sinclude%s<a href="%s">"%s"</a>' % \
|
||||||
string.join(include_path, '/'))
|
(match.group(1), match.group(2),
|
||||||
return '#%sinclude%s<a href="%s">"%s"</a>' % \
|
string.replace(include_url, '/WHERE/', include_path), incfile)
|
||||||
(match.group(1), match.group(2), url, incfile)
|
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
56
lib/cvsdb.py
56
lib/cvsdb.py
@@ -23,11 +23,6 @@ import dbi
|
|||||||
## error
|
## error
|
||||||
error = "cvsdb error"
|
error = "cvsdb error"
|
||||||
|
|
||||||
## cached (active) database connections
|
|
||||||
gCheckinDatabase = None
|
|
||||||
gCheckinDatabaseReadOnly = None
|
|
||||||
|
|
||||||
|
|
||||||
## CheckinDatabase provides all interfaces needed to the SQL database
|
## CheckinDatabase provides all interfaces needed to the SQL database
|
||||||
## back-end; it needs to be subclassed, and have its "Connect" method
|
## 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
|
## defined to actually be complete; it should run well off of any DBI 2.0
|
||||||
@@ -50,6 +45,8 @@ class CheckinDatabase:
|
|||||||
def Connect(self):
|
def Connect(self):
|
||||||
self.db = dbi.connect(
|
self.db = dbi.connect(
|
||||||
self._host, self._port, 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):
|
def sql_get_id(self, table, column, value, auto_set):
|
||||||
sql = "SELECT id FROM %s WHERE %s=%%s" % (table, column)
|
sql = "SELECT id FROM %s WHERE %s=%%s" % (table, column)
|
||||||
@@ -249,8 +246,8 @@ class CheckinDatabase:
|
|||||||
revision = commit.GetRevision()
|
revision = commit.GetRevision()
|
||||||
sticky_tag = "NULL"
|
sticky_tag = "NULL"
|
||||||
branch_id = self.GetBranchID(commit.GetBranch())
|
branch_id = self.GetBranchID(commit.GetBranch())
|
||||||
plus_count = commit.GetPlusCount()
|
plus_count = commit.GetPlusCount() or '0'
|
||||||
minus_count = commit.GetMinusCount()
|
minus_count = commit.GetMinusCount() or '0'
|
||||||
description_id = self.GetDescriptionID(commit.GetDescription())
|
description_id = self.GetDescriptionID(commit.GetDescription())
|
||||||
|
|
||||||
sql = "REPLACE INTO checkins"\
|
sql = "REPLACE INTO checkins"\
|
||||||
@@ -677,39 +674,20 @@ def CreateCommit():
|
|||||||
def CreateCheckinQuery():
|
def CreateCheckinQuery():
|
||||||
return CheckinDatabaseQuery()
|
return CheckinDatabaseQuery()
|
||||||
|
|
||||||
|
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 ConnectDatabaseReadOnly(cfg):
|
def ConnectDatabaseReadOnly(cfg):
|
||||||
global gCheckinDatabaseReadOnly
|
return ConnectDatabase(cfg, 1)
|
||||||
|
|
||||||
if gCheckinDatabaseReadOnly:
|
|
||||||
return gCheckinDatabaseReadOnly
|
|
||||||
|
|
||||||
gCheckinDatabaseReadOnly = CheckinDatabase(
|
|
||||||
cfg.cvsdb.host,
|
|
||||||
cfg.cvsdb.port,
|
|
||||||
cfg.cvsdb.readonly_user,
|
|
||||||
cfg.cvsdb.readonly_passwd,
|
|
||||||
cfg.cvsdb.database_name,
|
|
||||||
cfg.cvsdb.row_limit)
|
|
||||||
|
|
||||||
gCheckinDatabaseReadOnly.Connect()
|
|
||||||
return gCheckinDatabaseReadOnly
|
|
||||||
|
|
||||||
def ConnectDatabase(cfg):
|
|
||||||
global gCheckinDatabase
|
|
||||||
|
|
||||||
if gCheckinDatabase:
|
|
||||||
return gCheckinDatabase
|
|
||||||
|
|
||||||
gCheckinDatabase = CheckinDatabase(
|
|
||||||
cfg.cvsdb.host,
|
|
||||||
cfg.cvsdb.port,
|
|
||||||
cfg.cvsdb.user,
|
|
||||||
cfg.cvsdb.passwd,
|
|
||||||
cfg.cvsdb.database_name,
|
|
||||||
cfg.cvsdb.row_limit)
|
|
||||||
|
|
||||||
gCheckinDatabase.Connect()
|
|
||||||
return gCheckinDatabase
|
|
||||||
|
|
||||||
def GetCommitListFromRCSFile(repository, path_parts, revision=None):
|
def GetCommitListFromRCSFile(repository, path_parts, revision=None):
|
||||||
commit_list = []
|
commit_list = []
|
||||||
|
@@ -659,7 +659,7 @@ def _write_value(value, args, ctx):
|
|||||||
piece = args[idx]
|
piece = args[idx]
|
||||||
else:
|
else:
|
||||||
piece = '<undef>'
|
piece = '<undef>'
|
||||||
printer(ctx, piece)
|
printer(ctx, piece)
|
||||||
|
|
||||||
# plain old value, write to output
|
# plain old value, write to output
|
||||||
else:
|
else:
|
||||||
|
@@ -135,7 +135,7 @@ class CgiServer(Server):
|
|||||||
def addheader(self, name, value):
|
def addheader(self, name, value):
|
||||||
self.headers.append((name, value))
|
self.headers.append((name, value))
|
||||||
|
|
||||||
def header(self, content_type='text/html', status=None):
|
def header(self, content_type='text/html; charset=UTF-8', status=None):
|
||||||
if not self.headerSent:
|
if not self.headerSent:
|
||||||
self.headerSent = 1
|
self.headerSent = 1
|
||||||
|
|
||||||
@@ -209,7 +209,10 @@ class AspServer(ThreadedServer):
|
|||||||
if not self.headerSent:
|
if not self.headerSent:
|
||||||
try:
|
try:
|
||||||
self.headerSent = 1
|
self.headerSent = 1
|
||||||
if content_type is not None: self.response.ContentType = content_type
|
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
|
if status is not None: self.response.Status = status
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
@@ -290,7 +293,7 @@ class ModPythonServer(ThreadedServer):
|
|||||||
|
|
||||||
def header(self, content_type=None, status=None):
|
def header(self, content_type=None, status=None):
|
||||||
if content_type is None:
|
if content_type is None:
|
||||||
self.request.content_type = 'text/html'
|
self.request.content_type = 'text/html; charset=UTF-8'
|
||||||
else:
|
else:
|
||||||
self.request.content_type = content_type
|
self.request.content_type = content_type
|
||||||
self.headerSent = 1
|
self.headerSent = 1
|
||||||
|
@@ -270,62 +270,70 @@ class ChangedPath:
|
|||||||
self.is_copy = is_copy
|
self.is_copy = is_copy
|
||||||
|
|
||||||
|
|
||||||
class ChangedPathSet:
|
def get_revision_info(svnrepos, rev):
|
||||||
def __init__(self):
|
fsroot = svnrepos._getroot(rev)
|
||||||
self.changes = { }
|
|
||||||
|
|
||||||
def add_change(self, change):
|
# 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:
|
if change.path:
|
||||||
change.path = _cleanup_path(change.path)
|
change.path = _cleanup_path(change.path)
|
||||||
if change.base_path:
|
if change.base_path:
|
||||||
change.base_path = _cleanup_path(change.base_path)
|
change.base_path = _cleanup_path(change.base_path)
|
||||||
path = change.path
|
|
||||||
action = 'modified'
|
|
||||||
is_copy = 0
|
is_copy = 0
|
||||||
if not change.path:
|
if not hasattr(change, 'action'): # new to subversion 1.4.0
|
||||||
action = 'deleted'
|
action = 'modified'
|
||||||
path = change.base_path
|
if not change.path:
|
||||||
elif change.added:
|
action = 'deleted'
|
||||||
action = 'added'
|
elif change.added:
|
||||||
replace_check_path = path
|
action = 'added'
|
||||||
if change.base_path and change.base_rev:
|
replace_check_path = path
|
||||||
is_copy = 1
|
if change.base_path and change.base_rev:
|
||||||
replace_check_path = change.base_path
|
replace_check_path = change.base_path
|
||||||
if self.changes.has_key(replace_check_path) \
|
if changedpaths.has_key(replace_check_path) \
|
||||||
and self.changes[replace_check_path].action == 'deleted':
|
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'
|
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:
|
if change.item_kind == core.svn_node_dir:
|
||||||
pathtype = vclib.DIR
|
pathtype = vclib.DIR
|
||||||
elif change.item_kind == core.svn_node_file:
|
elif change.item_kind == core.svn_node_file:
|
||||||
pathtype = vclib.FILE
|
pathtype = vclib.FILE
|
||||||
else:
|
else:
|
||||||
pathtype = None
|
pathtype = None
|
||||||
self.changes[path] = ChangedPath(path, pathtype, change.prop_changes,
|
changedpaths[path] = ChangedPath(path, pathtype, change.prop_changes,
|
||||||
change.text_changed, change.base_path,
|
change.text_changed, change.base_path,
|
||||||
change.base_rev, action, is_copy)
|
change.base_rev, action, is_copy)
|
||||||
|
|
||||||
def get_changes(self):
|
# Actually, what we want is a sorted list of ChangedPath objects.
|
||||||
changes = self.changes.values()
|
change_items = changedpaths.values()
|
||||||
changes.sort(lambda a, b: _compare_paths(a.filename, b.filename))
|
change_items.sort(lambda a, b: _compare_paths(a.filename, b.filename))
|
||||||
return changes
|
|
||||||
|
|
||||||
|
|
||||||
def get_revision_info(svnrepos, rev):
|
|
||||||
fsroot = svnrepos._getroot(rev)
|
|
||||||
|
|
||||||
# Get the changes for the revision
|
|
||||||
cps = ChangedPathSet()
|
|
||||||
editor = repos.ChangeCollector(svnrepos.fs_ptr, fsroot,
|
|
||||||
svnrepos.pool, cps.add_change)
|
|
||||||
e_ptr, e_baton = delta.make_editor(editor, svnrepos.pool)
|
|
||||||
repos.svn_repos_replay(fsroot, e_ptr, e_baton, svnrepos.pool)
|
|
||||||
|
|
||||||
# Now get the revision property info. Would use
|
# Now get the revision property info. Would use
|
||||||
# editor.get_root_props(), but something is broken there...
|
# editor.get_root_props(), but something is broken there...
|
||||||
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, svnrepos.pool)
|
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, svnrepos.pool)
|
||||||
date = _datestr_to_date(datestr, svnrepos.pool)
|
date = _datestr_to_date(datestr, svnrepos.pool)
|
||||||
|
|
||||||
return date, author, msg, cps.get_changes()
|
return date, author, msg, change_items
|
||||||
|
|
||||||
|
|
||||||
def _log_helper(svnrepos, rev, path, pool):
|
def _log_helper(svnrepos, rev, path, pool):
|
||||||
@@ -483,10 +491,18 @@ class BlameSource:
|
|||||||
self.last = None
|
self.last = None
|
||||||
self.first_rev = first_rev
|
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)
|
rootpath = os.path.abspath(rootpath)
|
||||||
|
if rootpath and rootpath[0] != '/':
|
||||||
|
rootpath = '/' + rootpath
|
||||||
|
if os.sep != '/':
|
||||||
|
rootpath = string.replace(rootpath, os.sep, '/')
|
||||||
|
|
||||||
url = 'file://' + string.join([rootpath, fs_path], "/")
|
url = 'file://' + string.join([rootpath, fs_path], "/")
|
||||||
fp = popen.popen(svn_client_path,
|
fp = popen.popen(svn_client_path,
|
||||||
('blame', "-r%d" % int(rev), "%s@%d" % (url, int(rev))),
|
('blame', "-r%d" % int(rev), "--non-interactive",
|
||||||
|
"%s@%d" % (url, int(rev))),
|
||||||
'rb', 1)
|
'rb', 1)
|
||||||
self.fp = fp
|
self.fp = fp
|
||||||
|
|
||||||
|
169
lib/viewvc.py
169
lib/viewvc.py
@@ -14,7 +14,7 @@
|
|||||||
#
|
#
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
|
||||||
__version__ = '1.0.1'
|
__version__ = '1.0.4'
|
||||||
|
|
||||||
# this comes from our library; measure the startup time
|
# this comes from our library; measure the startup time
|
||||||
import debug
|
import debug
|
||||||
@@ -748,8 +748,11 @@ def _orig_path(request, rev_param='revision', path_param=None):
|
|||||||
path = request.query_dict.get(path_param, request.where)
|
path = request.query_dict.get(path_param, request.where)
|
||||||
|
|
||||||
if rev is not None and hasattr(request.repos, '_getrev'):
|
if rev is not None and hasattr(request.repos, '_getrev'):
|
||||||
pathrev = request.repos._getrev(request.pathrev)
|
try:
|
||||||
rev = request.repos._getrev(rev)
|
pathrev = request.repos._getrev(request.pathrev)
|
||||||
|
rev = request.repos._getrev(rev)
|
||||||
|
except vclib.InvalidRevision:
|
||||||
|
raise debug.ViewVCException('Invalid revision', '404 Not Found')
|
||||||
return _path_parts(vclib.svn.get_location(request.repos, path,
|
return _path_parts(vclib.svn.get_location(request.repos, path,
|
||||||
pathrev, rev)), rev
|
pathrev, rev)), rev
|
||||||
return _path_parts(path), rev
|
return _path_parts(path), rev
|
||||||
@@ -1313,18 +1316,15 @@ def markup_stream_php(fp, cfg):
|
|||||||
if not cfg.options.use_php:
|
if not cfg.options.use_php:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
sys.stdout.flush()
|
# The following HACK may be be used to allow a PHP CGI executable to be
|
||||||
|
# invoked instead of a CLI executable, on systems that do not have PHP's
|
||||||
# clearing the following environment variables prevents a
|
# CLI (command line interface) installed. Just uncomment the following lines:
|
||||||
# "No input file specified" error from the php cgi executable
|
#os.unsetenv("SERVER_SOFTWARE")
|
||||||
# when ViewVC is running under a cgi environment. when the
|
#os.unsetenv("SERVER_NAME")
|
||||||
# php cli executable is used they can be left alone
|
#os.unsetenv("GATEWAY_INTERFACE")
|
||||||
#
|
#os.unsetenv("REQUEST_METHOD")
|
||||||
#os.putenv("GATEWAY_INTERFACE", "")
|
#os.unsetenv("SCRIPT_FILENAME")
|
||||||
#os.putenv("PATH_TRANSLATED", "")
|
#os.unsetenv("PATH_TRANSLATED")
|
||||||
#os.putenv("REQUEST_METHOD", "")
|
|
||||||
#os.putenv("SERVER_NAME", "")
|
|
||||||
#os.putenv("SERVER_SOFTWARE", "")
|
|
||||||
|
|
||||||
return MarkupPHP(cfg.options.php_exe_path, fp)
|
return MarkupPHP(cfg.options.php_exe_path, fp)
|
||||||
|
|
||||||
@@ -1359,6 +1359,10 @@ def make_rss_time_string(date, cfg):
|
|||||||
return time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(date)) + ' UTC'
|
return time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(date)) + ' UTC'
|
||||||
|
|
||||||
def view_markup(request):
|
def view_markup(request):
|
||||||
|
if not request.cfg.options.allow_markup:
|
||||||
|
raise debug.ViewVCException('Markup view is disabled',
|
||||||
|
'403 Forbidden')
|
||||||
|
|
||||||
cfg = request.cfg
|
cfg = request.cfg
|
||||||
path, rev = _orig_path(request)
|
path, rev = _orig_path(request)
|
||||||
fp, revision = request.repos.openfile(path, rev)
|
fp, revision = request.repos.openfile(path, rev)
|
||||||
@@ -1425,14 +1429,17 @@ def view_markup(request):
|
|||||||
streamer = markup_streamers.get(ext)
|
streamer = markup_streamers.get(ext)
|
||||||
if streamer:
|
if streamer:
|
||||||
markup_fp = streamer(fp, cfg)
|
markup_fp = streamer(fp, cfg)
|
||||||
elif cfg.options.use_enscript:
|
|
||||||
markup_fp = MarkupEnscript(cfg, fp, request.path_parts[-1])
|
|
||||||
elif cfg.options.use_highlight:
|
|
||||||
markup_fp = MarkupHighlight(cfg, fp, request.path_parts[-1])
|
|
||||||
|
|
||||||
# If no one has a suitable markup handler, we'll use the default.
|
# If there wasn't a custom streamer, or the streamer wasn't enabled, we'll
|
||||||
if not markup_fp:
|
# try to use one of the configured syntax highlighting programs.
|
||||||
markup_fp = MarkupPipeWrapper(fp)
|
if not markup_fp:
|
||||||
|
if cfg.options.use_enscript:
|
||||||
|
markup_fp = MarkupEnscript(cfg, fp, request.path_parts[-1])
|
||||||
|
elif cfg.options.use_highlight:
|
||||||
|
markup_fp = MarkupHighlight(cfg, fp, request.path_parts[-1])
|
||||||
|
else:
|
||||||
|
# If no one has a suitable markup handler, we'll use the default.
|
||||||
|
markup_fp = MarkupPipeWrapper(fp)
|
||||||
|
|
||||||
data['markup'] = markup_fp
|
data['markup'] = markup_fp
|
||||||
|
|
||||||
@@ -1514,7 +1521,10 @@ def view_directory(request):
|
|||||||
# the directory listing (to take into account template changes or
|
# the directory listing (to take into account template changes or
|
||||||
# revision property changes).
|
# revision property changes).
|
||||||
if request.roottype == 'svn':
|
if request.roottype == 'svn':
|
||||||
rev = request.repos._getrev(request.pathrev)
|
try:
|
||||||
|
rev = request.repos._getrev(request.pathrev)
|
||||||
|
except vclib.InvalidRevision:
|
||||||
|
raise debug.ViewVCException('Invalid revision', '404 Not Found')
|
||||||
tree_rev = vclib.svn.created_rev(request.repos, request.where, rev)
|
tree_rev = vclib.svn.created_rev(request.repos, request.where, rev)
|
||||||
if check_freshness(request, None, str(tree_rev), weak=1):
|
if check_freshness(request, None, str(tree_rev), weak=1):
|
||||||
return
|
return
|
||||||
@@ -1825,7 +1835,7 @@ def redirect_pathrev(request):
|
|||||||
try:
|
try:
|
||||||
new_pathrev = int(new_pathrev)
|
new_pathrev = int(new_pathrev)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
new_pathrev = youngest
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@@ -2090,9 +2100,8 @@ def view_log(request):
|
|||||||
'tag_prefer_markup': prefer_markup,
|
'tag_prefer_markup': prefer_markup,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
if not request.pathrev:
|
data['view_href'] = request.get_url(view_func=view_directory,
|
||||||
data['view_href'] = request.get_url(view_func=view_directory,
|
params={}, escape=1)
|
||||||
params={}, escape=1)
|
|
||||||
|
|
||||||
taginfo = options.get('cvs_tags', {})
|
taginfo = options.get('cvs_tags', {})
|
||||||
tagitems = taginfo.items()
|
tagitems = taginfo.items()
|
||||||
@@ -2609,8 +2618,12 @@ def setup_diff(request):
|
|||||||
sym2 = r2[idx+1:]
|
sym2 = r2[idx+1:]
|
||||||
|
|
||||||
if request.roottype == 'svn':
|
if request.roottype == 'svn':
|
||||||
rev1 = str(request.repos._getrev(rev1))
|
try:
|
||||||
rev2 = str(request.repos._getrev(rev2))
|
rev1 = str(request.repos._getrev(rev1))
|
||||||
|
rev2 = str(request.repos._getrev(rev2))
|
||||||
|
except vclib.InvalidRevision:
|
||||||
|
raise debug.ViewVCException('Invalid revision(s) passed to diff',
|
||||||
|
'400 Bad Request')
|
||||||
|
|
||||||
p1 = _get_diff_path_parts(request, 'p1', rev1, request.pathrev)
|
p1 = _get_diff_path_parts(request, 'p1', rev1, request.pathrev)
|
||||||
p2 = _get_diff_path_parts(request, 'p2', rev2, request.pathrev)
|
p2 = _get_diff_path_parts(request, 'p2', rev2, request.pathrev)
|
||||||
@@ -2783,7 +2796,7 @@ def generate_tarball_header(out, name, size=0, mode=None, mtime=0,
|
|||||||
uid=0, gid=0, typefrag=None, linkname='',
|
uid=0, gid=0, typefrag=None, linkname='',
|
||||||
uname='viewvc', gname='viewvc',
|
uname='viewvc', gname='viewvc',
|
||||||
devmajor=1, devminor=0, prefix=None,
|
devmajor=1, devminor=0, prefix=None,
|
||||||
magic='ustar', version='', chksum=None):
|
magic='ustar', version='00', chksum=None):
|
||||||
if not mode:
|
if not mode:
|
||||||
if name[-1:] == '/':
|
if name[-1:] == '/':
|
||||||
mode = 0755
|
mode = 0755
|
||||||
@@ -2799,6 +2812,12 @@ def generate_tarball_header(out, name, size=0, mode=None, mtime=0,
|
|||||||
if not prefix:
|
if not prefix:
|
||||||
prefix = ''
|
prefix = ''
|
||||||
|
|
||||||
|
# generate a GNU tar extension header for long names.
|
||||||
|
if len(name) >= 100:
|
||||||
|
generate_tarball_header(out, '././@LongLink', len(name), 0644, 0, 0, 0, 'L')
|
||||||
|
out.write(name)
|
||||||
|
out.write('\0' * (511 - ((len(name) + 511) % 512)))
|
||||||
|
|
||||||
block1 = struct.pack('100s 8s 8s 8s 12s 12s',
|
block1 = struct.pack('100s 8s 8s 8s 12s 12s',
|
||||||
name,
|
name,
|
||||||
'%07o' % mode,
|
'%07o' % mode,
|
||||||
@@ -2945,7 +2964,11 @@ def view_revision(request):
|
|||||||
|
|
||||||
data = common_template_data(request)
|
data = common_template_data(request)
|
||||||
query_dict = request.query_dict
|
query_dict = request.query_dict
|
||||||
rev = request.repos._getrev(query_dict.get('revision'))
|
try:
|
||||||
|
rev = request.repos._getrev(query_dict.get('revision'))
|
||||||
|
except vclib.InvalidRevision:
|
||||||
|
raise debug.ViewVCException('Invalid revision', '404 Not Found')
|
||||||
|
|
||||||
date, author, msg, changes = vclib.svn.get_revision_info(request.repos, rev)
|
date, author, msg, changes = vclib.svn.get_revision_info(request.repos, rev)
|
||||||
date_str = make_time_string(date, request.cfg)
|
date_str = make_time_string(date, request.cfg)
|
||||||
|
|
||||||
@@ -3146,22 +3169,23 @@ def english_query(request):
|
|||||||
ret.append('subdirectories')
|
ret.append('subdirectories')
|
||||||
else:
|
else:
|
||||||
ret.append('subdirectory')
|
ret.append('subdirectory')
|
||||||
ret.append(' <em>%s</em> ' % htmlify(dir))
|
ret.append(' <em>%s</em> ' % request.server.escape(dir))
|
||||||
file = request.query_dict.get('file', '')
|
file = request.query_dict.get('file', '')
|
||||||
if file:
|
if file:
|
||||||
if len(ret) != 1: ret.append('and ')
|
if len(ret) != 1: ret.append('and ')
|
||||||
ret.append('to file <em>%s</em> ' % htmlify(file))
|
ret.append('to file <em>%s</em> ' % request.server.escape(file))
|
||||||
who = request.query_dict.get('who', '')
|
who = request.query_dict.get('who', '')
|
||||||
branch = request.query_dict.get('branch', '')
|
branch = request.query_dict.get('branch', '')
|
||||||
if branch:
|
if branch:
|
||||||
ret.append('on branch <em>%s</em> ' % htmlify(branch))
|
ret.append('on branch <em>%s</em> ' % request.server.escape(branch))
|
||||||
else:
|
else:
|
||||||
ret.append('on all branches ')
|
ret.append('on all branches ')
|
||||||
if who:
|
if who:
|
||||||
ret.append('by <em>%s</em> ' % htmlify(who))
|
ret.append('by <em>%s</em> ' % request.server.escape(who))
|
||||||
date = request.query_dict.get('date', 'hours')
|
date = request.query_dict.get('date', 'hours')
|
||||||
if date == 'hours':
|
if date == 'hours':
|
||||||
ret.append('in the last %s hours' % htmlify(request.query_dict.get('hours', '2')))
|
ret.append('in the last %s hours' \
|
||||||
|
% request.server.escape(request.query_dict.get('hours', '2')))
|
||||||
elif date == 'day':
|
elif date == 'day':
|
||||||
ret.append('in the last day')
|
ret.append('in the last day')
|
||||||
elif date == 'week':
|
elif date == 'week':
|
||||||
@@ -3201,12 +3225,13 @@ def build_commit(request, files, limited_files, dir_strip):
|
|||||||
desc = files[0].GetDescription()
|
desc = files[0].GetDescription()
|
||||||
commit.log = htmlify(desc)
|
commit.log = htmlify(desc)
|
||||||
commit.short_log = format_log(desc, request.cfg)
|
commit.short_log = format_log(desc, request.cfg)
|
||||||
commit.author = htmlify(files[0].GetAuthor())
|
commit.author = request.server.escape(files[0].GetAuthor())
|
||||||
commit.rss_date = make_rss_time_string(files[0].GetTime(), request.cfg)
|
commit.rss_date = make_rss_time_string(files[0].GetTime(), request.cfg)
|
||||||
if request.roottype == 'svn':
|
if request.roottype == 'svn':
|
||||||
commit.rev = files[0].GetRevision()
|
commit.rev = files[0].GetRevision()
|
||||||
commit.rss_url = 'http://%s%s' % \
|
commit.rss_url = '%s://%s%s' % \
|
||||||
(request.server.getenv("HTTP_HOST"),
|
(request.server.getenv("HTTPS") == "on" and "https" or "http",
|
||||||
|
request.server.getenv("HTTP_HOST"),
|
||||||
request.get_url(view_func=view_revision,
|
request.get_url(view_func=view_revision,
|
||||||
params={'revision': commit.rev},
|
params={'revision': commit.rev},
|
||||||
escape=1))
|
escape=1))
|
||||||
@@ -3222,7 +3247,10 @@ def build_commit(request, files, limited_files, dir_strip):
|
|||||||
commit_time = make_time_string(commit_time, request.cfg)
|
commit_time = make_time_string(commit_time, request.cfg)
|
||||||
else:
|
else:
|
||||||
commit_time = ' '
|
commit_time = ' '
|
||||||
|
change_type = f.GetTypeString()
|
||||||
|
rev = f.GetRevision()
|
||||||
|
rev_prev = prev_rev(rev)
|
||||||
|
|
||||||
dirname = f.GetDirectory()
|
dirname = f.GetDirectory()
|
||||||
filename = f.GetFile()
|
filename = f.GetFile()
|
||||||
if dir_strip:
|
if dir_strip:
|
||||||
@@ -3231,30 +3259,41 @@ def build_commit(request, files, limited_files, dir_strip):
|
|||||||
dirname = dirname[len_strip+1:]
|
dirname = dirname[len_strip+1:]
|
||||||
filename = dirname and ("%s/%s" % (dirname, filename)) or filename
|
filename = dirname and ("%s/%s" % (dirname, filename)) or filename
|
||||||
|
|
||||||
params = { 'revision': f.GetRevision() }
|
# In CVS, we can actually look at deleted revisions; in Subversion
|
||||||
if f.GetBranch(): params['pathrev'] = f.GetBranch()
|
# we can't -- we'll look at the previous revision instead.
|
||||||
|
if request.roottype == 'svn':
|
||||||
|
if change_type == 'Remove':
|
||||||
|
params = { 'pathrev': rev_prev }
|
||||||
|
else:
|
||||||
|
params = { 'pathrev': rev }
|
||||||
|
else:
|
||||||
|
params = { 'revision': rev, 'pathrev': f.GetBranch() or None }
|
||||||
|
|
||||||
dir_href = request.get_url(view_func=view_directory,
|
dir_href = request.get_url(view_func=view_directory,
|
||||||
where=dirname, pathtype=vclib.DIR,
|
where=dirname, pathtype=vclib.DIR,
|
||||||
params=params,
|
params=params, escape=1)
|
||||||
escape=1)
|
|
||||||
log_href = request.get_url(view_func=view_log,
|
log_href = request.get_url(view_func=view_log,
|
||||||
where=filename, pathtype=vclib.FILE,
|
where=filename, pathtype=vclib.FILE,
|
||||||
params=params,
|
params=params, escape=1)
|
||||||
escape=1)
|
diff_href = view_href = download_href = None
|
||||||
view_href = request.get_url(view_func=view_markup,
|
view_href = request.get_url(view_func=view_markup,
|
||||||
where=filename, pathtype=vclib.FILE,
|
where=filename, pathtype=vclib.FILE,
|
||||||
params={'revision': f.GetRevision() },
|
params=params, escape=1)
|
||||||
escape=1)
|
|
||||||
download_href = request.get_url(view_func=view_checkout,
|
download_href = request.get_url(view_func=view_checkout,
|
||||||
where=filename, pathtype=vclib.FILE,
|
where=filename, pathtype=vclib.FILE,
|
||||||
params={'revision': f.GetRevision() },
|
params=params, escape=1)
|
||||||
escape=1)
|
if change_type == 'Change':
|
||||||
diff_href = request.get_url(view_func=view_diff,
|
diff_href_params = params.copy()
|
||||||
where=filename, pathtype=vclib.FILE,
|
diff_href_params.update({
|
||||||
params={'r1': prev_rev(f.GetRevision()),
|
'r1': rev_prev,
|
||||||
'r2': f.GetRevision(),
|
'r2': rev,
|
||||||
'diff_format': None},
|
'diff_format': None
|
||||||
escape=1)
|
})
|
||||||
|
diff_href = request.get_url(view_func=view_diff,
|
||||||
|
where=filename, pathtype=vclib.FILE,
|
||||||
|
params=diff_href_params, escape=1)
|
||||||
|
prefer_markup = ezt.boolean(default_view(guess_mime(filename),
|
||||||
|
request.cfg) == view_markup)
|
||||||
|
|
||||||
# skip files in forbidden or hidden modules
|
# skip files in forbidden or hidden modules
|
||||||
dir_parts = filter(None, string.split(dirname, '/'))
|
dir_parts = filter(None, string.split(dirname, '/'))
|
||||||
@@ -3265,21 +3304,19 @@ def build_commit(request, files, limited_files, dir_strip):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
commit.files.append(_item(date=commit_time,
|
commit.files.append(_item(date=commit_time,
|
||||||
dir=htmlify(dirname),
|
dir=request.server.escape(dirname),
|
||||||
file=htmlify(f.GetFile()),
|
file=request.server.escape(f.GetFile()),
|
||||||
author=htmlify(f.GetAuthor()),
|
author=request.server.escape(f.GetAuthor()),
|
||||||
rev=f.GetRevision(),
|
rev=rev,
|
||||||
branch=f.GetBranch(),
|
branch=f.GetBranch(),
|
||||||
plus=int(f.GetPlusCount()),
|
plus=int(f.GetPlusCount()),
|
||||||
minus=int(f.GetMinusCount()),
|
minus=int(f.GetMinusCount()),
|
||||||
type=f.GetTypeString(),
|
type=change_type,
|
||||||
dir_href=dir_href,
|
dir_href=dir_href,
|
||||||
log_href=log_href,
|
log_href=log_href,
|
||||||
view_href=view_href,
|
view_href=view_href,
|
||||||
download_href=download_href,
|
download_href=download_href,
|
||||||
prefer_markup=ezt.boolean
|
prefer_markup=prefer_markup,
|
||||||
(default_view(guess_mime(filename), request.cfg)
|
|
||||||
== view_markup),
|
|
||||||
diff_href=diff_href))
|
diff_href=diff_href))
|
||||||
return commit
|
return commit
|
||||||
|
|
||||||
@@ -3401,7 +3438,7 @@ def view_query(request):
|
|||||||
# run the query
|
# run the query
|
||||||
db.RunQuery(query)
|
db.RunQuery(query)
|
||||||
|
|
||||||
sql = htmlify(db.CreateSQLQueryString(query))
|
sql = request.server.escape(db.CreateSQLQueryString(query))
|
||||||
|
|
||||||
# gather commits
|
# gather commits
|
||||||
commits = []
|
commits = []
|
||||||
|
@@ -15,8 +15,18 @@
|
|||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
|
||||||
import os, sys, traceback, string, thread
|
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 win32process, win32pipe, win32con
|
||||||
import win32event, win32file, win32api, winerror
|
import win32event, win32file, winerror
|
||||||
import pywintypes, msvcrt
|
import pywintypes, msvcrt
|
||||||
|
|
||||||
# Buffer size for spooling
|
# Buffer size for spooling
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
enter a numeric revision.
|
enter a numeric revision.
|
||||||
[end]
|
[end]
|
||||||
</p>
|
</p>
|
||||||
<form method="get" action="[diff_select_action]" name="diff_select">
|
<form method="get" action="[diff_select_action]" id="diff_select">
|
||||||
|
|
||||||
<table cellpadding="2" cellspacing="0" class="auto">
|
<table cellpadding="2" cellspacing="0" class="auto">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="text" size="12" name="tr1"
|
<input type="text" size="12" name="tr1"
|
||||||
value="[if-any rev_selected][rev_selected][else][first_revision][end]"
|
value="[if-any rev_selected][rev_selected][else][first_revision][end]"
|
||||||
onchange="document.diff_select.r1.selectedIndex=0" />
|
onchange="document.getElementById('diff_select').r1.selectedIndex=0" />
|
||||||
[else]
|
[else]
|
||||||
<input type="text" size="12" name="r1"
|
<input type="text" size="12" name="r1"
|
||||||
value="[if-any rev_selected][rev_selected][else][first_revision][end]" />
|
value="[if-any rev_selected][rev_selected][else][first_revision][end]" />
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="text" size="12" name="tr2"
|
<input type="text" size="12" name="tr2"
|
||||||
value="[last_revision]"
|
value="[last_revision]"
|
||||||
onchange="document.diff_select.r1.selectedIndex=0" />
|
onchange="document.getElementById('diff_select').r2.selectedIndex=0" />
|
||||||
[else]
|
[else]
|
||||||
<input type="text" size="12" name="r2" value="[last_revision]" />
|
<input type="text" size="12" name="r2" value="[last_revision]" />
|
||||||
[end]
|
[end]
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
[# if you want to disable tarball generation remove the following: ]
|
[# if you want to disable tarball generation remove the following: ]
|
||||||
[if-any tarball_href]
|
[if-any tarball_href]
|
||||||
<p style="margin:0;"><a href="[tarball_href]">Download tarball</a></p>
|
<p style="margin:0;"><a href="[tarball_href]">Download GNU tarball</a></p>
|
||||||
[end]
|
[end]
|
||||||
|
|
||||||
[include "footer.ezt"]
|
[include "footer.ezt"]
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Powered by <a href="http://viewvc.tigris.org/">ViewVC [vsn]</a></td>
|
<td>Powered by <a href="http://viewvc.tigris.org/">ViewVC [vsn]</a></td>
|
||||||
<td style="text-align: right;">[if-any rss_href]<a href="[rss_href]" title="RSS 2.0 feed"><img src="[docroot]/images/feed-icon-16x16.jpg"/>[else] [end]</td>
|
<td style="text-align: right;">[if-any rss_href]<a href="[rss_href]" title="RSS 2.0 feed"><img src="[docroot]/images/feed-icon-16x16.jpg" alt="RSS 2.0 feed"/></a>[else] [end]</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<title>[if-any rootname][[][rootname]][else]ViewVC[end] [page_title]</title>
|
<title>[if-any rootname][[][rootname]][else]ViewVC[end] [page_title]</title>
|
||||||
<meta name="generator" content="ViewVC [vsn]" />
|
<meta name="generator" content="ViewVC [vsn]" />
|
||||||
<link rel="stylesheet" href="[docroot]/styles.css" type="text/css" />
|
<link rel="stylesheet" href="[docroot]/styles.css" type="text/css" />
|
||||||
[if-any rss_href]<link rel="alternate" type="application/rss+xml" title="RSS [[][rootname]][where]" HREF="[rss_href]">[end]
|
[if-any rss_href]<link rel="alternate" type="application/rss+xml" title="RSS [[][rootname]][where]" href="[rss_href]" />[end]
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="vc_navheader">
|
<div class="vc_navheader">
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<form method="get" action="[pathrev_action]" style="display: inline">
|
<form method="get" action="[pathrev_action]" style="display: inline">
|
||||||
|
<div style="display: inline">
|
||||||
[pathrev_hidden_values]
|
[pathrev_hidden_values]
|
||||||
[is roottype "cvs"]
|
[is roottype "cvs"]
|
||||||
[define pathrev_selected][pathrev][end]
|
[define pathrev_selected][pathrev][end]
|
||||||
@@ -34,16 +35,19 @@
|
|||||||
<input type="text" name="pathrev" value="[pathrev]" size="6"/>
|
<input type="text" name="pathrev" value="[pathrev]" size="6"/>
|
||||||
[end]
|
[end]
|
||||||
<input type="submit" value="Set" />
|
<input type="submit" value="Set" />
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
[if-any pathrev]
|
[if-any pathrev]
|
||||||
<form method="get" action="[pathrev_clear_action]" style="display: inline">
|
<form method="get" action="[pathrev_clear_action]" style="display: inline">
|
||||||
|
<div style="display: inline">
|
||||||
[pathrev_clear_hidden_values]
|
[pathrev_clear_hidden_values]
|
||||||
[if-any lastrev]
|
[if-any lastrev]
|
||||||
[is pathrev lastrev][else]<input type="submit" value="Set to [lastrev]">[end]
|
[is pathrev lastrev][else]<input type="submit" value="Set to [lastrev]" />[end]
|
||||||
(<i>Current path doesn't exist after revision <strong>[lastrev]</strong></i>)
|
(<i>Current path doesn't exist after revision <strong>[lastrev]</strong></i>)
|
||||||
[else]
|
[else]
|
||||||
<input type="submit" value="Clear">
|
<input type="submit" value="Clear" />
|
||||||
[end]
|
[end]
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
[end]
|
[end]
|
||||||
|
645
viewvc-install
645
viewvc-install
@@ -11,10 +11,7 @@
|
|||||||
#
|
#
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# install script for viewvc -- temporary?
|
# Install script for ViewVC
|
||||||
#
|
|
||||||
# ### this will eventually be replaced by autoconf plus tools. an
|
|
||||||
# ### interactive front-end to ./configure may be provided.
|
|
||||||
#
|
#
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -27,7 +24,7 @@ import py_compile
|
|||||||
import getopt
|
import getopt
|
||||||
import StringIO
|
import StringIO
|
||||||
|
|
||||||
# get access to our library modules
|
# Get access to our library modules.
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), 'lib'))
|
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), 'lib'))
|
||||||
|
|
||||||
import compat
|
import compat
|
||||||
@@ -36,324 +33,440 @@ import compat_ndiff
|
|||||||
version = viewvc.__version__
|
version = viewvc.__version__
|
||||||
|
|
||||||
|
|
||||||
## installer text
|
## Installer defaults.
|
||||||
INFO_TEXT = """
|
|
||||||
|
|
||||||
This is the ViewVC %s installer.
|
|
||||||
|
|
||||||
It will allow you to choose the install path for ViewVC. You will
|
|
||||||
now be asked some installation questions.
|
|
||||||
|
|
||||||
Defaults are given in square brackets. Just hit [Enter] if a default
|
|
||||||
is okay.
|
|
||||||
""" % version
|
|
||||||
|
|
||||||
## installer defaults
|
|
||||||
DESTDIR = None
|
DESTDIR = None
|
||||||
ROOT_DIR = None
|
ROOT_DIR = None
|
||||||
|
CLEAN_MODE = None
|
||||||
|
|
||||||
|
|
||||||
## list of files for installation
|
## List of files for installation.
|
||||||
## tuple (source path, destination path, install mode, true/false flag for
|
## tuple (source path,
|
||||||
## search-and-replace, flag or text for prompt before replace,
|
## destination path,
|
||||||
## compile_it)
|
## mode,
|
||||||
##
|
## boolean -- search-and-replace?
|
||||||
|
## boolean -- prompt before replacing?
|
||||||
|
## boolean -- compile?)
|
||||||
FILE_INFO_LIST = [
|
FILE_INFO_LIST = [
|
||||||
("bin/cgi/viewvc.cgi", "bin/cgi/viewvc.cgi", 0755, 1, 0, 0),
|
("bin/cgi/viewvc.cgi", "bin/cgi/viewvc.cgi", 0755, 1, 0, 0),
|
||||||
("bin/cgi/query.cgi", "bin/cgi/query.cgi", 0755, 1, 0, 0),
|
("bin/cgi/query.cgi", "bin/cgi/query.cgi", 0755, 1, 0, 0),
|
||||||
("bin/mod_python/viewvc.py", "bin/mod_python/viewvc.py", 0755, 1, 0, 0),
|
("bin/mod_python/viewvc.py", "bin/mod_python/viewvc.py", 0755, 1, 0, 0),
|
||||||
("bin/mod_python/query.py", "bin/mod_python/query.py", 0755, 1, 0, 0),
|
("bin/mod_python/query.py", "bin/mod_python/query.py", 0755, 1, 0, 0),
|
||||||
("bin/mod_python/handler.py", "bin/mod_python/handler.py", 0755, 1, 0, 0),
|
("bin/mod_python/handler.py", "bin/mod_python/handler.py", 0755, 1, 0, 0),
|
||||||
("bin/mod_python/.htaccess", "bin/mod_python/.htaccess", 0755, 0, 0, 0),
|
("bin/mod_python/.htaccess", "bin/mod_python/.htaccess", 0755, 0, 0, 0),
|
||||||
("bin/standalone.py", "bin/standalone.py", 0755, 1, 0, 0),
|
("bin/standalone.py", "bin/standalone.py", 0755, 1, 0, 0),
|
||||||
("viewvc.conf.dist", "viewvc.conf", 0644, 0,
|
("bin/loginfo-handler", "bin/loginfo-handler", 0755, 1, 0, 0),
|
||||||
"""Note: If you are upgrading from viewcvs-0.7 or earlier:
|
("bin/cvsdbadmin", "bin/cvsdbadmin", 0755, 1, 0, 0),
|
||||||
The section [text] has been removed from viewcvs.conf. The functionality
|
("bin/svndbadmin", "bin/svndbadmin", 0755, 1, 0, 0),
|
||||||
went into the new files in subdirectory templates.""", 0),
|
("bin/make-database", "bin/make-database", 0755, 1, 0, 0),
|
||||||
("cvsgraph.conf.dist", "cvsgraph.conf", 0644, 0, 1, 0),
|
("viewvc.conf.dist", "viewvc.conf.dist", 0644, 0, 0, 0),
|
||||||
|
("viewvc.conf.dist", "viewvc.conf", 0644, 0, 1, 0),
|
||||||
("bin/loginfo-handler", "bin/loginfo-handler", 0755, 1, 0, 0),
|
("cvsgraph.conf.dist", "cvsgraph.conf.dist", 0644, 0, 0, 0),
|
||||||
("bin/cvsdbadmin", "bin/cvsdbadmin", 0755, 1, 0, 0),
|
("cvsgraph.conf.dist", "cvsgraph.conf", 0644, 0, 1, 0),
|
||||||
("bin/svndbadmin", "bin/svndbadmin", 0755, 1, 0, 0),
|
|
||||||
("bin/make-database", "bin/make-database", 0755, 1, 0, 0),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
FILE_INFO_LIST.extend([
|
FILE_INFO_LIST.extend([
|
||||||
("bin/asp/viewvc.asp", "bin/asp/viewvc.asp", 0755, 1, 0, 0),
|
("bin/asp/viewvc.asp", "bin/asp/viewvc.asp", 0755, 1, 0, 0),
|
||||||
("bin/asp/query.asp", "bin/asp/query.asp", 0755, 1, 0, 0),
|
("bin/asp/query.asp", "bin/asp/query.asp", 0755, 1, 0, 0),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## List of directories for installation.
|
||||||
|
## type (source path,
|
||||||
|
## destination path,
|
||||||
|
## boolean -- prompt before replacing?)
|
||||||
TREE_LIST = [
|
TREE_LIST = [
|
||||||
("lib", "lib", 0),
|
("lib", "lib", 0),
|
||||||
("templates", "templates", 1),
|
("templates", "templates", 1),
|
||||||
]
|
]
|
||||||
|
|
||||||
# used to escape substitution strings passed to re.sub(). re.escape() is no
|
|
||||||
# good because it blindly puts backslashes in front of anything that is not
|
|
||||||
# a number or letter regardless of whether the resulting sequence will be
|
|
||||||
# interpreted.
|
|
||||||
def ReEscape(str):
|
|
||||||
return string.replace(str, "\\", "\\\\")
|
|
||||||
|
|
||||||
def Error(text, etype=None, evalue=None):
|
## List of file extensions we can't show diffs for.
|
||||||
print
|
BINARY_FILE_EXTS = [
|
||||||
print "[ERROR] %s" % text
|
'.png',
|
||||||
|
'.gif',
|
||||||
|
'.jpg',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _escape(str):
|
||||||
|
"""Callback function for re.sub().
|
||||||
|
|
||||||
|
re.escape() is no good because it blindly puts backslashes in
|
||||||
|
front of anything that is not a number or letter regardless of
|
||||||
|
whether the resulting sequence will be interpreted."""
|
||||||
|
return string.replace(str, "\\", "\\\\")
|
||||||
|
|
||||||
|
|
||||||
|
def _actual_src_path(path):
|
||||||
|
"""Return the real on-disk location of PATH, which is relative to
|
||||||
|
the ViewVC source directory."""
|
||||||
|
return os.path.join(os.path.dirname(sys.argv[0]),
|
||||||
|
string.replace(path, '/', os.sep))
|
||||||
|
|
||||||
|
|
||||||
|
def error(text, etype=None, evalue=None):
|
||||||
|
"""Print error TEXT to stderr, pretty printing the optional
|
||||||
|
exception type and value (ETYPE and EVALUE, respective), and then
|
||||||
|
exit the program with an errorful code."""
|
||||||
|
sys.stderr.write("\n[ERROR] %s\n" % (text))
|
||||||
if etype:
|
if etype:
|
||||||
print '[ERROR] ',
|
traceback.print_exception(etype, evalue, None, file=sys.stderr)
|
||||||
traceback.print_exception(etype, evalue, None, file=sys.stdout)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def MkDir(path):
|
def replace_var(contents, var, value):
|
||||||
try:
|
"""Replace instances of the variable VAR as found in file CONTENTS
|
||||||
compat.makedirs(path)
|
with VALUE."""
|
||||||
except os.error, e:
|
|
||||||
if e[0] == 17:
|
|
||||||
# EEXIST: file exists
|
|
||||||
return
|
|
||||||
if e[0] == 13:
|
|
||||||
# EACCES: permission denied
|
|
||||||
Error("You do not have permission to create directory %s" % path)
|
|
||||||
Error("Unknown error creating directory %s" % path, OSError, e)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def SetOnePath(contents, var, value):
|
|
||||||
pattern = re.compile('^' + var + r'\s*=\s*.*$', re.MULTILINE)
|
pattern = re.compile('^' + var + r'\s*=\s*.*$', re.MULTILINE)
|
||||||
repl = '%s = r"%s"' % (var, os.path.join(ROOT_DIR, value))
|
repl = '%s = r"%s"' % (var, os.path.join(ROOT_DIR, value))
|
||||||
return re.sub(pattern, ReEscape(repl), contents)
|
return re.sub(pattern, _escape(repl), contents)
|
||||||
|
|
||||||
|
|
||||||
def SetPythonPaths(contents):
|
def replace_paths(contents):
|
||||||
|
"""Replace all ViewVC path placeholders found in file CONTENTS."""
|
||||||
if contents[:2] == '#!':
|
if contents[:2] == '#!':
|
||||||
shbang = '#!' + sys.executable
|
shbang = '#!' + sys.executable
|
||||||
contents = re.sub('^#![^\n]*', ReEscape(shbang), contents)
|
contents = re.sub('^#![^\n]*', _escape(shbang), contents)
|
||||||
contents = SetOnePath(contents, 'LIBRARY_DIR', 'lib')
|
contents = replace_var(contents, 'LIBRARY_DIR', 'lib')
|
||||||
contents = SetOnePath(contents, 'CONF_PATHNAME', 'viewvc.conf')
|
contents = replace_var(contents, 'CONF_PATHNAME', 'viewvc.conf')
|
||||||
return contents
|
return contents
|
||||||
|
|
||||||
|
|
||||||
def InstallFile(src_path, dest_path, mode, set_python_paths, prompt_replace,
|
def install_file(src_path, dst_path, mode, subst_path_vars,
|
||||||
compile_it):
|
prompt_replace, compile_it):
|
||||||
dest_path = os.path.join(ROOT_DIR, dest_path)
|
"""Install a single file whose source is at SRC_PATH (which is
|
||||||
|
relative to the ViewVC source directory) into the location
|
||||||
|
DST_PATH (which is relative both to the global ROOT_DIR and
|
||||||
|
DESTDIR settings), and set the file's MODE. If SUBST_PATH_VARS is
|
||||||
|
set, substitute path variables in the file's contents. If
|
||||||
|
PROMPT_REPLACE is set (and is not overridden by global setting
|
||||||
|
CLEAN_MODE), prompt the user for how to deal with already existing
|
||||||
|
files that differ from the to-be-installed version. If COMPILE_IT
|
||||||
|
is set, compile the file as a Python module."""
|
||||||
|
|
||||||
if prompt_replace and os.path.exists(DESTDIR + dest_path):
|
src_path = _actual_src_path(src_path)
|
||||||
# Collect ndiff output from ndiff
|
dst_path = os.path.join(ROOT_DIR, string.replace(dst_path, '/', os.sep))
|
||||||
sys.stdout = StringIO.StringIO()
|
destdir_path = DESTDIR + dst_path
|
||||||
compat_ndiff.main([DESTDIR + dest_path, src_path])
|
|
||||||
ndiff_output = sys.stdout.getvalue()
|
|
||||||
|
|
||||||
# Return everything to normal
|
overwrite = None
|
||||||
sys.stdout = sys.__stdout__
|
if not (prompt_replace and os.path.exists(destdir_path)):
|
||||||
|
# If the file doesn't already exist, or we've been instructed to
|
||||||
|
# replace it without prompting, then drop in the new file and get
|
||||||
|
# outta here.
|
||||||
|
overwrite = 1
|
||||||
|
else:
|
||||||
|
# If we're here, then the file already exists, and we've possibly
|
||||||
|
# got to prompt the user for what to do about that.
|
||||||
|
|
||||||
|
# Collect ndiff output from ndiff
|
||||||
|
sys.stdout = StringIO.StringIO()
|
||||||
|
compat_ndiff.main([destdir_path, src_path])
|
||||||
|
ndiff_output = sys.stdout.getvalue()
|
||||||
|
|
||||||
# Collect the '+ ' and '- ' lines
|
# Return everything to normal
|
||||||
# total collects the difference lines to be printed later
|
sys.stdout = sys.__stdout__
|
||||||
total = ""
|
|
||||||
# I use flag to throw out match lines.
|
|
||||||
flag = 1
|
|
||||||
for line in string.split(ndiff_output,'\n'):
|
|
||||||
# Print line if it is a difference line
|
|
||||||
if line[:2] == "+ " or line[:2] == "- " or line[:2] == "? ":
|
|
||||||
total = total + line + "\n"
|
|
||||||
flag = 1
|
|
||||||
else:
|
|
||||||
# Compress lines that are the same to print one blank line
|
|
||||||
if flag:
|
|
||||||
total = total + "\n"
|
|
||||||
flag = 0
|
|
||||||
|
|
||||||
if total == "\n":
|
# Collect the '+ ' and '- ' lines.
|
||||||
print " File %s exists,\n but there is no difference between target and source files.\n" % (DESTDIR + dest_path)
|
diff_lines = []
|
||||||
return
|
looking_at_diff_lines = 0
|
||||||
|
for line in string.split(ndiff_output, '\n'):
|
||||||
|
# Print line if it is a difference line
|
||||||
|
if line[:2] == "+ " or line[:2] == "- " or line[:2] == "? ":
|
||||||
|
diff_lines.append(line)
|
||||||
|
looking_at_diff_lines = 1
|
||||||
|
else:
|
||||||
|
# Compress lines that are the same to print one blank line
|
||||||
|
if looking_at_diff_lines:
|
||||||
|
diff_lines.append("")
|
||||||
|
looking_at_diff_lines = 0
|
||||||
|
|
||||||
if type(prompt_replace) == type(""):
|
# If there are no differences, we're done here.
|
||||||
print prompt_replace
|
if not diff_lines:
|
||||||
while 1:
|
overwrite = 1
|
||||||
temp = raw_input("""
|
|
||||||
File %s exists and is different from source file.
|
|
||||||
DO YOU WANT TO,
|
|
||||||
overwrite [o]
|
|
||||||
do not overwrite [d]
|
|
||||||
view differences [v]: """ % (DESTDIR + dest_path))
|
|
||||||
print
|
|
||||||
|
|
||||||
temp = string.lower(temp[0])
|
|
||||||
|
|
||||||
if temp == "d":
|
|
||||||
return
|
|
||||||
|
|
||||||
if temp == "v":
|
|
||||||
if string.lower(src_path[-4:]) in [ '.gif', '.png', '.jpg' ]:
|
|
||||||
print 'Can not print differences between binary files'
|
|
||||||
else:
|
else:
|
||||||
print total
|
# If we get here, there are differences.
|
||||||
print """
|
if CLEAN_MODE == 'true':
|
||||||
|
overwrite = 1
|
||||||
|
elif CLEAN_MODE == 'false':
|
||||||
|
overwrite = 0
|
||||||
|
else:
|
||||||
|
print "File %s exists and is different from source file." \
|
||||||
|
% (destdir_path)
|
||||||
|
while 1:
|
||||||
|
name, ext = os.path.splitext(src_path)
|
||||||
|
if ext in BINARY_FILE_EXTS:
|
||||||
|
temp = raw_input("Do you want to [O]verwrite or "
|
||||||
|
"[D]o not overwrite? ")
|
||||||
|
else:
|
||||||
|
temp = raw_input("Do you want to [O]verwrite, [D]o "
|
||||||
|
"not overwrite, or [V]iew "
|
||||||
|
"differences? ")
|
||||||
|
temp = string.lower(temp[0])
|
||||||
|
if temp == "v" and ext not in BINARY_FILE_EXTS:
|
||||||
|
print """
|
||||||
|
---------------------------------------------------------------------------"""
|
||||||
|
print string.join(diff_lines, '\n') + '\n'
|
||||||
|
print """
|
||||||
LEGEND
|
LEGEND
|
||||||
A leading '- ' indicates line to remove from installed file
|
A leading '- ' indicates line to remove from installed file
|
||||||
A leading '+ ' indicates line to add to installed file
|
A leading '+ ' indicates line to add to installed file
|
||||||
A leading '? ' shows intraline differences."""
|
A leading '? ' shows intraline differences.
|
||||||
|
---------------------------------------------------------------------------"""
|
||||||
|
elif temp == "d":
|
||||||
|
overwrite = 0
|
||||||
|
elif temp == "o":
|
||||||
|
overwrite = 1
|
||||||
|
|
||||||
if temp == "o":
|
if overwrite is not None:
|
||||||
ReplaceFile(src_path, dest_path, mode, set_python_paths,
|
break
|
||||||
prompt_replace, compile_it)
|
|
||||||
|
assert overwrite is not None
|
||||||
|
if not overwrite:
|
||||||
|
print " preserved %s" % (dst_path)
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
ReplaceFile(src_path, dest_path, mode, set_python_paths,
|
|
||||||
prompt_replace, compile_it)
|
|
||||||
return
|
|
||||||
|
|
||||||
def ReplaceFile(src_path, dest_path, mode, set_python_paths,
|
### If we get here, we're creating or overwriting the existing file.
|
||||||
prompt_replace, compile_it):
|
|
||||||
try:
|
|
||||||
contents = open(src_path, "rb").read()
|
|
||||||
except IOError, e:
|
|
||||||
Error(str(e))
|
|
||||||
|
|
||||||
if set_python_paths:
|
# Read the source file's contents.
|
||||||
contents = SetPythonPaths(contents)
|
try:
|
||||||
|
contents = open(src_path, "rb").read()
|
||||||
|
except IOError, e:
|
||||||
|
error(str(e))
|
||||||
|
|
||||||
## write the file to the destination location
|
# (Optionally) substitute ViewVC path variables.
|
||||||
path, basename = os.path.split(DESTDIR + dest_path)
|
if subst_path_vars:
|
||||||
MkDir(path)
|
contents = replace_paths(contents)
|
||||||
|
|
||||||
try:
|
# Ensure the existence of the containing directories.
|
||||||
open(DESTDIR + dest_path, "wb").write(contents)
|
dst_parent = os.path.dirname(destdir_path)
|
||||||
except IOError, e:
|
if not os.path.exists(dst_parent):
|
||||||
if e[0] == 13:
|
try:
|
||||||
# EACCES: permission denied
|
compat.makedirs(dst_parent)
|
||||||
Error("You do not have permission to write file %s" % dest_path)
|
print " created %s%s" % (dst_parent, os.sep)
|
||||||
Error("Unknown error writing file %s" % dest_path, IOError, e)
|
except os.error, e:
|
||||||
|
if e.errno == 17: # EEXIST: file exists
|
||||||
os.chmod(DESTDIR + dest_path, mode)
|
return
|
||||||
|
if e.errno == 13: # EACCES: permission denied
|
||||||
if compile_it:
|
error("You do not have permission to create directory %s" \
|
||||||
py_compile.compile(DESTDIR + dest_path,
|
% (dst_parent))
|
||||||
DESTDIR + dest_path + "c" , dest_path)
|
error("Unknown error creating directory %s" \
|
||||||
|
% (dst_parent, OSError, e))
|
||||||
return
|
|
||||||
|
# Now, write the file contents to their destination.
|
||||||
|
try:
|
||||||
|
exists = os.path.exists(destdir_path)
|
||||||
|
open(destdir_path, "wb").write(contents)
|
||||||
|
print " %s %s" \
|
||||||
|
% (exists and 'replaced ' or 'installed', dst_path)
|
||||||
|
except IOError, e:
|
||||||
|
if e.errno == 13:
|
||||||
|
# EACCES: permission denied
|
||||||
|
error("You do not have permission to write file %s" % (dst_path))
|
||||||
|
error("Unknown error writing file %s" % (dst_path, IOError, e))
|
||||||
|
|
||||||
|
# Set the files's mode.
|
||||||
|
os.chmod(destdir_path, mode)
|
||||||
|
|
||||||
|
# (Optionally) compile the file.
|
||||||
|
if compile_it:
|
||||||
|
py_compile.compile(destdir_path, destdir_path + "c" , dst_path)
|
||||||
|
|
||||||
|
|
||||||
def install_tree(src_path, dst_path, prompt_replace):
|
def install_tree(src_path, dst_path, prompt_replace):
|
||||||
files = os.listdir(src_path)
|
"""Install a tree whose source is at SRC_PATH (which is relative
|
||||||
files.sort()
|
to the ViewVC source directory) into the location DST_PATH (which
|
||||||
for fname in files:
|
is relative both to the global ROOT_DIR and DESTDIR settings). If
|
||||||
# eliminate some items which appear in a development area
|
PROMPT_REPLACE is set (and is not overridden by global setting
|
||||||
if fname == 'CVS' or fname == '.svn' or fname == '_svn' \
|
CLEAN_MODE), prompt the user for how to deal with already existing
|
||||||
or fname[-4:] == '.pyc' or fname[-5:] == '.orig' \
|
files that differ from the to-be-installed version."""
|
||||||
or fname[-4:] == '.rej' or fname[0] == '.' \
|
|
||||||
or fname[-1] == '~':
|
|
||||||
continue
|
|
||||||
|
|
||||||
src = os.path.join(src_path, fname)
|
orig_src_path = src_path
|
||||||
dst = os.path.join(dst_path, fname)
|
orig_dst_path = dst_path
|
||||||
if os.path.isdir(src):
|
src_path = _actual_src_path(src_path)
|
||||||
install_tree(src, dst, prompt_replace)
|
dst_path = os.path.join(ROOT_DIR, string.replace(dst_path, '/', os.sep))
|
||||||
|
destdir_path = os.path.join(DESTDIR + dst_path)
|
||||||
|
|
||||||
|
# Get a list of items in the directory.
|
||||||
|
files = os.listdir(src_path)
|
||||||
|
files.sort()
|
||||||
|
for fname in files:
|
||||||
|
# Ignore some stuff found in development directories, but not
|
||||||
|
# intended for installation.
|
||||||
|
if fname == 'CVS' or fname == '.svn' or fname == '_svn' \
|
||||||
|
or fname[-4:] == '.pyc' or fname[-5:] == '.orig' \
|
||||||
|
or fname[-4:] == '.rej' or fname[0] == '.' \
|
||||||
|
or fname[-1] == '~':
|
||||||
|
continue
|
||||||
|
|
||||||
|
orig_src_child = orig_src_path + '/' + fname
|
||||||
|
orig_dst_child = orig_dst_path + '/' + fname
|
||||||
|
|
||||||
|
# If the item is a subdirectory, recurse. Otherwise, install the file.
|
||||||
|
if os.path.isdir(os.path.join(src_path, fname)):
|
||||||
|
install_tree(orig_src_child, orig_dst_child, prompt_replace)
|
||||||
|
else:
|
||||||
|
set_paths = 0
|
||||||
|
compile_it = fname[-3:] == '.py'
|
||||||
|
install_file(orig_src_child, orig_dst_child, 0644,
|
||||||
|
set_paths, prompt_replace, compile_it)
|
||||||
|
|
||||||
|
# Check for .py and .pyc files that don't belong in installation.
|
||||||
|
for fname in os.listdir(destdir_path):
|
||||||
|
if not os.path.isfile(os.path.join(destdir_path, fname)) or \
|
||||||
|
not ((fname[-3:] == '.py' and fname not in files) or
|
||||||
|
(fname[-4:] == '.pyc' and fname[:-1] not in files)):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# If we get here, there's cruft.
|
||||||
|
delete = None
|
||||||
|
if CLEAN_MODE == 'true':
|
||||||
|
delete = 1
|
||||||
|
elif CLEAN_MODE == 'false':
|
||||||
|
delete = 0
|
||||||
|
else:
|
||||||
|
print "File %s does not belong in ViewVC %s." \
|
||||||
|
% (dst_path, version)
|
||||||
|
while 1:
|
||||||
|
temp = raw_input("Do you want to [D]elete it, or [L]eave "
|
||||||
|
"it as is? ")
|
||||||
|
temp = string.lower(temp[0])
|
||||||
|
if temp == "l":
|
||||||
|
delete = 0
|
||||||
|
elif temp == "d":
|
||||||
|
delete = 1
|
||||||
|
|
||||||
|
if delete is not None:
|
||||||
|
break
|
||||||
|
|
||||||
|
assert delete is not None
|
||||||
|
if delete:
|
||||||
|
print " deleted %s" % (os.path.join(dst_path, fname))
|
||||||
|
os.unlink(os.path.join(destdir_path, fname))
|
||||||
|
else:
|
||||||
|
print " preserved %s" % (os.path.join(dst_path, fname))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def usage_and_exit(errstr=None):
|
||||||
|
stream = errstr and sys.stderr or sys.stdout
|
||||||
|
stream.write("""Usage: %s [OPTIONS]
|
||||||
|
|
||||||
|
Installs the ViewVC web-based version control repository browser.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
--help, -h, -? Show this usage message and exit.
|
||||||
|
|
||||||
|
--prefix=DIR Install ViewVC into the directory DIR. If not provided,
|
||||||
|
the script will prompt for this information.
|
||||||
|
|
||||||
|
--destdir=DIR Use DIR as the DESTDIR. This is generally only used
|
||||||
|
by package maintainers. If not provided, the script will
|
||||||
|
prompt for this information.
|
||||||
|
|
||||||
|
--clean-mode= If 'true', overwrite existing ViewVC configuration files
|
||||||
|
found in the target directory, and purge Python modules
|
||||||
|
from the target directory that aren't part of the ViewVC
|
||||||
|
distribution. If 'false', do not overwrite configuration
|
||||||
|
files, and do not purge any files from the target
|
||||||
|
directory. If not specified, the script will prompt
|
||||||
|
for the appropriate action on a per-file basis.
|
||||||
|
|
||||||
|
""" % (os.path.basename(sys.argv[0])))
|
||||||
|
if errstr:
|
||||||
|
stream.write("ERROR: %s\n\n" % (errstr))
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print " ", src
|
sys.exit(0)
|
||||||
set_paths = 0
|
|
||||||
compile_it = fname[-3:] == '.py'
|
|
||||||
InstallFile(src, dst, 0644, set_paths, prompt_replace, compile_it)
|
|
||||||
|
|
||||||
# prompt to delete all .py and .pyc files that don't belong in installation
|
|
||||||
full_dst_path = os.path.join(DESTDIR + ROOT_DIR, dst_path)
|
|
||||||
for fname in os.listdir(full_dst_path):
|
|
||||||
if not os.path.isfile(os.path.join(full_dst_path, fname)) or \
|
|
||||||
not ((fname[-3:] == '.py' and fname not in files) or
|
|
||||||
(fname[-4:] == '.pyc' and fname[:-1] not in files)):
|
|
||||||
continue
|
|
||||||
|
|
||||||
while 1:
|
|
||||||
temp = raw_input("""
|
|
||||||
File %s does not belong in ViewVC %s.
|
|
||||||
DO YOU WANT TO,
|
|
||||||
delete [d]
|
|
||||||
leave as is [l]: """ % (os.path.join(dst_path, fname), version))
|
|
||||||
print
|
|
||||||
|
|
||||||
temp = string.lower(temp[0])
|
|
||||||
|
|
||||||
if temp == "l":
|
|
||||||
break
|
|
||||||
|
|
||||||
if temp == "d":
|
|
||||||
os.unlink(os.path.join(full_dst_path, fname))
|
|
||||||
break
|
|
||||||
|
|
||||||
## MAIN
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# option parsing
|
# Option parsing.
|
||||||
try:
|
try:
|
||||||
optlist, args = getopt.getopt(sys.argv[1:], "", ['prefix=', 'destdir='])
|
optlist, args = getopt.getopt(sys.argv[1:], "h?",
|
||||||
|
['prefix=',
|
||||||
|
'destdir=',
|
||||||
|
'clean-mode=',
|
||||||
|
'help'])
|
||||||
except getopt.GetoptError, e:
|
except getopt.GetoptError, e:
|
||||||
Error("Invalid option", getopt.GetoptError, e)
|
usage_and_exit(str(e))
|
||||||
for opt, arg in optlist:
|
for opt, arg in optlist:
|
||||||
if opt == '--prefix':
|
if opt == '--help' or opt == '-h' or opt == '-?':
|
||||||
ROOT_DIR = arg
|
usage_and_exit()
|
||||||
if opt == '--destdir':
|
if opt == '--prefix':
|
||||||
DESTDIR = arg
|
ROOT_DIR = arg
|
||||||
|
if opt == '--destdir':
|
||||||
|
DESTDIR = arg
|
||||||
|
if opt == '--clean-mode':
|
||||||
|
arg = arg.lower()
|
||||||
|
if arg not in ('true', 'false'):
|
||||||
|
usage_and_exit("Invalid value for --overwrite parameter.")
|
||||||
|
CLEAN_MODE = arg
|
||||||
|
|
||||||
## print greeting
|
# Print the header greeting.
|
||||||
print INFO_TEXT
|
print """This is the ViewVC %s installer.
|
||||||
|
|
||||||
## prompt for ROOT_DIR if none provided
|
It will allow you to choose the install path for ViewVC. You will now
|
||||||
|
be asked some installation questions. Defaults are given in square brackets.
|
||||||
|
Just hit [Enter] if a default is okay.
|
||||||
|
""" % version
|
||||||
|
|
||||||
|
# Prompt for ROOT_DIR if none provided.
|
||||||
if ROOT_DIR is None:
|
if ROOT_DIR is None:
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
pf = os.getenv("ProgramFiles", "C:\\Program Files")
|
pf = os.getenv("ProgramFiles", "C:\\Program Files")
|
||||||
default = os.path.join(pf, "viewvc-" + version)
|
default = os.path.join(pf, "viewvc-" + version)
|
||||||
else:
|
else:
|
||||||
default = "/usr/local/viewvc-" + version
|
default = "/usr/local/viewvc-" + version
|
||||||
temp = string.strip(raw_input("Installation path [%s]: " % default))
|
temp = string.strip(raw_input("Installation path [%s]: " \
|
||||||
print
|
% default))
|
||||||
if len(temp):
|
print
|
||||||
ROOT_DIR = temp
|
if len(temp):
|
||||||
else:
|
ROOT_DIR = temp
|
||||||
ROOT_DIR = default
|
else:
|
||||||
|
ROOT_DIR = default
|
||||||
## prompt for DESTDIR if none provided
|
|
||||||
|
# Prompt for DESTDIR if none provided.
|
||||||
if DESTDIR is None:
|
if DESTDIR is None:
|
||||||
default = ''
|
default = ''
|
||||||
temp = string.strip(raw_input(
|
temp = string.strip(raw_input(
|
||||||
"DESTDIR path (generally, only package maintainers will need "
|
"DESTDIR path (generally only used by package "
|
||||||
"to change\nthis) [%s]: " % default))
|
"maintainers) [%s]: " \
|
||||||
print
|
% default))
|
||||||
if len(temp):
|
print
|
||||||
DESTDIR = temp
|
if len(temp):
|
||||||
else:
|
DESTDIR = temp
|
||||||
DESTDIR = default
|
else:
|
||||||
|
DESTDIR = default
|
||||||
## install the files
|
|
||||||
print "Installing ViewVC to:", ROOT_DIR,
|
# Install the files.
|
||||||
if DESTDIR:
|
print "Installing ViewVC to %s%s:" \
|
||||||
print "(DESTDIR = %s)" % (DESTDIR)
|
% (ROOT_DIR, DESTDIR and " (DESTDIR = %s)" % (DESTDIR) or "")
|
||||||
else:
|
|
||||||
print
|
|
||||||
|
|
||||||
for args in FILE_INFO_LIST:
|
for args in FILE_INFO_LIST:
|
||||||
print " ", args[0]
|
apply(install_file, args)
|
||||||
apply(InstallFile, args)
|
|
||||||
|
|
||||||
for args in TREE_LIST:
|
for args in TREE_LIST:
|
||||||
apply(install_tree, args)
|
apply(install_tree, args)
|
||||||
|
|
||||||
|
# Print some final thoughts.
|
||||||
print """
|
print """
|
||||||
|
|
||||||
ViewVC File Installation Complete
|
ViewVC file installation complete.
|
||||||
|
|
||||||
Consult INSTALL for detailed information to finish the installation
|
Consult the INSTALL document for detailed information on completing the
|
||||||
and configure ViewVC for your system.
|
installation and configuration of ViewVC on your system. Here's a brief
|
||||||
|
overview of the remaining steps:
|
||||||
|
|
||||||
Overview of remaining steps:
|
1) Edit the %s file.
|
||||||
|
|
||||||
1) Edit the %s file.
|
2) Either configure an existing web server to run
|
||||||
|
%s.
|
||||||
2) Configure an existing web server to run (or copy to cgi-bin)
|
|
||||||
%s.
|
Or, copy %s to an
|
||||||
OR
|
already-configured cgi-bin directory.
|
||||||
Run the web server that comes with ViewVC at
|
|
||||||
%s.
|
Or, use the standalone server provided by this distribution at
|
||||||
""" % (
|
%s.
|
||||||
os.path.join(ROOT_DIR, 'viewvc.conf'),
|
""" % (os.path.join(ROOT_DIR, 'viewvc.conf'),
|
||||||
os.path.join(ROOT_DIR, 'bin', 'cgi', 'viewvc.cgi'),
|
os.path.join(ROOT_DIR, 'bin', 'cgi', 'viewvc.cgi'),
|
||||||
os.path.join(ROOT_DIR, 'standalone.py'))
|
os.path.join(ROOT_DIR, 'bin', 'cgi', 'viewvc.cgi'),
|
||||||
|
os.path.join(ROOT_DIR, 'bin', 'standalone.py'))
|
||||||
|
@@ -359,6 +359,9 @@ hr_ignore_keyword_subst = 1
|
|||||||
#
|
#
|
||||||
hr_intraline = 0
|
hr_intraline = 0
|
||||||
|
|
||||||
|
# allow on-the-fly generation of repository tarballs
|
||||||
|
allow_tar = 0
|
||||||
|
|
||||||
# allow annotation of files.
|
# allow annotation of files.
|
||||||
allow_annotate = 1
|
allow_annotate = 1
|
||||||
|
|
||||||
@@ -459,16 +462,14 @@ highlight_convert_tabs = 2
|
|||||||
use_php = 0
|
use_php = 0
|
||||||
|
|
||||||
# path to php executable
|
# path to php executable
|
||||||
|
# (This should be set to the path of a PHP CLI executable, not the path
|
||||||
|
# to a CGI executable. If you use a CGI executable, you may see "no input file
|
||||||
|
# specified" or "force-cgi-redirect" errors instead of colorized source. The
|
||||||
|
# output of "php -v" tells you whether an given executable is CLI or CGI.)
|
||||||
php_exe_path = php
|
php_exe_path = php
|
||||||
# php_exe_path = /usr/local/bin/php
|
# php_exe_path = /usr/local/bin/php
|
||||||
# php_exe_path = C:\Program Files\php\cli\php.exe
|
# php_exe_path = C:\Program Files\php\cli\php.exe
|
||||||
|
|
||||||
#
|
|
||||||
# ViewVC can generate tarball from a repository on the fly.
|
|
||||||
#
|
|
||||||
allow_tar = 0
|
|
||||||
# allow_tar = 1
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Use CvsGraph. See http://www.akhphd.au.dk/~bertho/cvsgraph/ for
|
# Use CvsGraph. See http://www.akhphd.au.dk/~bertho/cvsgraph/ for
|
||||||
# documentation and download.
|
# documentation and download.
|
||||||
|
@@ -14,7 +14,7 @@ ViewVC requires the Python interpreter which you can download from
|
|||||||
|
|
||||||
and the Python for Windows Extensions which are at
|
and the Python for Windows Extensions which are at
|
||||||
|
|
||||||
http://starship.python.net/crew/mhammond/win32/
|
http://sourceforge.net/projects/pywin32/
|
||||||
|
|
||||||
For CVS support, ViewVC also requires that the CVSNT client (cvs.exe) OR the
|
For CVS support, ViewVC also requires that the CVSNT client (cvs.exe) OR the
|
||||||
RCS tools (rlog.exe, rcsdiff.exe, and co.exe) be installed on your computer.
|
RCS tools (rlog.exe, rcsdiff.exe, and co.exe) be installed on your computer.
|
||||||
@@ -404,7 +404,7 @@ KNOWN ISSUES
|
|||||||
page would always return nothing (leaving the screen blank). There were a
|
page would always return nothing (leaving the screen blank). There were a
|
||||||
number of workarounds for this problem, but the fix is to download and
|
number of workarounds for this problem, but the fix is to download and
|
||||||
install the latest python win32 extensions from
|
install the latest python win32 extensions from
|
||||||
http://starship.python.net/crew/mhammond/win32/Downloads.html
|
http://sourceforge.net/projects/pywin32/
|
||||||
|
|
||||||
- ViewVC can't convert timestamps on diff pages to local time when it is used
|
- ViewVC can't convert timestamps on diff pages to local time when it is used
|
||||||
with CVSNT. This is caused by a CVSNT bug, which is described at
|
with CVSNT. This is caused by a CVSNT bug, which is described at
|
||||||
|
Reference in New Issue
Block a user