<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <title>$title</title>
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $(".trac-toggledeleted").show().click(function() {
                  $(this).siblings().find(".trac-deleted").toggle();
                  return false;
        }).click();
        $("#content").find("li.entry h2 a").parent().addAnchor("${_('Link to this diff')}");
      });
    </script>
  </head>

  <body>
    <div id="content" class="changeset">
      <div id="title" py:choose="">
        <h1 py:when="changeset and restricted">
          <!--! FIXME: message_contains_tag -->
          ${_('Changeset')} <a title="${_('Show full changeset')}" href="${href.changeset(new_rev)}">$new_rev</a>
          : <a title="${_('Show entry in browser')}" href="${href.browser(new_path, rev=new_rev)}">$new_path</a>
        </h1>
        <h1 py:when="not changeset and restricted">
          <a title="${_('Show entry in browser')}" href="${href.browser(new_path, rev=new_rev)}">$new_path</a>
          <a title="${_('Show revision log')}" href="${href.log(new_path, rev=new_rev, stop_rev=old_rev)}">
            <!--! FIXME: message_contains_tag -->
            [$old_rev:$new_rev]</a> における更新
        </h1>
        <h1 py:when="not changeset and not restricted">
          <!--! FIXME: message_contains_tag -->
          <a title="${_('Show entry in browser')}" href="${href.browser(old_path, rev=old_rev)}">$old_path</a>
          @ <a title="${_('Show full changeset')}" href="${href.changeset(old_rev)}">$old_rev</a>
          から <a title="${_('Show entry in browser')}" href="${href.browser(new_path, rev=new_rev)}">$new_path</a>
          @ <a title="${_('Show full changeset')}" href="${href.changeset(new_rev)}">$new_rev</a> における更新
          </h1>
        <h1 py:otherwise="">${_('Changeset')} <a py:strip="not annotated" title="${_('Show full changeset')}" href="${href.changeset(new_rev)}">$new_rev</a></h1>
      </div>

      <form py:if="not xhr and (has_diffs or diff.options.ignoreblanklines or diff.options.ignorecase or
                                diff.options.ignorewhitespace)"
        id="prefs" action="">
        <div>
          <py:if test="not changeset">
            <input type="hidden" name="old_path" value="$old_path" />
            <input type="hidden" name="new_path" value="$new_path" />
            <input type="hidden" name="old" value="$old_rev" />
            <input type="hidden" name="new" value="$new_rev" />
          </py:if>
          ${diff_options_fields(diff)}
        </div>
      </form>

      <py:def function="node_change(idx,item,cl,kind)">
        <py:with vars="ndiffs = item.diffs is not None and len(item.diffs) or 0;
                       nprops = len(item.props);
                       is_removal = cl == 'rem';
                       path = is_removal and item.old.get('path') or item.new.get('path');
                       path = path and path[len(location):].strip('/')">
          <div class="$cl"> </div>
          <py:choose>
            <a py:when="is_removal" title="${_('Show what was removed (rev. %(field)s)', field=item.old.rev)}" href="$item.old.href">
              $path
            </a>
            <a py:otherwise="" title="${_('Show entry in browser')}" href="$item.new.href">
              ${path or (location and '.') or '(root)'}
            </a>
          </py:choose>
          <span class="comment">($kind)</span>
          <py:if test="item.old and item.old.get('path') and item.change == 'copy' or item.change == 'move'">
            <small><em>
              (${_('%(kind)s from', kind=kind)}<a title="${_('Show original file (rev. %(rev)s)', rev=item.old.rev)}" href="$item.old.href">
               $item.old.path</a>)
            </em></small>
          </py:if>
          <py:choose>
            <py:when test="'hide_diff' in item">
              (<a title="${_('Show differences')}" href="$item.href">${_('View diffs')}</a>)
            </py:when>
            <py:when test="ndiffs + nprops &gt; 0">
              (<a title="${_('Show differences')}" href="#file$idx">${
                 plural(ndiffs,'diff')}${
                 (ndiffs and nprops) and ', ' or ''
                }${plural(nprops, 'prop')}</a>)
            </py:when>
          </py:choose>
          <py:if test="cl == 'mod' and item.diffs is None">
            (<a title="${_('Show previous version in browser')}" href="$item.old.href">${_('previous')}</a>)
          </py:if>
        </py:with>
      </py:def>

      <dl id="overview">
        <py:if test="changeset">
          <dt class="property time">${_('Timestamp')}:</dt>
          <!--! FIXME: message_contains_tag -->
          <dd class="time">${format_datetime(changeset.date)} (${(datetime.now(utc) - changeset.date) &lt; timedelta(0, 3600) and \
                                                                 _('less than one hour') or dateinfo(changeset.date)} 前)</dd>
          <dt class="property author">${_('Author')}:</dt>
          <dd class="author">${authorinfo(changeset.author)}</dd>
          <py:for each="prop in properties" py:choose="">
            <py:when test="prop.rendered">
              <dt py:attrs="prop.rendered.name_attributes" py:content="prop.rendered.name" />
              <dd py:attrs="prop.rendered.content_attributes" py:content="prop.rendered.content" />
            </py:when>
            <py:otherwise>
              <dt class="property">$prop.name:</dt>
              <dd>$prop.value</dd>
            </py:otherwise>
          </py:for>
          <dt class="property message">${_('Message')}:</dt>
          <dd class="message searchable" py:choose="" xml:space="preserve">
            <py:when test="not len(changeset.message.strip())">
            &nbsp;
            </py:when>
            <py:when test="wiki_format_messages">
              ${wiki_to_html(context('changeset', changeset.rev), changeset.message, escape_newlines=True)}
            </py:when>
            <py:otherwise><pre>${changeset.message}</pre></py:otherwise>
          </dd>
        </py:if>
        <py:if test="location">
          <dt class="property location">${_('Location')}:</dt>
          <dd class="searchable"><a href="${req.href.browser(location, rev=new_rev)}">$location</a></dd>
        </py:if>
        <dt class="property files">${files and _('Files') + ':' or _('(No files)')}</dt>
        <dd class="files">
          <div class="legend" id="file-legend" py:if="filestats">
            <dl>
              <py:if test="filestats['add']"><dt class="add"></dt><dd>${filestats['add']} ${_('added')}</dd></py:if>
              <py:if test="filestats['delete']"><dt class="rem"></dt><dd>${filestats['delete']} ${_('removed')}</dd></py:if>
              <py:if test="filestats['edit']"><dt class="mod"></dt><dd>${filestats['edit']} ${_('modified')}</dd></py:if>
              <py:if test="filestats['copy']"><dt class="cp"></dt><dd>${filestats['copy']} ${_('copied')}</dd></py:if>
              <py:if test="filestats['move']"><dt class="mv"></dt><dd>${filestats['move']} ${_('moved')}</dd></py:if>
            </dl>
          </div>
          <br />
          <ul>
            <li py:for="idx,item in enumerate(changes)" py:choose="item.change">
              <py:when test="'add'">${node_change(idx, item, 'add', _('added'))}</py:when>
              <py:when test="'delete'">${node_change(idx, item, 'rem', _('deleted'))}</py:when>
              <py:when test="'copy'">${node_change(idx, item, 'cp', _('copied'))}</py:when>
              <py:when test="'move'">${node_change(idx, item, 'mv', _('moved'))}</py:when>
              <py:when test="'edit'">${node_change(idx, item, 'mod', _('modified'))}</py:when>
              <py:otherwise><!-- ignored change (maybe because of diff options or ignored prop.) --></py:otherwise>
            </li>
          </ul>
        </dd>
      </dl>

      <div class="diff">
        <div class="legend" id="diff-legend" py:if="has_diffs">
          <h3>${_('Legend')}:</h3>
          <dl>
            <dt class="unmod"></dt><dd>${_('Unmodified')}</dd>
            <dt class="add"></dt><dd>${_('Added')}</dd>
            <dt class="rem"></dt><dd>${_('Removed')}</dd>
            <py:if test="diff.style != 'inline'">
              <dt class="mod"></dt><dd>${_('Modified')}</dd>
            </py:if>
          </dl>
        </div>

        <xi:include href="diff_div.html" py:with="no_id = False" />

      </div>
    </div>
  </body>
</html>
