Tweak the diff view data dictionary for consistency.

* viewcvs/lib/viewcvs.py
  (DiffSource._flush_row): Make the 'have_left' and 'have_right'
    members of the change object be EZT booleans.
  (DiffSource._get_row): Rename 'extra' member to 'line_info_extra'.
  (view_diff): Rename some data dictionary variables:
    'rev1' => 'rev_left'
    'rev2' => 'rev_right'
    'tag1' => 'tag_left'
    'tag2' => 'tag_right'
    'date1' => 'date_left'
    'date2' => 'date_right'

* viewcvs/templates/diff.ezt
  Track renamed variables.

* viewcvs/website/upgrading.html
  Note the slight tweak to the way 'have_left' and 'have_right' work,
  not that I expect anyone to have really been testing for "yes".
  Also, note the renamed variables.

* viewcvs/website/template-authoring-guide.html
  Populate the annotate, graph, and diff sections, tracking the
  tweaked variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1130 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.0-rc1
cmpilato 2005-10-14 20:29:16 +00:00
parent 2777f41d32
commit 043995ce16
4 changed files with 199 additions and 116 deletions

View File

@ -2344,8 +2344,10 @@ class DiffSource:
self.right_col = [ ]
match = _re_extract_info.match(line)
return _item(type='header', line_info_left=match.group(1),
line_info_right=match.group(2), extra=match.group(3))
return _item(type='header',
line_info_left=match.group(1),
line_info_right=match.group(2),
line_info_extra=match.group(3))
if line[0] == '\\':
# \ No newline at end of file
@ -2390,12 +2392,14 @@ class DiffSource:
return _item(type='remove', left=self.left_col.pop(0))
# state == flush-pre-change-add
item = _item(type='change', have_left=None, have_right=None)
item = _item(type='change',
have_left=ezt.boolean(0),
have_right=ezt.boolean(0))
if self.left_col:
item.have_left = 'yes'
item.have_left = ezt.boolean(1)
item.left = self.left_col.pop(0)
if self.right_col:
item.have_right = 'yes'
item.have_right = ezt.boolean(1)
item.right = self.right_col.pop(0)
return item
@ -2586,10 +2590,10 @@ def view_diff(request):
request.server.header()
data = nav_header_data(request, rev2)
data.update({
'rev1' : rev1,
'rev2' : rev2,
'tag1' : sym1,
'tag2' : sym2,
'rev_left' : rev1,
'rev_right' : rev2,
'tag_left' : sym1,
'tag_right' : sym2,
'diff_format' : request.query_dict.get('diff_format',
cfg.options.diff_format),
})
@ -2613,8 +2617,8 @@ def view_diff(request):
raw_diff_fp = MarkupPipeWrapper(fp, htmlify(headers), None, 1)
data.update({
'date1' : date1 and rcsdiff_date_reformat(date1),
'date2' : date2 and rcsdiff_date_reformat(date2),
'date_left' : date1 and rcsdiff_date_reformat(date1),
'date_right' : date2 and rcsdiff_date_reformat(date2),
'raw_diff' : raw_diff_fp,
'changes' : changes,
})

View File

@ -14,12 +14,12 @@
<table cellspacing="0" cellpadding="0">
<tr class="vc_diff_header">
<th style="width:50%;vertical-align:top;">
version [rev1], [date1]
[if-any tag1]<br />Tag: [tag1][end]
version [rev_left], [date_left]
[if-any tag_left]<br />Tag: [tag_left][end]
</th>
<th style="width:50%;vertical-align:top;">
version [rev2], [date2]
[if-any tag2]<br />Tag: [tag2][end]
version [rev_right], [date_right]
[if-any tag_right]<br />Tag: [tag_right][end]
</th>
</tr>
@ -30,7 +30,7 @@
<table>
<tr>
<td> <strong>Line [changes.line_info_left]</strong>&nbsp;
<span class="vc_diff_chunk_extra">[changes.extra]</span></td>
<span class="vc_diff_chunk_extra">[changes.line_info_extra]</span></td>
</tr>
</table>
</td>
@ -38,7 +38,7 @@
<table>
<tr>
<td> <strong>Line [changes.line_info_right]</strong>&nbsp;
<span class="vc_diff_chunk_extra">[changes.extra]</span></td>
<span class="vc_diff_chunk_extra">[changes.line_info_extra]</span></td>
</tr>
</table>
</td>
@ -146,7 +146,7 @@
<td>Legend:<br />
<table cellspacing="0" cellpadding="1">
<tr>
<td style="text-align:center;" class="vc_diff_remove">Removed from v.[rev1]</td>
<td style="text-align:center;" class="vc_diff_remove">Removed from v.[rev_left]</td>
<td class="vc_diff_empty">&nbsp;</td>
</tr>
<tr>
@ -154,7 +154,7 @@
</tr>
<tr>
<td class="vc_diff_empty">&nbsp;</td>
<td style="text-align:center;" class="vc_diff_add">Added in v.[rev2]</td>
<td style="text-align:center;" class="vc_diff_add">Added in v.[rev_right]</td>
</tr>
</table>
</td>

View File

@ -159,8 +159,8 @@ th { background: rgb(60%,70%,90%); }
<tr class="varlevel1">
<td class="varname">pathtype</td>
<td>String</td>
<td>Path kind of the current resource. Valid values: <tt>file</tt>,
<tt>dir</tt>; may be empty.</td>
<td>Path kind of the current resource. Valid values: <tt>file</tt>
(file), <tt>dir</tt> (directory); may be empty.</td>
</tr>
<tr class="varlevel1">
<td class="varname">rootname</td>
@ -197,7 +197,7 @@ th { background: rgb(60%,70%,90%); }
<td class="varname">roottype</td>
<td>String</td>
<td>Version control type of the current repository (root).
Valid values: <tt>cvs</tt>, <tt>svn</tt>.</td>
Valid values: <tt>cvs</tt> (CVS), <tt>svn</tt> (Subversion).</td>
</tr>
<tr class="varlevel1">
<td class="varname">up_href</td>
@ -207,11 +207,14 @@ th { background: rgb(60%,70%,90%); }
<tr class="varlevel1">
<td class="varname">view</td>
<td>String</td>
<td>Name of the current view. Valid values: <tt>annotate</tt>,
<tt>co</tt>, <tt>diff</tt>, <tt>roots</tt>, <tt>dir</tt>,
<tt>graph</tt>, <tt>graphimg</tt>, <tt>log</tt>, <tt>markup</tt>,
<tt>query</tt>, <tt>queryform</tt>, <tt>rev</tt>,
<tt>tar</tt>.</td>
<td>Name of the current view. Valid values: <tt>annotate</tt>
(annotation view), <tt>diff</tt> (file difference view),
<tt>roots</tt> (root listing view), <tt>dir</tt> (directory
listing view), <tt>graph</tt> (revision graph view), <tt>log</tt>
(revision log view), <tt>markup</tt> (file contents view),
<tt>query</tt> (revision history query results view),
<tt>queryform</tt> (revision history query form view),
<tt>rev</tt> (revision/changeset view).</td>
</tr>
<tr class="varlevel1">
<td class="varname">vsn</td>
@ -289,43 +292,49 @@ th { background: rgb(60%,70%,90%); }
</tr>
<tr class="varlevel1">
<td class="varname">lines</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.text</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.line_number</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.rev</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.prev_rev</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.diff_url</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.date</td>
<td></td>
<td></td>
<td>List</td>
<td>Set of objects containing information about the most recent
modification of a single line of file content in the current
resource, naturally ordered by the line numbers they represent.
Every line in the resource is represented in the set.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.author</td>
<td></td>
<td></td>
<td>String</td>
<td>Username of the most recent modifier of the line.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.date</td>
<td>String</td>
<td>Date (in UTC if not otherwise configured) of the modification of
the line.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.diff_url</td>
<td>String</td>
<td>URL of the ViewCVS file difference view which displays the
modification of the line.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.line_number</td>
<td>String</td>
<td>Line number (1-based) of the line.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.prev_rev</td>
<td>String</td>
<td>Youngest revision of the resource prior to the line's
modification.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.rev</td>
<td>String</td>
<td>Revision in which the modification of the line occured.</td>
</tr>
<tr class="varlevel2">
<td class="varname">lines.text</td>
<td>String</td>
<td>Textual contents of the line.</td>
</tr>
</tbody>
</table>
@ -348,13 +357,15 @@ th { background: rgb(60%,70%,90%); }
</tr>
<tr class="varlevel1">
<td class="varname">imagemap</td>
<td></td>
<td></td>
<td>String</td>
<td>HTML markup containing the image map associated with the
revision graph.</td>
</tr>
<tr class="varlevel1">
<td class="varname">imagesrc</td>
<td></td>
<td></td>
<td>String</td>
<td>URL of the ViewCVS revision graph image for the current
resource.</td>
</tr>
</tbody>
</table>
@ -377,98 +388,127 @@ th { background: rgb(60%,70%,90%); }
</tr>
<tr class="varlevel1">
<td class="varname">changes</td>
<td></td>
<td></td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.extra</td>
<td></td>
<td></td>
<td>List</td>
<td>Set of objects which contain information about a single line of
file difference data. Valid only when <var>diff_format</var> is
<tt>h</tt> or <tt>l</tt>.</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.have_left</td>
<td></td>
<td></td>
<td>Boolean</td>
<td>Specifies whether the left file has a line of content relevant
to the difference data line. Valid only when
<var>changes.type</var> is <tt>change</tt>.</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.have_right</td>
<td></td>
<td></td>
<td>Boolean</td>
<td>Specifies whether the right file has a line of content relevant
to the difference data line. Valid only when
<var>changes.type</var> is <tt>change</tt>.</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.left</td>
<td></td>
<td></td>
<td>String</td>
<td>Textual contents of the relevant line in the left file. Valid
only when <var>changes.type</var> is <tt>change</tt>,
<tt>context</tt>, or <tt>remove</tt>. When
<var>changes.type</var> is <tt>change</tt>, valid only when
<var>changes.have_left</var> is set (in order to delineate
between missing lines and empty lines, which EZT does not
support).</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.right</td>
<td></td>
<td></td>
<td>String</td>
<td>Textual contents of the relevant line in the right file. Valid
only when <var>changes.type</var> is <tt>add</tt>, <tt>change</tt>,
or <tt>context</tt>. When
<var>changes.type</var> is <tt>change</tt>, valid only when
<var>changes.have_left</var> is set (in order to delineate
between missing lines and empty lines, which EZT does not
support).</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.line_info_extra</td>
<td>String</td>
<td>Additional line information for the current difference hunk.
Valid only when <var>changes.type</var> is <tt>header</tt>.</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.line_info_left</td>
<td></td>
<td></td>
<td>String</td>
<td>First line number represented by the current hunk in the left
file. Valid only when <var>changes.type</var> is <tt>header</tt>.</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.line_info_right</td>
<td></td>
<td></td>
<td>String</td>
<td>First line number represented by the current hunk in the right
file. Valid only when <var>changes.type</var> is <tt>header</tt>.</td>
</tr>
<tr class="varlevel2">
<td class="varname">changes.type</td>
<td></td>
<td></td>
<td>String</td>
<td>The type of change. Value values: <tt>add</tt>,
<tt>change</tt>, <tt>context</tt>, <tt>header</tt>,
<tt>no-changes</tt>, <tt>remove</tt>.</td>
</tr>
<tr class="varlevel1">
<td class="varname">date1</td>
<td></td>
<td></td>
<td class="varname">date_left</td>
<td>String</td>
<td>Date (in UTC if not otherwise configured) in which the left file
revision was created.</td>
</tr>
<tr class="varlevel1">
<td class="varname">date2</td>
<td></td>
<td></td>
<td class="varname">date_right</td>
<td>String</td>
<td>Date (in UTC if not otherwise configured) in which the right file
revision was created.</td>
</tr>
<tr class="varlevel1">
<td class="varname">diff_format</td>
<td></td>
<td></td>
<td>String</td>
<td>Difference dislay format: Valid values are <tt>c</tt>
(context), <tt>h</tt> (human-readable, or colored), <tt>l</tt> (long
human-readable), <tt>s</tt> (side-by-side), <tt>u</tt>
(unified).</td>
</tr>
<tr class="varlevel1">
<td class="varname">diff_format_action</td>
<td></td>
<td></td>
<td>String</td>
<td>Form action URL for the diff format selection form.</td>
</tr>
<tr class="varlevel1">
<td class="varname">diff_format_hidden_values</td>
<td></td>
<td></td>
<td>String</td>
<td>Hidden value HTML markup for the diff format selection form.</td>
</tr>
<tr class="varlevel1">
<td class="varname">raw_diff</td>
<td></td>
<td></td>
<td>String</td>
<td>Raw difference text. Valid only when <var>diff_format</var> is
<tt>c</tt>, <tt>s</tt>, or <tt>u</tt>.</td>
</tr>
<tr class="varlevel1">
<td class="varname">rev1</td>
<td></td>
<td></td>
<td class="varname">rev_left</td>
<td>String</td>
<td>Revision of the left file.</td>
</tr>
<tr class="varlevel1">
<td class="varname">rev2</td>
<td></td>
<td></td>
<td class="varname">rev_right</td>
<td>String</td>
<td>Revision of the right file.</td>
</tr>
<tr class="varlevel1">
<td class="varname">tag1</td>
<td></td>
<td></td>
<td class="varname">tag_left</td>
<td>String</td>
<td>Tag of the left file.</td>
</tr>
<tr class="varlevel1">
<td class="varname">tag2</td>
<td></td>
<td></td>
<td class="varname">tag_right</td>
<td>String</td>
<td>Tag of the right file.</td>
</tr>
</tbody>
</table>

View File

@ -304,11 +304,26 @@
</dd>
</dl>
<dl>
<dt><code>diff.ezt</code>: <var>changes.line1</var> and
<var>changes.line2</var></dt>
<dt><code>diff.ezt</code>:
<var>rev1</var>,
<var>rev2</var>,
<var>tag1</var>,
<var>tag2</var>,
<var>date1</var>,
<var>date2</var>,
<var>changes.line1</var>,
<var>changes.line2</var>, and
<var>changes.extra</var></dt>
<dd>Replaced with new
<var>changes.line_info_left</var> and
<var>changes.line_info_right</var> variables.
<var>rev_left</var>,
<var>rev_right</var>,
<var>tag_left</var>,
<var>tag_right</var>,
<var>date_left</var>,
<var>date_right</var>,
<var>changes.line_info_left</var>,
<var>changes.line_info_right</var>, and
<var>changes.line_info_extra</var> variables.
<dd>
</dl>
@ -455,9 +470,22 @@
<code>diff.ezt</code>:
<var>changes.line_info_left</var>,
<var>changes.line_info_right</var>
<var>changes.line_info_extra</var>
</dt>
<dd>New variables for diff hunk line information.</dd>
</dl>
<dl>
<dt>
<code>diff.ezt</code>:
<var>rev_left</var>,
<var>rev_right</var>,
<var>tag_left</var>,
<var>tag_right</var>,
<var>date_left</var>,
<var>date_right</var>,
</dt>
<dd>New variables for diff metadata information.</dd>
</dl>
<dl>
<dt>
<code>annotate.ezt</code>:
@ -663,6 +691,17 @@
</li>
</ul>
<p>In <code>diff.ezt</code>:</p>
<ul>
<li>
<var>changes.have_left</var> and <var>changes.have_right</var>
are not EZT boolean values, and so should be tested with
<code>[if-any]</code> instead of and <code>[is "yes"]</code>
comparison.
</li>
</ul>
</div>
<div class="section">