mirror of
https://github.com/vitalif/viewvc-4intranet
synced 2019-04-16 04:14:59 +03:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3af8715ce8 | ||
![]() |
97c5a82b7b | ||
![]() |
21bd391d62 | ||
![]() |
9d1476ef1d | ||
![]() |
151fcd05e6 | ||
![]() |
22400ddcfb | ||
![]() |
ae55530edc | ||
![]() |
112700a12c | ||
![]() |
cecffecf39 | ||
![]() |
bdac8697fe | ||
![]() |
3d9404b67d | ||
![]() |
7c50f55153 | ||
![]() |
368e4dc360 | ||
![]() |
964d8bb5f9 | ||
![]() |
846e8e46c5 | ||
![]() |
75c719bcde | ||
![]() |
fc8793bf15 | ||
![]() |
65935c40fd | ||
![]() |
a30d0b44cc | ||
![]() |
fded8462d2 | ||
![]() |
b1095ac763 |
12
CHANGES
12
CHANGES
@@ -1,3 +1,13 @@
|
|||||||
|
Version 1.1.12 (released 03-Nov-2011)
|
||||||
|
|
||||||
|
* fix path display in patch and certain diff views (issue #485)
|
||||||
|
* fix broken cvsdb glob searching (issue 486)
|
||||||
|
* allow svn revision specifiers to have leading r's (issue #441, #448)
|
||||||
|
* allow environmental override of configuration location (issue #494)
|
||||||
|
* fix exception HTML-escaping non-string data under WSGI (issue #454)
|
||||||
|
* add links to root logs from roots view (issue #470)
|
||||||
|
* use Pygments lexer-guessing functionality (issue #495)
|
||||||
|
|
||||||
Version 1.1.11 (released 17-May-2011)
|
Version 1.1.11 (released 17-May-2011)
|
||||||
|
|
||||||
* security fix: remove user-reachable override of cvsdb row limit
|
* security fix: remove user-reachable override of cvsdb row limit
|
||||||
@@ -6,7 +16,7 @@ Version 1.1.11 (released 17-May-2011)
|
|||||||
* fix stack trace when asked to checkout a directory (issue #478)
|
* fix stack trace when asked to checkout a directory (issue #478)
|
||||||
* improve memory usage and speed of revision log markup (issue #477)
|
* improve memory usage and speed of revision log markup (issue #477)
|
||||||
* fix broken annotation view in CVS keyword-bearing files (issue #479)
|
* fix broken annotation view in CVS keyword-bearing files (issue #479)
|
||||||
* warn users when query results are incomplete (issue #443)
|
* warn users when query results are incomplete (issue #433)
|
||||||
* avoid parsing errors on RCS newphrases in the admin section (issue #483)
|
* avoid parsing errors on RCS newphrases in the admin section (issue #483)
|
||||||
* make rlog parsing code more robust in certain error cases (issue #444)
|
* make rlog parsing code more robust in certain error cases (issue #444)
|
||||||
|
|
||||||
|
55
INSTALL
55
INSTALL
@@ -34,7 +34,7 @@ Congratulations on getting this far. :-)
|
|||||||
(http://www.python.org/)
|
(http://www.python.org/)
|
||||||
* Subversion, Version Control System, 1.3.1 or later
|
* Subversion, Version Control System, 1.3.1 or later
|
||||||
(binary installation and Python bindings)
|
(binary installation and Python bindings)
|
||||||
(http://subversion.tigris.org/)
|
(http://subversion.apache.org/)
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
||||||
@@ -176,7 +176,24 @@ APACHE CONFIGURATION
|
|||||||
or /etc/local. Use the vendor documentation or the find utility if
|
or /etc/local. Use the vendor documentation or the find utility if
|
||||||
in doubt.
|
in doubt.
|
||||||
|
|
||||||
2) Configure Apache to expose ViewVC to users at the URL of your choice.
|
2) Depending on how your Apache configuration is setup by default, you
|
||||||
|
might need to explicitly allow high-level access to the ViewVC
|
||||||
|
install location.
|
||||||
|
|
||||||
|
<Directory <VIEWVC_INSTALLATION_DIRECTORY>>
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
For example, if ViewVC is installed in /usr/local/viewvc-1.0 on
|
||||||
|
your system:
|
||||||
|
|
||||||
|
<Directory /usr/local/viewvc-1.0>
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
3) Configure Apache to expose ViewVC to users at the URL of your choice.
|
||||||
|
|
||||||
ViewVC provides several different ways to do this. Choose one of
|
ViewVC provides several different ways to do this. Choose one of
|
||||||
the following methods:
|
the following methods:
|
||||||
@@ -187,13 +204,13 @@ APACHE CONFIGURATION
|
|||||||
The ScriptAlias directive is very useful for pointing
|
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>/bin/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/bin/cgi/viewvc.cgi
|
ScriptAlias /viewvc /usr/local/viewvc-1.0/bin/cgi/viewvc.cgi
|
||||||
ScriptAlias /query /usr/local/viewvc-1.0/bin/cgi/query.cgi
|
ScriptAlias /query /usr/local/viewvc-1.0/bin/cgi/query.cgi
|
||||||
|
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
METHOD B: CGI mode in cgi-bin directory
|
METHOD B: CGI mode in cgi-bin directory
|
||||||
@@ -201,6 +218,10 @@ APACHE CONFIGURATION
|
|||||||
Copy the CGI scripts from
|
Copy the CGI scripts from
|
||||||
<VIEWVC_INSTALLATION_DIRECTORY>/bin/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.
|
||||||
|
|
||||||
|
You can override configuration file location using:
|
||||||
|
|
||||||
|
SetEnv VIEWVC_CONF_PATHNAME /etc/viewvc.conf
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
METHOD C: CGI mode in ExecCGI'd directory
|
METHOD C: CGI mode in ExecCGI'd directory
|
||||||
@@ -210,8 +231,8 @@ APACHE CONFIGURATION
|
|||||||
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:
|
||||||
|
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
AddHandler cgi-script .cgi
|
AddHandler cgi-script .cgi
|
||||||
|
|
||||||
Note: For this to work mod_cgi has to be loaded. And for the .htaccess file
|
Note: For this to work mod_cgi has to be loaded. And for the .htaccess file
|
||||||
to be effective, "AllowOverride All" or "AllowOverride Options FileInfo"
|
to be effective, "AllowOverride All" or "AllowOverride Options FileInfo"
|
||||||
@@ -227,6 +248,10 @@ APACHE CONFIGURATION
|
|||||||
In httpd.conf, make sure that "AllowOverride All" or at least
|
In httpd.conf, make sure that "AllowOverride All" or at least
|
||||||
"AllowOverride FileInfo Options" are enabled for the directory
|
"AllowOverride FileInfo Options" are enabled for the directory
|
||||||
you copied the files to.
|
you copied the files to.
|
||||||
|
|
||||||
|
You can override configuration file location using:
|
||||||
|
|
||||||
|
SetEnv VIEWVC_CONF_PATHNAME /etc/viewvc.conf
|
||||||
|
|
||||||
Note: If you are using Mod_Python under Apache 1.3 the tarball generation
|
Note: If you are using Mod_Python under Apache 1.3 the tarball generation
|
||||||
feature may not work because it uses multithreading. This works fine
|
feature may not work because it uses multithreading. This works fine
|
||||||
@@ -278,13 +303,6 @@ APACHE CONFIGURATION
|
|||||||
ScriptAlias /viewvc /usr/local/viewvc/bin/wsgi/viewvc.fcgi
|
ScriptAlias /viewvc /usr/local/viewvc/bin/wsgi/viewvc.fcgi
|
||||||
ScriptAlias /query /usr/local/viewvc/bin/wsgi/query.fcgi
|
ScriptAlias /query /usr/local/viewvc/bin/wsgi/query.fcgi
|
||||||
|
|
||||||
3) Restart Apache.
|
|
||||||
|
|
||||||
The commands to do this vary. "httpd -k restart" and "apache -k
|
|
||||||
restart" are two common variants. On RedHat Linux it is done using
|
|
||||||
the command "/sbin/service httpd restart" and on SuSE Linux it is
|
|
||||||
done with "rcapache restart". Other systems use "apachectl restart".
|
|
||||||
|
|
||||||
4) [Optional] Add access control.
|
4) [Optional] Add access control.
|
||||||
|
|
||||||
In your httpd.conf you can control access to certain modules by
|
In your httpd.conf you can control access to certain modules by
|
||||||
@@ -306,7 +324,14 @@ APACHE CONFIGURATION
|
|||||||
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
|
||||||
|
|
||||||
5) Optional: Protect your ViewVC instance from server-whacking webcrawlers.
|
5) Restart Apache.
|
||||||
|
|
||||||
|
The commands to do this vary. "httpd -k restart" and "apache -k
|
||||||
|
restart" are two common variants. On RedHat Linux it is done using
|
||||||
|
the command "/sbin/service httpd restart" and on SuSE Linux it is
|
||||||
|
done with "rcapache restart". Other systems use "apachectl restart".
|
||||||
|
|
||||||
|
6) Optional: Protect your ViewVC instance from server-whacking webcrawlers.
|
||||||
|
|
||||||
As ViewVC is a web-based application which each page containing various
|
As ViewVC is a web-based application which each page containing various
|
||||||
links to other pages and views, you can expect your server's performance
|
links to other pages and views, you can expect your server's performance
|
||||||
|
@@ -288,7 +288,7 @@ def usage():
|
|||||||
located at REPOS-PATH.
|
located at REPOS-PATH.
|
||||||
|
|
||||||
Usage: 1. %s [-v] rebuild REPOS-PATH
|
Usage: 1. %s [-v] rebuild REPOS-PATH
|
||||||
2. %s [-v] update REPOS-PATH [REV:[REV2]] [--force]
|
2. %s [-v] update REPOS-PATH [REV[:REV2]] [--force]
|
||||||
3. %s [-v] purge REPOS-PATH
|
3. %s [-v] purge REPOS-PATH
|
||||||
|
|
||||||
1. Rebuild the commit database information for the repository located
|
1. Rebuild the commit database information for the repository located
|
||||||
|
@@ -345,7 +345,43 @@
|
|||||||
## allowed_views: List the ViewVC views which are enabled. Views not
|
## allowed_views: List the ViewVC views which are enabled. Views not
|
||||||
## in this comma-delited list will not be served (or, will return an
|
## in this comma-delited list will not be served (or, will return an
|
||||||
## error on attempted access).
|
## error on attempted access).
|
||||||
## Possible values: "annotate", "co", "diff", "markup", "roots", "tar"
|
##
|
||||||
|
## Valid items for this list include: "annotate", "co", "diff", "markup",
|
||||||
|
## "roots", "tar".
|
||||||
|
##
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## VIEW | DESCRIPTION
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## annotate | The 'annotate' view shows the contents of a single
|
||||||
|
## | revision of a versioned file in exactly the same way as
|
||||||
|
## | the markup view, but with additional line-by-line
|
||||||
|
## | change attribution (the revision number, author, etc.
|
||||||
|
## | the most recent edit to that line of text as of the
|
||||||
|
## | displayed version).
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## co | The 'co' (aka "checkout" or "download") view isn't
|
||||||
|
## | really a branded view at all, but allows for direct
|
||||||
|
## | downloading of the contents of a single revision of a
|
||||||
|
## | versioned file.
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## diff | The 'diff' view displays line-based differences between
|
||||||
|
## | two revisions of a versioned file in a variety of
|
||||||
|
## | different user-selectable formats.
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## markup | The 'markup' view shows the contents of a single
|
||||||
|
## | revision of a versioned file, with syntax highlighting
|
||||||
|
## | where possible and enabled. It can also optionally
|
||||||
|
## | show change log information for that revision of the
|
||||||
|
## | file.
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## roots | The 'roots' view is a simple listing of the various
|
||||||
|
## | repositories which ViewVC has been configured to serve
|
||||||
|
## | to users.
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
|
## tar | The 'tar' view isn't a branded view, but generates
|
||||||
|
## | a GNU Tar archive file containing a single versioned
|
||||||
|
## | directory and its contents (recursively).
|
||||||
|
## ----------+---------------------------------------------------------
|
||||||
##
|
##
|
||||||
#allowed_views = annotate, diff, markup, roots
|
#allowed_views = annotate, diff, markup, roots
|
||||||
|
|
||||||
@@ -603,7 +639,13 @@
|
|||||||
#short_log_len = 80
|
#short_log_len = 80
|
||||||
|
|
||||||
## enable_syntax_coloration: Should we colorize known file content
|
## enable_syntax_coloration: Should we colorize known file content
|
||||||
## syntaxes? [Requires Pygments Python module]
|
## syntaxes?
|
||||||
|
##
|
||||||
|
## NOTE: This feature requires the Pygments Python module
|
||||||
|
## (http://pygments.org) and works only when ViewVC can determine the
|
||||||
|
## MIME content type of the file whose contents it wishes to colorize.
|
||||||
|
## Use the 'mime_types_files' configuration option to specify MIME
|
||||||
|
## type mapping files useful for making that determination.
|
||||||
##
|
##
|
||||||
#enable_syntax_coloration = 1
|
#enable_syntax_coloration = 1
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>ViewVC 1.0 Template Authoring Guide</title>
|
<title>ViewVC 1.1 Template Authoring Guide</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: rgb(180,193,205);
|
background-color: rgb(180,193,205);
|
||||||
@@ -38,13 +38,13 @@ td {
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>ViewVC 1.0 Template Authoring Guide</h1>
|
<h1>ViewVC 1.1 Template Authoring Guide</h1>
|
||||||
|
|
||||||
<div class="h2">
|
<div class="h2">
|
||||||
<h2 id="introduction">Introduction</h2>
|
<h2 id="introduction">Introduction</h2>
|
||||||
|
|
||||||
<p>This document represents an (unfinished) attempt at providing
|
<p>This document represents an (unfinished) attempt at providing
|
||||||
documentation for how to customize ViewVC 1.0-dev's HTML output via
|
instructions for how to customize ViewVC's HTML output via
|
||||||
modification of its templates.</p>
|
modification of its templates.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -802,6 +802,11 @@ td {
|
|||||||
<td>String</td>
|
<td>String</td>
|
||||||
<td>This is a URL for the markup view of the left file.</td>
|
<td>This is a URL for the markup view of the left file.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="varlevel1">
|
||||||
|
<td class="varname">patch_href</td>
|
||||||
|
<td>String</td>
|
||||||
|
<td>URL of the patch view for the file.</td>
|
||||||
|
</tr>
|
||||||
<tr class="varlevel1">
|
<tr class="varlevel1">
|
||||||
<td class="varname">raw_diff</td>
|
<td class="varname">raw_diff</td>
|
||||||
<td>String</td>
|
<td>String</td>
|
||||||
@@ -2178,6 +2183,12 @@ td {
|
|||||||
<td>String</td>
|
<td>String</td>
|
||||||
<td>Log message of last modification to the root.</td>
|
<td>Log message of last modification to the root.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="varlevel2">
|
||||||
|
<td class="varname">roots.log_href</td>
|
||||||
|
<td>String</td>
|
||||||
|
<td>URL of log revision view for the top-most (root) directory of
|
||||||
|
the root (repository).</td>
|
||||||
|
</tr>
|
||||||
<tr class="varlevel2">
|
<tr class="varlevel2">
|
||||||
<td class="varname">roots.name</td>
|
<td class="varname">roots.name</td>
|
||||||
<td>String</td>
|
<td>String</td>
|
||||||
|
12
lib/cvsdb.py
12
lib/cvsdb.py
@@ -352,9 +352,17 @@ class CheckinDatabase:
|
|||||||
match = " LIKE "
|
match = " LIKE "
|
||||||
elif query_entry.match == "glob":
|
elif query_entry.match == "glob":
|
||||||
match = " REGEXP "
|
match = " REGEXP "
|
||||||
# use fnmatch to translate the glob into a regexp
|
# Use fnmatch to translate the glob into a regular
|
||||||
|
# expression. Sadly, we have to account for the fact
|
||||||
|
# that in Python 2.6, fnmatch.translate() started
|
||||||
|
# sticking '\Z(?ms)' at the end of the regular
|
||||||
|
# expression instead of just '$', and doesn't prepend
|
||||||
|
# the '^'.
|
||||||
data = fnmatch.translate(data)
|
data = fnmatch.translate(data)
|
||||||
if data[0] != '^': data = '^' + data
|
if data[0] != '^':
|
||||||
|
data = '^' + data
|
||||||
|
if data[-7:] == '\Z(?ms)':
|
||||||
|
data = data[:-7] + '$'
|
||||||
elif query_entry.match == "regex":
|
elif query_entry.match == "regex":
|
||||||
match = " REGEXP "
|
match = " REGEXP "
|
||||||
elif query_entry.match == "notregex":
|
elif query_entry.match == "notregex":
|
||||||
|
@@ -233,9 +233,6 @@ class WsgiServer(Server):
|
|||||||
self.header(status='301 Moved')
|
self.header(status='301 Moved')
|
||||||
self._wsgi_write('This document is located <a href="%s">here</a>.' % url)
|
self._wsgi_write('This document is located <a href="%s">here</a>.' % url)
|
||||||
|
|
||||||
def escape(self, s, quote = None):
|
|
||||||
return cgi.escape(s, quote)
|
|
||||||
|
|
||||||
def getenv(self, name, value=None):
|
def getenv(self, name, value=None):
|
||||||
return self._environ.get(name, value)
|
return self._environ.get(name, value)
|
||||||
|
|
||||||
|
@@ -407,8 +407,11 @@ class RemoteSubversionRepository(vclib.Repository):
|
|||||||
if rev is None or rev == 'HEAD':
|
if rev is None or rev == 'HEAD':
|
||||||
return self.youngest
|
return self.youngest
|
||||||
try:
|
try:
|
||||||
|
if type(rev) == type(''):
|
||||||
|
while rev[0] == 'r':
|
||||||
|
rev = rev[1:]
|
||||||
rev = int(rev)
|
rev = int(rev)
|
||||||
except ValueError:
|
except:
|
||||||
raise vclib.InvalidRevision(rev)
|
raise vclib.InvalidRevision(rev)
|
||||||
if (rev < 0) or (rev > self.youngest):
|
if (rev < 0) or (rev > self.youngest):
|
||||||
raise vclib.InvalidRevision(rev)
|
raise vclib.InvalidRevision(rev)
|
||||||
|
@@ -809,8 +809,11 @@ class LocalSubversionRepository(vclib.Repository):
|
|||||||
if rev is None or rev == 'HEAD':
|
if rev is None or rev == 'HEAD':
|
||||||
return self.youngest
|
return self.youngest
|
||||||
try:
|
try:
|
||||||
|
if type(rev) == type(''):
|
||||||
|
while rev[0] == 'r':
|
||||||
|
rev = rev[1:]
|
||||||
rev = int(rev)
|
rev = int(rev)
|
||||||
except ValueError:
|
except:
|
||||||
raise vclib.InvalidRevision(rev)
|
raise vclib.InvalidRevision(rev)
|
||||||
if (rev < 0) or (rev > self.youngest):
|
if (rev < 0) or (rev > self.youngest):
|
||||||
raise vclib.InvalidRevision(rev)
|
raise vclib.InvalidRevision(rev)
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#
|
#
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
|
||||||
__version__ = '1.1.11-dev'
|
__version__ = '1.1.12'
|
||||||
|
|
||||||
# this comes from our library; measure the startup time
|
# this comes from our library; measure the startup time
|
||||||
import debug
|
import debug
|
||||||
@@ -1567,13 +1567,15 @@ def markup_stream_pygments(request, cfg, blame_data, fp, filename,
|
|||||||
blame_data = blame_source
|
blame_data = blame_source
|
||||||
lexer = None
|
lexer = None
|
||||||
use_pygments = cfg.options.enable_syntax_coloration
|
use_pygments = cfg.options.enable_syntax_coloration
|
||||||
|
first_line = None
|
||||||
try:
|
try:
|
||||||
from pygments import highlight
|
from pygments import highlight
|
||||||
from pygments.formatters import HtmlFormatter
|
from pygments.formatters import HtmlFormatter
|
||||||
from pygments.lexers import ClassNotFound, \
|
from pygments.lexers import ClassNotFound, \
|
||||||
get_lexer_by_name, \
|
get_lexer_by_name, \
|
||||||
get_lexer_for_mimetype, \
|
get_lexer_for_mimetype, \
|
||||||
get_lexer_for_filename
|
get_lexer_for_filename, \
|
||||||
|
guess_lexer
|
||||||
if not encoding:
|
if not encoding:
|
||||||
encoding = 'guess'
|
encoding = 'guess'
|
||||||
if cfg.options.detect_encoding:
|
if cfg.options.detect_encoding:
|
||||||
@@ -1594,7 +1596,12 @@ def markup_stream_pygments(request, cfg, blame_data, fp, filename,
|
|||||||
tabsize=cfg.options.tabsize,
|
tabsize=cfg.options.tabsize,
|
||||||
stripnl=False)
|
stripnl=False)
|
||||||
except ClassNotFound:
|
except ClassNotFound:
|
||||||
use_pygments = 0
|
try:
|
||||||
|
first_line = fp.readline()
|
||||||
|
lexer = guess_lexer(first_line)
|
||||||
|
use_pygments = 1
|
||||||
|
except ClassNotFound:
|
||||||
|
use_pygments = 0
|
||||||
except ImportError:
|
except ImportError:
|
||||||
use_pygments = 0
|
use_pygments = 0
|
||||||
|
|
||||||
@@ -1617,7 +1624,11 @@ def markup_stream_pygments(request, cfg, blame_data, fp, filename,
|
|||||||
lines = []
|
lines = []
|
||||||
line_no = 0
|
line_no = 0
|
||||||
while 1:
|
while 1:
|
||||||
line = fp.readline()
|
if first_line is not None:
|
||||||
|
line = first_line
|
||||||
|
first_line = None
|
||||||
|
else:
|
||||||
|
line = fp.readline()
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
line_no = line_no + 1
|
line_no = line_no + 1
|
||||||
@@ -1650,7 +1661,7 @@ def markup_stream_pygments(request, cfg, blame_data, fp, filename,
|
|||||||
self.blame_data.append(item)
|
self.blame_data.append(item)
|
||||||
self.line_no = self.line_no + 1
|
self.line_no = self.line_no + 1
|
||||||
ps = PygmentsSink(blame_source)
|
ps = PygmentsSink(blame_source)
|
||||||
highlight(fp.read(), lexer,
|
highlight((first_line or '') + fp.read(), lexer,
|
||||||
HtmlFormatter(nowrap=True,
|
HtmlFormatter(nowrap=True,
|
||||||
classprefix="pygments-",
|
classprefix="pygments-",
|
||||||
encoding='utf-8'), ps)
|
encoding='utf-8'), ps)
|
||||||
@@ -1922,20 +1933,27 @@ def view_roots(request):
|
|||||||
rootnames = allroots.keys()
|
rootnames = allroots.keys()
|
||||||
rootnames.sort(icmp)
|
rootnames.sort(icmp)
|
||||||
for rootname in rootnames:
|
for rootname in rootnames:
|
||||||
|
root_path, root_type, lastmod = allroots[rootname]
|
||||||
href = request.get_url(view_func=view_directory,
|
href = request.get_url(view_func=view_directory,
|
||||||
where='', pathtype=vclib.DIR,
|
where='', pathtype=vclib.DIR,
|
||||||
params={'root': rootname}, escape=1)
|
params={'root': rootname}, escape=1)
|
||||||
lastmod = allroots[rootname][2]
|
if root_type == vclib.SVN:
|
||||||
|
log_href = request.get_url(view_func=view_log,
|
||||||
|
where='', pathtype=vclib.DIR,
|
||||||
|
params={'root': rootname}, escape=1)
|
||||||
|
else:
|
||||||
|
log_href = None
|
||||||
roots.append(_item(name=request.server.escape(rootname),
|
roots.append(_item(name=request.server.escape(rootname),
|
||||||
type=allroots[rootname][1],
|
type=root_type,
|
||||||
path=allroots[rootname][0],
|
path=root_path,
|
||||||
author=lastmod and lastmod.author or None,
|
author=lastmod and lastmod.author or None,
|
||||||
ago=lastmod and lastmod.ago or None,
|
ago=lastmod and lastmod.ago or None,
|
||||||
date=lastmod and lastmod.date or None,
|
date=lastmod and lastmod.date or None,
|
||||||
log=lastmod and lastmod.log or None,
|
log=lastmod and lastmod.log or None,
|
||||||
short_log=lastmod and lastmod.short_log or None,
|
short_log=lastmod and lastmod.short_log or None,
|
||||||
rev=lastmod and lastmod.rev or None,
|
rev=lastmod and lastmod.rev or None,
|
||||||
href=href))
|
href=href,
|
||||||
|
log_href=log_href))
|
||||||
|
|
||||||
data = common_template_data(request)
|
data = common_template_data(request)
|
||||||
data.merge(ezt.TemplateData({
|
data.merge(ezt.TemplateData({
|
||||||
@@ -2986,7 +3004,8 @@ class DiffSource:
|
|||||||
class DiffSequencingError(Exception):
|
class DiffSequencingError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def diff_parse_headers(fp, diff_type, rev1, rev2, sym1=None, sym2=None):
|
def diff_parse_headers(fp, diff_type, path1, path2, rev1, rev2,
|
||||||
|
sym1=None, sym2=None):
|
||||||
date1 = date2 = log_rev1 = log_rev2 = flag = None
|
date1 = date2 = log_rev1 = log_rev2 = flag = None
|
||||||
header_lines = []
|
header_lines = []
|
||||||
|
|
||||||
@@ -3015,15 +3034,15 @@ def diff_parse_headers(fp, diff_type, rev1, rev2, sym1=None, sym2=None):
|
|||||||
if match:
|
if match:
|
||||||
date1 = match.group(1)
|
date1 = match.group(1)
|
||||||
log_rev1 = match.group(2)
|
log_rev1 = match.group(2)
|
||||||
if sym1:
|
line = '%s%s\t%s\t%s%s\n' % (f1, path1, date1, log_rev1,
|
||||||
line = line[:-1] + ' %s\n' % sym1
|
sym1 and ' ' + sym1 or '')
|
||||||
elif line[:len(f2)] == f2:
|
elif line[:len(f2)] == f2:
|
||||||
match = _re_extract_rev.match(line)
|
match = _re_extract_rev.match(line)
|
||||||
if match:
|
if match:
|
||||||
date2 = match.group(1)
|
date2 = match.group(1)
|
||||||
log_rev2 = match.group(2)
|
log_rev2 = match.group(2)
|
||||||
if sym2:
|
line = '%s%s\t%s\t%s%s\n' % (f2, path2, date2, log_rev2,
|
||||||
line = line[:-1] + ' %s\n' % sym2
|
sym2 and ' ' + sym2 or '')
|
||||||
parsing = 0
|
parsing = 0
|
||||||
elif line[:3] == 'Bin':
|
elif line[:3] == 'Bin':
|
||||||
flag = _RCSDIFF_IS_BINARY
|
flag = _RCSDIFF_IS_BINARY
|
||||||
@@ -3151,8 +3170,11 @@ def view_patch(request):
|
|||||||
raise debug.ViewVCException('Invalid path(s) or revision(s) passed '
|
raise debug.ViewVCException('Invalid path(s) or revision(s) passed '
|
||||||
'to diff', '400 Bad Request')
|
'to diff', '400 Bad Request')
|
||||||
|
|
||||||
date1, date2, flag, headers = diff_parse_headers(fp, diff_type, rev1, rev2,
|
path_left = _path_join(p1)
|
||||||
sym1, sym2)
|
path_right = _path_join(p2)
|
||||||
|
date1, date2, flag, headers = diff_parse_headers(fp, diff_type,
|
||||||
|
path_left, path_right,
|
||||||
|
rev1, rev2, sym1, sym2)
|
||||||
|
|
||||||
server_fp = get_writeready_server_file(request, 'text/plain')
|
server_fp = get_writeready_server_file(request, 'text/plain')
|
||||||
server_fp.write(headers)
|
server_fp.write(headers)
|
||||||
@@ -3248,6 +3270,7 @@ def view_diff(request):
|
|||||||
changes = []
|
changes = []
|
||||||
if fp:
|
if fp:
|
||||||
date1, date2, flag, headers = diff_parse_headers(fp, diff_type,
|
date1, date2, flag, headers = diff_parse_headers(fp, diff_type,
|
||||||
|
path_left, path_right,
|
||||||
rev1, rev2, sym1, sym2)
|
rev1, rev2, sym1, sym2)
|
||||||
if human_readable:
|
if human_readable:
|
||||||
if flag is not None:
|
if flag is not None:
|
||||||
@@ -4405,14 +4428,35 @@ def locate_root(cfg, rootname):
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
def load_config(pathname=None, server=None):
|
def load_config(pathname=None, server=None):
|
||||||
|
"""Load the ViewVC configuration file. SERVER is the server object
|
||||||
|
that will be using this configuration. Consult the environment for
|
||||||
|
the variable VIEWVC_CONF_PATHNAME and VIEWCVS_CONF_PATHNAME (its
|
||||||
|
legacy name) and, if set, use its value as the path of the
|
||||||
|
configuration file; otherwise, use PATHNAME (if provided). Failing
|
||||||
|
all else, use a hardcoded default configuration path."""
|
||||||
|
|
||||||
debug.t_start('load-config')
|
debug.t_start('load-config')
|
||||||
|
|
||||||
if pathname is None:
|
# See if the environment contains overrides to the configuration
|
||||||
pathname = (os.environ.get("VIEWVC_CONF_PATHNAME")
|
# path. If we have a SERVER object, consult its environment; use
|
||||||
or os.environ.get("VIEWCVS_CONF_PATHNAME")
|
# the OS environment otherwise.
|
||||||
or os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
env_pathname = None
|
||||||
"viewvc.conf"))
|
if server is not None:
|
||||||
|
env_pathname = (server.getenv("VIEWVC_CONF_PATHNAME")
|
||||||
|
or server.getenv("VIEWCVS_CONF_PATHNAME"))
|
||||||
|
else:
|
||||||
|
env_pathname = (os.environ.get("VIEWVC_CONF_PATHNAME")
|
||||||
|
or os.environ.get("VIEWCVS_CONF_PATHNAME"))
|
||||||
|
|
||||||
|
# Try to find the configuration pathname by searching these ordered
|
||||||
|
# locations: the environment, the passed-in PATHNAME, the hard-coded
|
||||||
|
# default.
|
||||||
|
pathname = (env_pathname
|
||||||
|
or pathname
|
||||||
|
or os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||||
|
"viewvc.conf"))
|
||||||
|
|
||||||
|
# Load the configuration!
|
||||||
cfg = config.Config()
|
cfg = config.Config()
|
||||||
cfg.set_defaults()
|
cfg.set_defaults()
|
||||||
cfg.load_config(pathname, server and server.getenv("HTTP_HOST"))
|
cfg.load_config(pathname, server and server.getenv("HTTP_HOST"))
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
[roots.name]</a>
|
[roots.name]</a>
|
||||||
</td>
|
</td>
|
||||||
[is cfg.options.show_roots_lastmod "1"]
|
[is cfg.options.show_roots_lastmod "1"]
|
||||||
<td style="width:20"> [roots.rev]</td>
|
<td style="width:20"> [if-any roots.log_href]<a href="[roots.log_href]">[roots.rev]</a>[else][roots.rev][end]</td>
|
||||||
<td style="width:20"> [roots.ago]</td>
|
<td style="width:20"> [roots.ago]</td>
|
||||||
<td style="width:20"> [roots.author]</td>
|
<td style="width:20"> [roots.author]</td>
|
||||||
<td style="width:20"> [roots.short_log]</td>
|
<td style="width:20"> [roots.short_log]</td>
|
||||||
|
@@ -209,6 +209,8 @@ def install_file(src_path, dst_path, mode, subst_path_vars,
|
|||||||
temp = raw_input("Do you want to [O]verwrite, [D]o "
|
temp = raw_input("Do you want to [O]verwrite, [D]o "
|
||||||
"not overwrite, or [V]iew "
|
"not overwrite, or [V]iew "
|
||||||
"differences? ")
|
"differences? ")
|
||||||
|
if len(temp) == 0:
|
||||||
|
continue
|
||||||
temp = string.lower(temp[0])
|
temp = string.lower(temp[0])
|
||||||
if temp == "v" and ext not in BINARY_FILE_EXTS:
|
if temp == "v" and ext not in BINARY_FILE_EXTS:
|
||||||
print """
|
print """
|
||||||
|
Reference in New Issue
Block a user