Expose the actions for "other changed paths".

* viewcvs/lib/vclib/svn/__init__.py
  (ChangedPathEntry.__init__): Add 'action' parameter.
  (_unparse_action): New helper (with code previously in log_helper()).
  (log_helper): Now call _unparse_action() to get the action string
    for the path.  But now also call it for the other paths, passing
    the result to the updated ChangedPathEntry.__init__() function.

* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
  Now show the type of change that happened for "the other paths", and
  don't make paths that were deleted into hyperlinks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@728 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
cmpilato 2003-10-16 14:41:10 +00:00
parent 751b031192
commit 4e5303978a
3 changed files with 23 additions and 13 deletions

View File

@ -73,8 +73,9 @@ class LogEntry:
self.copy_rev = copy_rev
class ChangedPathEntry:
def __init__(self, filename):
def __init__(self, filename, action):
self.filename = filename
self.action = action
class NodeHistory:
@ -98,6 +99,19 @@ def get_history(svnrepos, full_name):
return history.histories
def _unparse_action(change_kind):
if change_kind == fs.path_change_add:
return "added"
elif change_kind == fs.path_change_delete:
return "deleted"
elif change_kind == fs.path_change_replace:
return "replaced"
elif change_kind == fs.path_change_modify:
return "modified"
else:
return None
def log_helper(svnrepos, rev, path, pool):
rev_root = fs.revision_root(svnrepos.fs_ptr, rev, pool)
other_paths = []
@ -111,14 +125,7 @@ def log_helper(svnrepos, rev, path, pool):
if change:
# 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"
action = _unparse_action(change.change_kind)
# Was this thing the target of a copy?
if (change.change_kind == fs.path_change_add) or \
@ -128,7 +135,9 @@ def log_helper(svnrepos, rev, path, pool):
# Now, make ChangedPathEntry objects for all the other paths
for other_path in changed_paths.keys():
if other_path != path:
other_paths.append(ChangedPathEntry(_trim_path(other_path)))
change = changed_paths.get(other_path)
other_paths.append(ChangedPathEntry(_trim_path(other_path),
_unparse_action(change.change_kind)))
# Finally, assemble our LogEntry.
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, pool)

View File

@ -143,7 +143,7 @@
[end]
[for entries.other_paths][if-index entries.other_paths first]<br>Other changed files:[else],[end]
<a href="[entries.other_paths.href]#rev[entries.rev]">[entries.other_paths.filename]</a>[end]
[is entries.other_paths.action "deleted"][entries.other_paths.filename][else]<a href="[entries.other_paths.href]#rev[entries.rev]">[entries.other_paths.filename]</a>[end] ([entries.other_paths.action])[end]
[end]
[is entries.state "dead"]

View File

@ -193,9 +193,10 @@ href="[docroot]/help_logtable.html">ViewCVS and CVS Help</a></b></h3></td>
[if-any entries.other_paths]
[for entries.other_paths][if-index entries.other_paths first]<b>Other changed files:</b>[else],[end]
<a href="[entries.other_paths.href]#rev[entries.rev]">[entries.other_paths.filename]</a>[end]<br>
[is entries.other_paths.action "deleted"][entries.other_paths.filename][else]<a href="[entries.other_paths.href]#rev[entries.rev]">[entries.other_paths.filename]</a>[end] ([entries.other_paths.action])[end]
<br>
[end]
[end]
[end]
<b>Log: </b><i><pre>[entries.html_log]</pre></i>
</td>