2006-03-18 05:07:36 +03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*-python-*-
|
2000-06-11 20:47:37 +04:00
|
|
|
#
|
2007-04-10 19:26:36 +04:00
|
|
|
# Copyright (C) 1999-2007 The ViewCVS Group. All Rights Reserved.
|
2000-06-11 20:47:37 +04:00
|
|
|
#
|
|
|
|
# By using this file, you agree to the terms and conditions set forth in
|
2005-12-17 20:19:28 +03:00
|
|
|
# the LICENSE.html file which can be found at the top level of the ViewVC
|
|
|
|
# distribution or at http://viewvc.org/license-1.html.
|
2000-06-11 20:47:37 +04:00
|
|
|
#
|
2006-03-18 05:07:36 +03:00
|
|
|
# For more information, visit http://viewvc.org/
|
2001-08-21 23:24:40 +04:00
|
|
|
#
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# CGI script to process and display queries to CVSdb
|
|
|
|
#
|
2005-12-17 20:19:28 +03:00
|
|
|
# This script is part of the ViewVC package. More information can be
|
|
|
|
# found at http://viewvc.org
|
2000-06-11 20:47:37 +04:00
|
|
|
#
|
|
|
|
# -----------------------------------------------------------------------
|
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import string
|
2000-06-11 20:47:37 +04:00
|
|
|
import time
|
2001-08-21 23:24:40 +04:00
|
|
|
|
|
|
|
import cvsdb
|
2006-03-18 03:33:54 +03:00
|
|
|
import viewvc
|
2001-10-25 13:21:47 +04:00
|
|
|
import ezt
|
2003-02-09 12:49:00 +03:00
|
|
|
import debug
|
2003-10-27 20:47:30 +03:00
|
|
|
import urllib
|
2007-04-26 00:07:13 +04:00
|
|
|
import vcauth
|
2001-08-21 23:24:40 +04:00
|
|
|
|
|
|
|
class FormData:
|
|
|
|
def __init__(self, form):
|
|
|
|
self.valid = 0
|
|
|
|
|
|
|
|
self.repository = ""
|
|
|
|
self.branch = ""
|
|
|
|
self.directory = ""
|
|
|
|
self.file = ""
|
|
|
|
self.who = ""
|
|
|
|
self.sortby = ""
|
|
|
|
self.date = ""
|
|
|
|
self.hours = 0
|
|
|
|
|
|
|
|
self.decode_thyself(form)
|
|
|
|
|
|
|
|
def decode_thyself(self, form):
|
|
|
|
try:
|
|
|
|
self.repository = string.strip(form["repository"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.valid = 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.branch = string.strip(form["branch"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.valid = 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.directory = string.strip(form["directory"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.valid = 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.file = string.strip(form["file"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.valid = 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.who = string.strip(form["who"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.valid = 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.sortby = string.strip(form["sortby"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.date = string.strip(form["date"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.hours = int(form["hours"].value)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
self.valid = 1
|
|
|
|
|
|
|
|
## returns a tuple-list (mod-str, string)
|
|
|
|
def listparse_string(str):
|
|
|
|
return_list = []
|
|
|
|
|
|
|
|
cmd = ""
|
|
|
|
temp = ""
|
|
|
|
escaped = 0
|
|
|
|
state = "eat leading whitespace"
|
|
|
|
|
|
|
|
for c in str:
|
|
|
|
## handle escaped charactors
|
|
|
|
if not escaped and c == "\\":
|
|
|
|
escaped = 1
|
|
|
|
continue
|
|
|
|
|
|
|
|
## strip leading white space
|
|
|
|
if state == "eat leading whitespace":
|
|
|
|
if c in string.whitespace:
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
state = "get command or data"
|
|
|
|
|
|
|
|
## parse to '"' or ","
|
|
|
|
if state == "get command or data":
|
|
|
|
|
|
|
|
## just add escaped charactors
|
|
|
|
if escaped:
|
|
|
|
escaped = 0
|
|
|
|
temp = temp + c
|
|
|
|
continue
|
|
|
|
|
|
|
|
## the data is in quotes after the command
|
|
|
|
elif c == "\"":
|
|
|
|
cmd = temp
|
|
|
|
temp = ""
|
|
|
|
state = "get quoted data"
|
|
|
|
continue
|
|
|
|
|
|
|
|
## this tells us there was no quoted data, therefore no
|
|
|
|
## command; add the command and start over
|
|
|
|
elif c == ",":
|
|
|
|
## strip ending whitespace on un-quoted data
|
|
|
|
temp = string.rstrip(temp)
|
|
|
|
return_list.append( ("", temp) )
|
|
|
|
temp = ""
|
|
|
|
state = "eat leading whitespace"
|
|
|
|
continue
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
## record the data
|
|
|
|
else:
|
|
|
|
temp = temp + c
|
|
|
|
continue
|
|
|
|
|
|
|
|
## parse until ending '"'
|
|
|
|
if state == "get quoted data":
|
|
|
|
|
|
|
|
## just add escaped charactors
|
|
|
|
if escaped:
|
|
|
|
escaped = 0
|
|
|
|
temp = temp + c
|
|
|
|
continue
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
## look for ending '"'
|
|
|
|
elif c == "\"":
|
|
|
|
return_list.append( (cmd, temp) )
|
|
|
|
cmd = ""
|
|
|
|
temp = ""
|
|
|
|
state = "eat comma after quotes"
|
|
|
|
continue
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
## record the data
|
|
|
|
else:
|
|
|
|
temp = temp + c
|
|
|
|
continue
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
## parse until ","
|
|
|
|
if state == "eat comma after quotes":
|
|
|
|
if c in string.whitespace:
|
|
|
|
continue
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
elif c == ",":
|
|
|
|
state = "eat leading whitespace"
|
|
|
|
continue
|
|
|
|
|
|
|
|
else:
|
|
|
|
print "format error"
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
if cmd or temp:
|
|
|
|
return_list.append((cmd, temp))
|
|
|
|
|
|
|
|
return return_list
|
|
|
|
|
|
|
|
def decode_command(cmd):
|
|
|
|
if cmd == "r":
|
|
|
|
return "regex"
|
|
|
|
elif cmd == "l":
|
|
|
|
return "like"
|
|
|
|
else:
|
|
|
|
return "exact"
|
|
|
|
|
|
|
|
def form_to_cvsdb_query(form_data):
|
|
|
|
query = cvsdb.CreateCheckinQuery()
|
|
|
|
|
|
|
|
if form_data.repository:
|
|
|
|
for cmd, str in listparse_string(form_data.repository):
|
|
|
|
cmd = decode_command(cmd)
|
|
|
|
query.SetRepository(str, cmd)
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
if form_data.branch:
|
|
|
|
for cmd, str in listparse_string(form_data.branch):
|
|
|
|
cmd = decode_command(cmd)
|
|
|
|
query.SetBranch(str, cmd)
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
if form_data.directory:
|
|
|
|
for cmd, str in listparse_string(form_data.directory):
|
|
|
|
cmd = decode_command(cmd)
|
|
|
|
query.SetDirectory(str, cmd)
|
|
|
|
|
|
|
|
if form_data.file:
|
|
|
|
for cmd, str in listparse_string(form_data.file):
|
|
|
|
cmd = decode_command(cmd)
|
|
|
|
query.SetFile(str, cmd)
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
if form_data.who:
|
|
|
|
for cmd, str in listparse_string(form_data.who):
|
|
|
|
cmd = decode_command(cmd)
|
|
|
|
query.SetAuthor(str, cmd)
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
if form_data.sortby == "author":
|
|
|
|
query.SetSortMethod("author")
|
|
|
|
elif form_data.sortby == "file":
|
|
|
|
query.SetSortMethod("file")
|
|
|
|
else:
|
|
|
|
query.SetSortMethod("date")
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
if form_data.date:
|
|
|
|
if form_data.date == "hours" and form_data.hours:
|
|
|
|
query.SetFromDateHoursAgo(form_data.hours)
|
|
|
|
elif form_data.date == "day":
|
|
|
|
query.SetFromDateDaysAgo(1)
|
|
|
|
elif form_data.date == "week":
|
|
|
|
query.SetFromDateDaysAgo(7)
|
|
|
|
elif form_data.date == "month":
|
|
|
|
query.SetFromDateDaysAgo(31)
|
|
|
|
|
|
|
|
return query
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2004-07-17 10:46:02 +04:00
|
|
|
def prev_rev(rev):
|
|
|
|
'''Returns a string representing the previous revision of the argument.'''
|
|
|
|
r = string.split(rev, '.')
|
|
|
|
# decrement final revision component
|
|
|
|
r[-1] = str(int(r[-1]) - 1)
|
|
|
|
# prune if we pass the beginning of the branch
|
|
|
|
if len(r) > 2 and r[-1] == '0':
|
|
|
|
r = r[:-2]
|
|
|
|
return string.join(r, '.')
|
|
|
|
|
2007-04-26 00:07:13 +04:00
|
|
|
def build_commit(server, cfg, auth, desc, files, cvsroots, viewvc_link):
|
2001-11-18 13:34:35 +03:00
|
|
|
ob = _item(num_files=len(files), files=[])
|
2001-08-21 23:24:40 +04:00
|
|
|
|
2001-11-18 13:34:35 +03:00
|
|
|
if desc:
|
2006-02-18 18:38:28 +03:00
|
|
|
ob.log = string.replace(server.escape(desc), '\n', '<br />')
|
2001-11-18 13:34:35 +03:00
|
|
|
else:
|
2006-02-18 18:38:28 +03:00
|
|
|
ob.log = ' '
|
2001-11-18 13:34:35 +03:00
|
|
|
|
|
|
|
for commit in files:
|
2005-08-18 01:45:35 +04:00
|
|
|
dir_parts = filter(None, string.split(commit.GetDirectory(), '/'))
|
|
|
|
if dir_parts \
|
|
|
|
and ((dir_parts[0] == 'CVSROOT' and cfg.options.hide_cvsroot) \
|
2007-04-26 00:07:13 +04:00
|
|
|
or auth.check_directory_access(dir_parts)):
|
2005-08-18 01:45:35 +04:00
|
|
|
continue
|
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
ctime = commit.GetTime()
|
|
|
|
if not ctime:
|
2003-10-14 19:53:42 +04:00
|
|
|
ctime = " "
|
2001-08-21 23:24:40 +04:00
|
|
|
else:
|
2003-02-09 12:49:00 +03:00
|
|
|
if (cfg.options.use_localtime):
|
|
|
|
ctime = time.strftime("%y/%m/%d %H:%M %Z", time.localtime(ctime))
|
|
|
|
else:
|
|
|
|
ctime = time.strftime("%y/%m/%d %H:%M", time.gmtime(ctime)) \
|
|
|
|
+ ' UTC'
|
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
## make the file link
|
2004-10-16 04:47:42 +04:00
|
|
|
repository = commit.GetRepository()
|
|
|
|
directory = commit.GetDirectory()
|
|
|
|
file = (directory and directory + "/") + commit.GetFile()
|
|
|
|
cvsroot_name = cvsroots.get(repository)
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
## if we couldn't find the cvsroot path configured in the
|
2006-03-18 03:33:54 +03:00
|
|
|
## viewvc.conf file, then don't make the link
|
2001-08-21 23:24:40 +04:00
|
|
|
if cvsroot_name:
|
2004-07-16 20:39:46 +04:00
|
|
|
flink = '[%s] <a href="%s/%s?root=%s">%s</a>' % (
|
2006-03-18 03:33:54 +03:00
|
|
|
cvsroot_name, viewvc_link, urllib.quote(file),
|
2004-07-16 20:39:46 +04:00
|
|
|
cvsroot_name, file)
|
2004-07-17 10:46:02 +04:00
|
|
|
if commit.GetType() == commit.CHANGE:
|
|
|
|
dlink = '%s/%s?root=%s&view=diff&r1=%s&r2=%s' % (
|
2006-03-18 03:33:54 +03:00
|
|
|
viewvc_link, urllib.quote(file), cvsroot_name,
|
2004-07-17 10:46:02 +04:00
|
|
|
prev_rev(commit.GetRevision()), commit.GetRevision())
|
|
|
|
else:
|
|
|
|
dlink = None
|
2001-08-21 23:24:40 +04:00
|
|
|
else:
|
2004-10-16 04:47:42 +04:00
|
|
|
flink = '[%s] %s' % (repository, file)
|
2004-07-17 10:46:02 +04:00
|
|
|
dlink = None
|
2000-06-11 20:47:37 +04:00
|
|
|
|
2001-11-18 13:34:35 +03:00
|
|
|
ob.files.append(_item(date=ctime,
|
2001-11-18 14:11:38 +03:00
|
|
|
author=commit.GetAuthor(),
|
2001-11-18 13:34:35 +03:00
|
|
|
link=flink,
|
2001-11-18 14:11:38 +03:00
|
|
|
rev=commit.GetRevision(),
|
|
|
|
branch=commit.GetBranch(),
|
|
|
|
plus=int(commit.GetPlusCount()),
|
|
|
|
minus=int(commit.GetMinusCount()),
|
2004-07-17 10:46:02 +04:00
|
|
|
type=commit.GetTypeString(),
|
|
|
|
difflink=dlink,
|
2001-11-18 14:11:38 +03:00
|
|
|
))
|
2001-11-18 13:34:35 +03:00
|
|
|
|
|
|
|
return ob
|
|
|
|
|
2006-03-18 03:33:54 +03:00
|
|
|
def run_query(server, cfg, form_data, viewvc_link):
|
2007-04-26 00:07:13 +04:00
|
|
|
auth_params = cfg.get_authorizer_params('forbidden')
|
|
|
|
auth = vcauth.forbidden.ViewVCAuthorizer(None, None, None, None,
|
|
|
|
auth_params)
|
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
query = form_to_cvsdb_query(form_data)
|
Tweak logic used to find installed paths ("lib" directory, configuration
file, templates, etc). Specifically, make the following changes:
- Get rid of hardcoded paths in module files ("lib" directory) and
configuration files (viewcvs.conf and mod_python's .htaccess)
- Allow stub scripts (for asp, cgi, and mod_python) to specify
configuration files so it's possible to have multiple configurations of
viewcvs running off a single installation.
- Be more consistent about resolving paths when they aren't hardcoded
(when ViewCVS is running from a source directory). In particular, try
not to depend on the working directory. That way it's legal to run
./standalone.py instead of bin/standalone.py without getting an
ImportError.
- Get rid of global cfg variables in viewcvs.py and cvsdb.py. They led to
all sorts of hacks in other files to pilfer and reset them. They were
also possible sources of races in multithreaded environments like
mod_python and asp.
- Rewrite mod_python handler so library paths can be specified inside the
stub files.
* lib/apache.py
removed, contained old mod_python handler
* lib/config.py
(Config.load_config):
remove sys.argv voodoo, just load the configuration path specified in
the pathname argument
(Config.set_defaults):
use relative path for cvsgraph_conf setting instead of hardcoded
<VIEWCVS_INSTALL_DIRECTORY> literal
* lib/cvsdb.py
(CONF_PATHNAME, config, cfg):
removed, configuration stuff
(CheckinDatabase.__init__, CheckinDatabase.CreateSQLQueryString):
add "_row_limit" member instead of using cfg object
(CreateCheckinDatabase):
removed, a do-nothing function
(ConnectDatabaseReadOnly, ConnectDatabase):
add cfg arguments
(GetUnrecordedCommitList):
add db argument
* lib/query.py
(CONF_PATHAME):
removed
(build_commit, run_query, main):
add cfg arguments, use new viewcvs.get_template function
* lib/viewcvs.py
(CONF_PATHNAME, cfg, g_install_dir):
removed
(Request.__init__):
add cfg member
(Request.run_viewcvs, Request.get_link, check_freshness,
get_view_template, generate_page, default_view, get_file_view_info,
format_log, common_template_data, MarkupEnscript.__init__,
markup_stream_python, markup_stream_php, make_time_string, view_markup,
sort_file_data, view_directory, paging, view_log, view_annotate,
view_cvsgraph_image, view_cvsgraph, view_doc, rcsdiff_date_reformat,
spaced_html_text, DiffSource.__init__, DiffSource._get_row, view_patch,
view_diff, generate_tarball, download_tarball, view_revision,
is_query_supported, english_query, build_commit, view_query,
view_error, main):
stop using global config, use cfg arguments or request member instead
(_install_path):
new, use __file__ to locate template and configuation paths
(get_view_template):
use _install_path and return compiled template instead of path
(is_viewable, default_view):
rename is_viewable to default_view and return view instead of boolean
(handle_config, load_config):
rename handle_config to load_config and return config object instead
of setting cfg global
* bin/cgi/viewcvs.cgi
* bin/cgi/query.cgi
* bin/cvsdbadmin
* bin/loginfo-handler
* bin/standalone.py
* bin/svndbadmin
look for library relative to sys.argv[0] when no hardcoded library
path is available. Also add configuration loading code.
* bin/asp/viewcvs.asp
* bin/asp/query.asp
add configuration loading code
* bin/mod_python/.htaccess
specify new mod_python handler, remove reference to
<VIEWCVS_APACHE_LIBRARY_DIRECTORY>
* bin/mod_python/handler.py
added, holds new mod_python handler
* bin/mod_python/viewcvs.py
* bin/mod_python/query.py
rewrite for new handler, add hardcoded library and configuration paths
* viewcvs.conf.dist
remove references to <VIEWCVS_INSTALL_DIRECTORY>
* viewcvs-install
(FILE_INFO_LIST):
stop hardcoding paths in config files
(SetPythonPaths,):
get rid of <VIEWCVS_INSTALL_DIRECTORY> and
<VIEWCVS_APACHE_LIBRARY_DIRECTORY> substitutions
(ApacheEscape, _re_apache):
removed
(InstallTree):
stop hardcoding paths in lib directory
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1173 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-06 07:04:14 +03:00
|
|
|
db = cvsdb.ConnectDatabaseReadOnly(cfg)
|
2001-08-21 23:24:40 +04:00
|
|
|
db.RunQuery(query)
|
|
|
|
|
2001-11-18 13:34:35 +03:00
|
|
|
if not query.commit_list:
|
|
|
|
return [ ]
|
|
|
|
|
|
|
|
commits = [ ]
|
|
|
|
files = [ ]
|
|
|
|
|
2003-02-11 05:56:11 +03:00
|
|
|
cvsroots = {}
|
2007-04-13 13:14:12 +04:00
|
|
|
rootitems = cfg.general.svn_roots.items() + cfg.general.cvs_roots.items()
|
2004-07-16 20:39:46 +04:00
|
|
|
for key, value in rootitems:
|
2004-10-16 04:47:42 +04:00
|
|
|
cvsroots[cvsdb.CleanRepository(value)] = key
|
2003-02-11 05:56:11 +03:00
|
|
|
|
2001-11-18 13:34:35 +03:00
|
|
|
current_desc = query.commit_list[0].GetDescription()
|
2001-08-21 23:24:40 +04:00
|
|
|
for commit in query.commit_list:
|
|
|
|
desc = commit.GetDescription()
|
|
|
|
if current_desc == desc:
|
2001-11-18 13:34:35 +03:00
|
|
|
files.append(commit)
|
2001-08-21 23:24:40 +04:00
|
|
|
continue
|
|
|
|
|
2007-04-26 00:07:13 +04:00
|
|
|
commits.append(build_commit(server, cfg, auth, current_desc, files,
|
2006-03-18 03:33:54 +03:00
|
|
|
cvsroots, viewvc_link))
|
2001-11-18 13:34:35 +03:00
|
|
|
|
|
|
|
files = [ commit ]
|
2001-08-21 23:24:40 +04:00
|
|
|
current_desc = desc
|
2001-11-18 13:34:35 +03:00
|
|
|
|
|
|
|
## add the last file group to the commit list
|
2007-04-26 00:07:13 +04:00
|
|
|
commits.append(build_commit(server, cfg, auth, current_desc, files,
|
2006-03-18 03:33:54 +03:00
|
|
|
cvsroots, viewvc_link))
|
2001-11-18 13:34:35 +03:00
|
|
|
|
|
|
|
return commits
|
2001-08-21 23:24:40 +04:00
|
|
|
|
2006-03-18 03:33:54 +03:00
|
|
|
def main(server, cfg, viewvc_link):
|
2003-02-09 12:49:00 +03:00
|
|
|
try:
|
2003-02-11 05:56:11 +03:00
|
|
|
|
2003-02-09 12:49:00 +03:00
|
|
|
form = server.FieldStorage()
|
2001-08-21 23:24:40 +04:00
|
|
|
form_data = FormData(form)
|
2001-10-25 13:21:47 +04:00
|
|
|
|
2001-11-18 13:34:35 +03:00
|
|
|
if form_data.valid:
|
2006-03-18 03:33:54 +03:00
|
|
|
commits = run_query(server, cfg, form_data, viewvc_link)
|
2001-11-18 14:11:38 +03:00
|
|
|
query = None
|
2001-11-18 13:34:35 +03:00
|
|
|
else:
|
|
|
|
commits = [ ]
|
2001-11-18 14:11:38 +03:00
|
|
|
query = 'skipped'
|
2001-11-18 13:34:35 +03:00
|
|
|
|
2004-04-28 19:53:39 +04:00
|
|
|
script_name = server.getenv('SCRIPT_NAME', '')
|
|
|
|
|
2001-10-25 13:21:47 +04:00
|
|
|
data = {
|
|
|
|
'cfg' : cfg,
|
|
|
|
'address' : cfg.general.address,
|
2006-03-18 03:33:54 +03:00
|
|
|
'vsn' : viewvc.__version__,
|
2001-10-25 13:21:47 +04:00
|
|
|
|
2003-02-09 12:49:00 +03:00
|
|
|
'repository' : server.escape(form_data.repository, 1),
|
|
|
|
'branch' : server.escape(form_data.branch, 1),
|
|
|
|
'directory' : server.escape(form_data.directory, 1),
|
|
|
|
'file' : server.escape(form_data.file, 1),
|
|
|
|
'who' : server.escape(form_data.who, 1),
|
2004-04-28 19:53:39 +04:00
|
|
|
'docroot' : cfg.options.docroot is None \
|
2006-03-18 03:33:54 +03:00
|
|
|
and viewvc_link + '/' + viewvc.docroot_magic_path \
|
2004-04-28 19:53:39 +04:00
|
|
|
or cfg.options.docroot,
|
2001-10-25 13:21:47 +04:00
|
|
|
|
|
|
|
'sortby' : form_data.sortby,
|
|
|
|
'date' : form_data.date,
|
2001-11-18 13:34:35 +03:00
|
|
|
|
2001-11-18 14:11:38 +03:00
|
|
|
'query' : query,
|
2001-11-18 13:34:35 +03:00
|
|
|
'commits' : commits,
|
|
|
|
'num_commits' : len(commits),
|
2006-07-14 22:32:42 +04:00
|
|
|
'rss_href' : None,
|
2001-10-25 13:21:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if form_data.hours:
|
|
|
|
data['hours'] = form_data.hours
|
|
|
|
else:
|
|
|
|
data['hours'] = 2
|
|
|
|
|
2003-02-09 12:49:00 +03:00
|
|
|
server.header()
|
2001-10-25 13:21:47 +04:00
|
|
|
|
|
|
|
# generate the page
|
2006-03-18 03:33:54 +03:00
|
|
|
template = viewvc.get_view_template(cfg, "query")
|
2007-02-26 21:07:19 +03:00
|
|
|
template.generate(server.file(), data)
|
2001-10-25 13:21:47 +04:00
|
|
|
|
2001-08-21 23:24:40 +04:00
|
|
|
except SystemExit, e:
|
2003-02-18 14:54:41 +03:00
|
|
|
pass
|
2001-08-21 23:24:40 +04:00
|
|
|
except:
|
2005-10-20 00:38:33 +04:00
|
|
|
exc_info = debug.GetExceptionData()
|
|
|
|
server.header(status=exc_info['status'])
|
|
|
|
debug.PrintException(server, exc_info)
|
2001-11-18 13:34:35 +03:00
|
|
|
|
|
|
|
class _item:
|
|
|
|
def __init__(self, **kw):
|
|
|
|
vars(self).update(kw)
|