Fix a brain-O. "filter_path" is the *opposite* of "show_all_logs".

Duh.  Stop using filter_path and (failing at) translating between the
senses here.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.__init__): Drop the 'options', take explicit 'show_all_logs'.
  (LogCollector.add_log): Update for new variables.  Also, fix some
    logic so this works when we aren't showing all logs, too.
  (SubversionRepository.filelog): Parse the options here, and pass to
    the LogCollector().

* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.__init__, NodeHistory.add_history, _get_history): Stop
    using 'filter_path'; use 'show_all_logs' instead.

* viewcvs/lib/viewcvs.py
  (view_log): Make showing all directory logs default to 0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@846 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
cmpilato 2004-05-10 14:56:09 +00:00
parent e075e20fa7
commit cfe3d1ea29
3 changed files with 21 additions and 19 deletions

View File

@ -74,10 +74,10 @@ class Revision(vclib.Revision):
class NodeHistory:
def __init__(self, fs_ptr, filter_path=0):
def __init__(self, fs_ptr, show_all_logs):
self.histories = {}
self.fs_ptr = fs_ptr
self.filter_path = filter_path
self.show_all_logs = show_all_logs
def add_history(self, path, revision, pool):
# If filtering, only add the path and revision to the histories
@ -85,7 +85,7 @@ class NodeHistory:
# change means the path itself was changed, or one of its parents
# was copied). This is useful for omitting bubble-up directory
# changes.
if self.filter_path:
if not self.show_all_logs:
rev_root = fs.revision_root(self.fs_ptr, revision, pool)
changed_paths = fs.paths_changed(rev_root, pool)
paths = changed_paths.keys()
@ -113,15 +113,15 @@ class NodeHistory:
def _get_history(svnrepos, full_name, options):
filter_path = 0
if options.get('svn_show_all_dir_logs', 0):
show_all_logs = options.get('svn_show_all_dir_logs', 0)
if not show_all_logs:
# See if the path is a file or directory.
kind = fs.check_path(svnrepos.fsroot, full_name, svnrepos.pool)
if kind is core.svn_node_dir:
filter_path = 1
if kind is core.svn_node_file:
show_all_logs = 1
# Instantiate a NodeHistory collector object.
history = NodeHistory(svnrepos.fs_ptr, filter_path)
history = NodeHistory(svnrepos.fs_ptr, show_all_logs)
# Do we want to cross copy history?
cross_copies = options.get('svn_cross_copies', 0)

View File

@ -124,14 +124,14 @@ def _compare_paths(path1, path2):
return cmp(char1, char2)
class LogCollector:
def __init__(self, path, options):
def __init__(self, path, show_all_logs):
# This class uses leading slashes for paths internally
if not path:
self.path = '/'
else:
self.path = path[0] == '/' and path or '/' + path
self.logs = []
self.filter_path = options.get('svn_show_all_dir_logs', 0)
self.show_all_logs = show_all_logs
def add_log(self, paths, revision, author, date, message, pool):
# Changed paths have leading slashes
@ -152,13 +152,13 @@ class LogCollector:
change = paths[changed_path]
if change.copyfrom_path:
this_path = change.copyfrom_path + self.path[len(changed_path):]
if self.filter_path and not this_path:
return
date = _datestr_to_date(date, pool)
entry = Revision(revision, date, author, message, None,
self.path[1:], None, None)
self.path = this_path
self.logs.append(entry)
if self.show_all_logs or this_path:
date = _datestr_to_date(date, pool)
entry = Revision(revision, date, author, message, None,
self.path[1:], None, None)
self.logs.append(entry)
if this_path:
self.path = this_path
def get_logs(svnrepos, full_name, files):
@ -410,7 +410,9 @@ class SubversionRepository(vclib.Repository):
except ValueError:
vclib.InvalidRevision(rev)
lc = LogCollector(full_name, options)
# It's okay if we're told to not show all logs on a file -- all
# the revisions should match correctly anyway.
lc = LogCollector(full_name, options.get('svn_show_all_dir_logs', 0))
dir_url = self.rootpath
if full_name:
dir_url = dir_url + '/' + full_name

View File

@ -1499,7 +1499,7 @@ def view_log(request):
'directory', '400 Bad Request')
options = {}
options['svn_show_all_dir_logs'] = 1 ### someday make this optional?
options['svn_show_all_dir_logs'] = 0 ### someday make this optional?
options['svn_cross_copies'] = cfg.options.cross_copies
if request.roottype == 'cvs':