<!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">
          Changeset <a title="Show full changeset" href="${href.changeset(new_rev)}">$new_rev</a>
          for <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">
          Changes in <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)}">
            [$old_rev:$new_rev]</a>
        </h1>
        <h1 py:when="not changeset and not restricted">
          Changes from <a title="Show entry in browser" href="${href.browser(old_path, rev=old_rev)}">$old_path</a>
          at <a title="Show full changeset" href="${href.changeset(old_rev)}">r$old_rev</a>
          to <a title="Show entry in browser" href="${href.browser(new_path, rev=new_rev)}">$new_path</a>
          at <a title="Show full changeset" href="${href.changeset(new_rev)}">r$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. $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 from <a title="Show original file (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>
          <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)} ago)</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>
