diff --git a/lib/vclib/svn/__init__.py b/lib/vclib/svn/__init__.py index ce2847cf..c9403538 100644 --- a/lib/vclib/svn/__init__.py +++ b/lib/vclib/svn/__init__.py @@ -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) diff --git a/lib/vclib/svn_ra/__init__.py b/lib/vclib/svn_ra/__init__.py index b776048a..0a3f927d 100644 --- a/lib/vclib/svn_ra/__init__.py +++ b/lib/vclib/svn_ra/__init__.py @@ -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 diff --git a/lib/viewcvs.py b/lib/viewcvs.py index 32a95797..4ac76c2d 100644 --- a/lib/viewcvs.py +++ b/lib/viewcvs.py @@ -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':