<!--!  Copyright (C) 2006-2014 Edgewall Software

  This software is licensed as described in the file COPYING, which
  you should have received as part of this distribution. The terms
  are also available at http://trac.edgewall.com/license.html.

  This software consists of voluntary contributions made by many
  individuals. For the exact contribution history, see the revision
  history and logs, available at http://trac.edgewall.org/.
-->
<!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:i18n="http://genshi.edgewall.org/i18n"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.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="" py:with="
          cset_href = href.changeset(new_rev, reponame);
          old_cset_href = href.changeset(old_rev, reponame);
          log_href = href.log(reponame, new_path, rev=new_rev, stop_rev=old_rev);
          new_href = href.browser(reponame, new_path, rev=new_rev);
          old_href = href.browser(reponame, old_path, rev=old_rev);
          old_drev = display_rev(old_rev);
          new_drev = display_rev(new_rev);
            ">
        <py:when test="reponame">
          <py:choose>
            <h1 py:when="changeset and restricted" i18n:msg="new_rev, reponame, new_path">
              Changeset <a title="Show full changeset" href="$cset_href">$new_drev</a> in $reponame
              for <a title="Show entry in browser" href="$new_href">$new_path</a>
            </h1>
            <h1 py:when="not changeset and restricted" i18n:msg="new_path, old_rev, new_rev, reponame">
              Changes in <a title="Show entry in browser" href="$new_href">$new_path</a>
              <a title="Show revision log" href="$log_href">[$old_drev:$new_drev]</a> in $reponame
            </h1>
            <h1 py:when="not changeset and not restricted" i18n:msg="reponame, old_path, old_rev, new_path, new_rev">
              Changes in $reponame
              from <a title="Show entry in browser" href="$old_href">$old_path</a>
              at <a title="Show full changeset" href="$old_cset_href">r$old_drev</a>
              to <a title="Show entry in browser" href="$new_href">$new_path</a>
              at <a title="Show full changeset" href="$cset_href">r$new_drev</a>
            </h1>
            <h1 py:otherwise="" i18n:msg="new_rev, reponame">
              Changeset <a py:strip="not annotated" href="$cset_href">$new_drev</a> in $reponame
            </h1>
          </py:choose>
        </py:when>
        <py:otherwise>
          <py:choose>
            <h1 py:when="changeset and restricted" i18n:msg="new_rev, new_path">
              Changeset <a title="Show full changeset" href="$cset_href">$new_drev</a>
              for <a title="Show entry in browser" href="$new_href">$new_path</a>
            </h1>
            <h1 py:when="not changeset and restricted" i18n:msg="new_path, old_rev, new_rev">
              Changes in <a title="Show entry in browser" href="$new_href">$new_path</a>
              <a title="Show revision log" href="$log_href">[$old_drev:$new_drev]</a>
            </h1>
            <h1 py:when="not changeset and not restricted" i18n:msg="old_path, old_rev, new_path, new_rev">
              Changes
              from <a title="Show entry in browser" href="$old_href">$old_path</a>
              at <a title="Show full changeset" href="$old_cset_href">r$old_drev</a>
              to <a title="Show entry in browser" href="$new_href">$new_path</a>
              at <a title="Show full changeset" href="$cset_href">r$new_drev</a>
            </h1>
            <h1 py:otherwise="" i18n:msg="new_rev">
              Changeset <a py:strip="not annotated" href="$cset_href">$new_drev</a>
            </h1>
          </py:choose>
        </py:otherwise>
      </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="${'/' + pathjoin(reponame, old_path)}" />
            <input type="hidden" name="new_path" value="${'/' + pathjoin(reponame, new_path)}" />
            <input type="hidden" name="old" value="$old_rev" />
            <input type="hidden" name="new" value="$new_rev" />
          </py:if>
          <xi:include href="diff_options.html" />
        </div>
      </form>

      <py:def function="node_change(idx,item,cl,kind)">
        <py:with vars="ndiffs = len(item.diffs) if item.diffs is not None else 0;
                       nprops = len(item.props);
                       is_removal = cl == 'rem';
                       path = item.old.get('path') if is_removal else item.new.get('path');
                       path = path and path[len(location):].strip('/')">
          <div class="$cl"> </div>
          <py:choose>
            <a py:when="is_removal" href="$item.old.href"
               title="${_('Show what was removed (content at revision %(old_rev)s)', old_rev=display_rev(item.old.rev))}">
              $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 i18n:msg="kind, old_path">
              ($kind from <a href="$item.old.href"
                             title="${_('Show original file (revision %(old_rev)s)', old_rev=display_rev(item.old.rev))}">
                $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">${
                 ngettext('%(num)d diff', '%(num)d diffs', ndiffs) if ndiffs else None}${
                 ', ' if ndiffs and nprops else None
                }${ngettext('%(num)d prop', '%(num)d props', nprops) if nprops else None}</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" py:choose="datetime.now(utc) - changeset.date &lt; timedelta(0, 3600)">
             ${format_datetime(changeset.date)}
             <py:when test="True">(less than one hour ago)</py:when>
             <py:otherwise><i18n:msg params="age">(${dateinfo(changeset.date)} ago)</i18n:msg></py:otherwise>
          </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.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="${href.browser(reponame, location, rev=new_rev)}">$location</a></dd>
        </py:if>
        <dt class="property files">
          ${ngettext('File:', 'Files:', num=len(files)) if files else _('(No files)')}
        </dt>
        <dd class="files">
          <div class="legend" id="file-legend" py:if="filestats">
            <dl py:with="added, deleted, edited, copied, moved = [filestats[k] for k in ('add', 'delete', 'edit', 'copy', 'move')]">
              <py:if test="added"><dt class="add"></dt><dd>${ngettext('%(num)d added', '%(num)d added', num=added)}</dd></py:if>
              <py:if test="deleted"><dt class="rem"></dt><dd>${ngettext('%(num)d deleted', '%(num)d deleted', num=deleted)}</dd></py:if>
              <py:if test="edited"><dt class="mod"></dt><dd>${ngettext('%(num)d edited', '%(num)d edited', num=edited)}</dd></py:if>
              <py:if test="copied"><dt class="cp"></dt><dd>${ngettext('%(num)d copied', '%(num)d copied', num=copied)}</dd></py:if>
              <py:if test="moved"><dt class="mv"></dt><dd>${ngettext('%(num)d moved', '%(num)d moved', num=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 id="help" i18n:msg="">
          <strong>Note:</strong> See <a href="${href.wiki('TracChangeset')}">TracChangeset</a>
          for help on using the changeset viewer.
        </div>

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