mirror of
https://github.com/vitalif/viewvc-4intranet
synced 2019-04-16 04:14:59 +03:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a67b467261 | ||
![]() |
5135318425 |
15
CHANGES
15
CHANGES
@@ -1,18 +1,3 @@
|
||||
Version 1.0.3 (released 13-Oct-2006)
|
||||
|
||||
* fix bug in path shown for Subversion deleted-under-copy items (issue #265)
|
||||
* security fix: declare charset for views to avoid IE UTF7 XSS attack
|
||||
|
||||
Version 1.0.2 (released 29-Sep-2006)
|
||||
|
||||
* minor documentation fixes
|
||||
* fix Subversion annotate functionality on Windows (issue #18)
|
||||
* fix annotate assertions on uncanonicalized #include paths (issue #208)
|
||||
* make RSS URL method match the method used to generate it (issue #245)
|
||||
* fix Subversion annotation to run non-interactively, preventing hangs
|
||||
* fix bug in custom syntax highlighter fallback logic
|
||||
* fix bug in PHP CGI hack to avoid force-cgi-redirect errors
|
||||
|
||||
Version 1.0.1 (released 20-Jul-2006)
|
||||
|
||||
* fix exception on log page when use_pagesize is enabled
|
||||
|
34
INSTALL
34
INSTALL
@@ -64,10 +64,10 @@ Congratulations on getting this far. :-)
|
||||
To start installing right away (on UNIX): type "./viewvc-install"
|
||||
in the current directory and answer the prompts. When it
|
||||
finishes, edit the file viewvc.conf in the installation directory
|
||||
to tell viewvc the paths to your CVS and Subversion repositories.
|
||||
Next, configure your web server (in the way appropriate to that browser)
|
||||
to run <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi. The section
|
||||
`INSTALLING VIEWVC' below is still recommended reading.
|
||||
to tell viewvc the paths to your CVS and Subversion repositories. Next,
|
||||
configure your web server to run <INSTALL>/cgi/viewvc.cgi, as
|
||||
appropriate for your web server. The section `INSTALLING VIEWVC'
|
||||
below is still recommended reading.
|
||||
|
||||
|
||||
INSTALLING VIEWVC
|
||||
@@ -118,12 +118,12 @@ installation instructions.
|
||||
then edit the files in <VIEWVC_INSTALLATION_DIRECTORY>/templates.
|
||||
You need knowledge about HTML to edit the templates.
|
||||
|
||||
4) The CGI programs are in <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/. You can
|
||||
4) The CGI programs are in <VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/. You can
|
||||
symlink to this directory from somewhere in your published HTTP server
|
||||
path if your webserver is configured to follow symbolic links. You can
|
||||
also copy the installed <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
|
||||
also copy the installed <VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/*.cgi
|
||||
scripts after the install (unlike the other files in ViewVC, the scripts
|
||||
under bin/ can be moved).
|
||||
under www/ can be moved).
|
||||
|
||||
If you are using Apache, then see below at the section
|
||||
titled APACHE CONFIGURATION.
|
||||
@@ -149,26 +149,26 @@ Either METHOD A:
|
||||
2) The ScriptAlias directive is very useful for pointing
|
||||
directly to the viewvc.cgi script. Simply insert a line containing
|
||||
|
||||
ScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi
|
||||
ScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/viewvc.cgi
|
||||
|
||||
into your httpd.conf file. Choose the location in httpd.conf where
|
||||
also the other ScriptAlias lines reside. Some examples:
|
||||
|
||||
ScriptAlias /viewvc /usr/local/viewvc-1.0/bin/cgi/viewvc.cgi
|
||||
ScriptAlias /query /usr/local/viewvc-1.0/bin/cgi/query.cgi
|
||||
ScriptAlias /viewvc /usr/local/viewvc-1.0/www/cgi/viewvc.cgi
|
||||
ScriptAlias /query /usr/local/viewvc-1.0/www/cgi/query.cgi
|
||||
|
||||
continue with step 3).
|
||||
|
||||
or alternatively METHOD B:
|
||||
2) Copy the CGI scripts from
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/*.cgi
|
||||
to the /cgi-bin/ directory configured in your httpd.conf file.
|
||||
|
||||
continue with step 3).
|
||||
|
||||
and then there's METHOD C:
|
||||
2) Copy the CGI scripts from
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/www/cgi/*.cgi
|
||||
to the directory of your choosing in the Document Root adding the following
|
||||
apache directives for the directory in httpd.conf or an .htaccess file:
|
||||
|
||||
@@ -183,7 +183,7 @@ and then there's METHOD C:
|
||||
|
||||
or if you've got Mod_Python installed you can use METHOD D:
|
||||
2) Copy the Python scripts and .htaccess file from
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/bin/mod_python/
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/www/mod_python/
|
||||
to a directory being served by apache.
|
||||
|
||||
In httpd.conf, make sure that "AllowOverride All" or at least
|
||||
@@ -246,7 +246,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
|
||||
database.
|
||||
|
||||
3) Run the <VIEWVC_INSTALLATION_DIRECTORY>/bin/make-database script. It will
|
||||
3) Run the <VIEWVC_INSTALLATION_DIRECTORY>/make-database script. It will
|
||||
prompt you for your MySQL user, password, and the name of database you
|
||||
want to create. The database name defaults to "ViewVC". This script
|
||||
creates the database and sets up the empty tables. If you run this on a
|
||||
@@ -285,7 +285,7 @@ there are some additional steps required to get the database working.
|
||||
To get real-time updates, you'll want to checkout the CVSROOT module
|
||||
from your CVS repository and edit CVSROOT/loginfo. Add the line:
|
||||
|
||||
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv}
|
||||
ALL <VIEWVC_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv}
|
||||
|
||||
If you have other scripts invoked by CVSROOT/loginfo, you will want
|
||||
to make sure to change any running under the "DEFAULT" keyword to
|
||||
@@ -295,7 +295,7 @@ there are some additional steps required to get the database working.
|
||||
If you are running the Unix port of CVS-NT, you'll need to use a
|
||||
slightly different command line:
|
||||
|
||||
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv} cvsnt
|
||||
ALL <VIEWVC_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv} cvsnt
|
||||
|
||||
The extra 'cvsnt' parameter tells the handler script to parse the
|
||||
commit information in a different way.
|
||||
@@ -316,7 +316,7 @@ there are some additional steps required to get the database working.
|
||||
#!/bin/sh
|
||||
REPOS="$1"
|
||||
REV="$2"
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/bin/svndbadmin rebuild "$REPOS" "$REV"
|
||||
<VIEWVC_INSTALLATION_DIRECTORY>/svndbadmin rebuild "$REPOS" "$REV"
|
||||
|
||||
If you allow revision property changes in your repository, create a
|
||||
post-revprop-change hook script containing the same commands as the
|
||||
|
35
lib/blame.py
35
lib/blame.py
@@ -42,28 +42,25 @@ def link_includes(text, repos, path_parts, include_url):
|
||||
match = re_includes.match(text)
|
||||
if match:
|
||||
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)
|
||||
|
||||
include_path = None
|
||||
try:
|
||||
if repos.itemtype(include_path_parts, None) == vclib.FILE:
|
||||
include_path = string.join(include_path_parts, '/')
|
||||
except vclib.ItemNotFound:
|
||||
pass
|
||||
# check current directory and parent directory for file
|
||||
for depth in (-1, -2):
|
||||
include_path = path_parts[:depth] + [incfile]
|
||||
try:
|
||||
# will throw if path doesn't exist
|
||||
if repos.itemtype(include_path, None) == vclib.FILE:
|
||||
break
|
||||
except vclib.ItemNotFound:
|
||||
pass
|
||||
else:
|
||||
include_path = None
|
||||
|
||||
if include_path:
|
||||
return '#%sinclude%s<a href="%s">"%s"</a>' % \
|
||||
(match.group(1), match.group(2),
|
||||
string.replace(include_url, '/WHERE/', include_path), incfile)
|
||||
|
||||
url = string.replace(include_url, '/WHERE/',
|
||||
string.join(include_path, '/'))
|
||||
return '#%sinclude%s<a href="%s">"%s"</a>' % \
|
||||
(match.group(1), match.group(2), url, incfile)
|
||||
|
||||
return text
|
||||
|
||||
|
||||
|
@@ -135,7 +135,7 @@ class CgiServer(Server):
|
||||
def addheader(self, name, value):
|
||||
self.headers.append((name, value))
|
||||
|
||||
def header(self, content_type='text/html; charset=UTF-8', status=None):
|
||||
def header(self, content_type='text/html', status=None):
|
||||
if not self.headerSent:
|
||||
self.headerSent = 1
|
||||
|
||||
@@ -209,10 +209,7 @@ class AspServer(ThreadedServer):
|
||||
if not self.headerSent:
|
||||
try:
|
||||
self.headerSent = 1
|
||||
if content_type is None:
|
||||
self.response.ContentType = 'text/html; charset=UTF-8'
|
||||
else:
|
||||
self.response.ContentType = content_type
|
||||
if content_type is not None: self.response.ContentType = content_type
|
||||
if status is not None: self.response.Status = status
|
||||
except AttributeError:
|
||||
pass
|
||||
@@ -293,7 +290,7 @@ class ModPythonServer(ThreadedServer):
|
||||
|
||||
def header(self, content_type=None, status=None):
|
||||
if content_type is None:
|
||||
self.request.content_type = 'text/html; charset=UTF-8'
|
||||
self.request.content_type = 'text/html'
|
||||
else:
|
||||
self.request.content_type = content_type
|
||||
self.headerSent = 1
|
||||
|
@@ -270,70 +270,62 @@ class ChangedPath:
|
||||
self.is_copy = is_copy
|
||||
|
||||
|
||||
def get_revision_info(svnrepos, rev):
|
||||
fsroot = svnrepos._getroot(rev)
|
||||
class ChangedPathSet:
|
||||
def __init__(self):
|
||||
self.changes = { }
|
||||
|
||||
# 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]
|
||||
def add_change(self, change):
|
||||
if change.path:
|
||||
change.path = _cleanup_path(change.path)
|
||||
if change.base_path:
|
||||
change.base_path = _cleanup_path(change.base_path)
|
||||
path = change.path
|
||||
action = 'modified'
|
||||
is_copy = 0
|
||||
if not hasattr(change, 'action'): # new to subversion 1.4.0
|
||||
action = 'modified'
|
||||
if not change.path:
|
||||
action = 'deleted'
|
||||
elif change.added:
|
||||
action = 'added'
|
||||
replace_check_path = path
|
||||
if change.base_path and change.base_rev:
|
||||
replace_check_path = change.base_path
|
||||
if changedpaths.has_key(replace_check_path) \
|
||||
and changedpaths[replace_check_path].action == 'deleted':
|
||||
action = 'replaced'
|
||||
else:
|
||||
if change.action == repos.CHANGE_ACTION_ADD:
|
||||
action = 'added'
|
||||
elif change.action == repos.CHANGE_ACTION_DELETE:
|
||||
action = 'deleted'
|
||||
elif change.action == repos.CHANGE_ACTION_REPLACE:
|
||||
if not change.path:
|
||||
action = 'deleted'
|
||||
path = change.base_path
|
||||
elif change.added:
|
||||
action = 'added'
|
||||
replace_check_path = path
|
||||
if change.base_path and change.base_rev:
|
||||
is_copy = 1
|
||||
replace_check_path = change.base_path
|
||||
if self.changes.has_key(replace_check_path) \
|
||||
and self.changes[replace_check_path].action == 'deleted':
|
||||
action = 'replaced'
|
||||
else:
|
||||
action = 'modified'
|
||||
if (action == 'added' or action == 'replaced') \
|
||||
and change.base_path \
|
||||
and change.base_rev:
|
||||
is_copy = 1
|
||||
if change.item_kind == core.svn_node_dir:
|
||||
pathtype = vclib.DIR
|
||||
elif change.item_kind == core.svn_node_file:
|
||||
pathtype = vclib.FILE
|
||||
else:
|
||||
pathtype = None
|
||||
changedpaths[path] = ChangedPath(path, pathtype, change.prop_changes,
|
||||
self.changes[path] = ChangedPath(path, pathtype, change.prop_changes,
|
||||
change.text_changed, change.base_path,
|
||||
change.base_rev, action, is_copy)
|
||||
|
||||
# Actually, what we want is a sorted list of ChangedPath objects.
|
||||
change_items = changedpaths.values()
|
||||
change_items.sort(lambda a, b: _compare_paths(a.filename, b.filename))
|
||||
def get_changes(self):
|
||||
changes = self.changes.values()
|
||||
changes.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
|
||||
# editor.get_root_props(), but something is broken there...
|
||||
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, svnrepos.pool)
|
||||
date = _datestr_to_date(datestr, svnrepos.pool)
|
||||
|
||||
return date, author, msg, change_items
|
||||
return date, author, msg, cps.get_changes()
|
||||
|
||||
|
||||
def _log_helper(svnrepos, rev, path, pool):
|
||||
@@ -491,18 +483,10 @@ class BlameSource:
|
||||
self.last = None
|
||||
self.first_rev = first_rev
|
||||
|
||||
# Do a little dance to get a URL that works in both Unix-y and
|
||||
# Windows worlds.
|
||||
rootpath = os.path.abspath(rootpath)
|
||||
if rootpath and rootpath[0] != '/':
|
||||
rootpath = '/' + rootpath
|
||||
if os.sep != '/':
|
||||
rootpath = string.replace(rootpath, os.sep, '/')
|
||||
|
||||
url = 'file://' + string.join([rootpath, fs_path], "/")
|
||||
fp = popen.popen(svn_client_path,
|
||||
('blame', "-r%d" % int(rev), "--non-interactive",
|
||||
"%s@%d" % (url, int(rev))),
|
||||
('blame', "-r%d" % int(rev), "%s@%d" % (url, int(rev))),
|
||||
'rb', 1)
|
||||
self.fp = fp
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
__version__ = '1.0.3'
|
||||
__version__ = '1.0.1'
|
||||
|
||||
# this comes from our library; measure the startup time
|
||||
import debug
|
||||
@@ -1313,15 +1313,18 @@ def markup_stream_php(fp, cfg):
|
||||
if not cfg.options.use_php:
|
||||
return None
|
||||
|
||||
# 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
|
||||
# CLI (command line interface) installed. Just uncomment the following lines:
|
||||
#os.unsetenv("SERVER_SOFTWARE")
|
||||
#os.unsetenv("SERVER_NAME")
|
||||
#os.unsetenv("GATEWAY_INTERFACE")
|
||||
#os.unsetenv("REQUEST_METHOD")
|
||||
#os.unsetenv("SCRIPT_FILENAME")
|
||||
#os.unsetenv("PATH_TRANSLATED")
|
||||
sys.stdout.flush()
|
||||
|
||||
# clearing the following environment variables prevents a
|
||||
# "No input file specified" error from the php cgi executable
|
||||
# when ViewVC is running under a cgi environment. when the
|
||||
# php cli executable is used they can be left alone
|
||||
#
|
||||
#os.putenv("GATEWAY_INTERFACE", "")
|
||||
#os.putenv("PATH_TRANSLATED", "")
|
||||
#os.putenv("REQUEST_METHOD", "")
|
||||
#os.putenv("SERVER_NAME", "")
|
||||
#os.putenv("SERVER_SOFTWARE", "")
|
||||
|
||||
return MarkupPHP(cfg.options.php_exe_path, fp)
|
||||
|
||||
@@ -1422,17 +1425,14 @@ def view_markup(request):
|
||||
streamer = markup_streamers.get(ext)
|
||||
if streamer:
|
||||
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 there wasn't a custom streamer, or the streamer wasn't enabled, we'll
|
||||
# try to use one of the configured syntax highlighting programs.
|
||||
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)
|
||||
# If no one has a suitable markup handler, we'll use the default.
|
||||
if not markup_fp:
|
||||
markup_fp = MarkupPipeWrapper(fp)
|
||||
|
||||
data['markup'] = markup_fp
|
||||
|
||||
@@ -3205,9 +3205,8 @@ def build_commit(request, files, limited_files, dir_strip):
|
||||
commit.rss_date = make_rss_time_string(files[0].GetTime(), request.cfg)
|
||||
if request.roottype == 'svn':
|
||||
commit.rev = files[0].GetRevision()
|
||||
commit.rss_url = '%s://%s%s' % \
|
||||
(request.server.getenv("HTTPS") == "on" and "https" or "http",
|
||||
request.server.getenv("HTTP_HOST"),
|
||||
commit.rss_url = 'http://%s%s' % \
|
||||
(request.server.getenv("HTTP_HOST"),
|
||||
request.get_url(view_func=view_revision,
|
||||
params={'revision': commit.rev},
|
||||
escape=1))
|
||||
|
@@ -459,10 +459,6 @@ highlight_convert_tabs = 2
|
||||
use_php = 0
|
||||
|
||||
# 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 = /usr/local/bin/php
|
||||
# php_exe_path = C:\Program Files\php\cli\php.exe
|
||||
|
Reference in New Issue
Block a user