From f808704efe3a35f22e25fd84a6414cee6377f3bb Mon Sep 17 00:00:00 2001 From: cmpilato Date: Fri, 26 Sep 2003 14:29:07 +0000 Subject: [PATCH] * viewcvs/lib/vclib/svn/__init__.py (log_helper): Populate the 'action' attribute of the LogEntry. * viewcvs/templates/log.ezt Expect human-readable strings for the action type (instead of the single-character abbreviations). git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@712 8cb11bc2-c004-0410-86c3-e597b4017df7 --- lib/vclib/svn/__init__.py | 22 ++++++++++++++++++++-- templates/log.ezt | 8 ++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/vclib/svn/__init__.py b/lib/vclib/svn/__init__.py index 7d7312cb..f9714017 100644 --- a/lib/vclib/svn/__init__.py +++ b/lib/vclib/svn/__init__.py @@ -134,16 +134,34 @@ def log_helper(svnrepos, rev, path, show_changed_paths): rev_root = fs.revision_root(svnrepos.fs_ptr, rev, svnrepos.pool) other_paths = [] changed_paths = fs.paths_changed(rev_root, svnrepos.pool) - if not changed_paths.has_key(path): + + # Skip revisions in which this path didn't change. + change = changed_paths.get(path) + if not change: return None + + # Figure out the type of change that happened on the path. + if change.change_kind == fs.path_change_add: + action = "added" + elif change.change_kind == fs.path_change_delete: + action = "deleted" + elif change.change_kind == fs.path_change_replace: + action = "replaced" + else: + action = "modified" + + # Now, make ChangedPathEntry objects for all the other paths (if + # show_changed_paths is set). del changed_paths[path] if show_changed_paths: for other_path in changed_paths.keys(): other_paths.append(ChangedPathEntry(other_path)) + + # Finally, assemble our LogEntry. datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, svnrepos.pool) date = _datestr_to_date(datestr, svnrepos.pool) entry = LogEntry(rev, date, author, msg, path, - other_paths, None, None, None) + other_paths, action, None, None) if fs.is_file(rev_root, path, svnrepos.pool): entry.size = fs.file_length(rev_root, path, svnrepos.pool) return entry diff --git a/templates/log.ezt b/templates/log.ezt index d64fd287..e1876a07 100644 --- a/templates/log.ezt +++ b/templates/log.ezt @@ -94,10 +94,10 @@ [is roottype "svn"] [if-any entries.action] - [is entries.action "M"]Modified[else] - [is entries.action "A"]Added[else] - [is entries.action "D"]Deleted[else] - [is entries.action "R"]Replaced[end][end][end][end] + [is entries.action "modified"]Modified[else] + [is entries.action "added"]Added[else] + [is entries.action "deleted"]Deleted[else] + [is entries.action "replaced"]Replaced[end][end][end][end] [end] [end]