<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
<sect1 id="tsvn-dug-repoviewer">
  <title>Integration with Web-based Repository Viewers</title>
  <indexterm>
    <primary>web view</primary>
  </indexterm>
  <indexterm>
    <primary>repo viewer</primary>
  </indexterm>
  <indexterm>
    <primary>ViewVC</primary>
  </indexterm>
  <indexterm>
    <primary>WebSVN</primary>
  </indexterm>
  <para>
    There are several web-based repository viewers available for use with
    Subversion such as
    <ulink url="https://www.viewvc.org/">
      <citetitle>ViewVC</citetitle>
    </ulink>
    and
    <ulink url="https://websvnphp.github.io/">
      <citetitle>WebSVN</citetitle>
    </ulink>.
    TortoiseSVN provides a means to link with these viewers.
  </para>
  <para>
    You can integrate a repo viewer of your choice in TortoiseSVN.
    To do this, you have to define some properties which define the linkage.
    They must be set on Folders: (<xref linkend="tsvn-dug-propertypage"/>)
  </para>
  <para>
    <variablelist>
      <varlistentry>
        <term condition="pot">webviewer:revision</term>
        <listitem>
          <para>
            Set this property to the URL of your repo viewer to view all
            changes in a specific revision.
            It must be properly URI encoded and it has to contain
            <literal>%REVISION%</literal>.
            <literal>%REVISION%</literal> is replaced with the revision
            number in question.
            This allows TortoiseSVN to display a context menu entry in the
            log dialog
            <menuchoice>
              <guimenu>Context Menu</guimenu>
              <guimenuitem>View revision in webviewer</guimenuitem>
            </menuchoice>.
          </para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term condition="pot">webviewer:pathrevision</term>
        <listitem>
          <para>
            Set this property to the URL of your repo viewer to view
            changes to a specific file in a specific revision.
            It must be properly URI encoded and it has to contain
            <literal>%REVISION%</literal> and <literal>%PATH%</literal>.
            <literal>%PATH%</literal> is replaced with the path relative
            to the repository root.
            This allows TortoiseSVN to display a context menu entry in the
            log dialog
            <menuchoice>
              <guimenu>Context Menu</guimenu>
              <guimenuitem>View revision for path in webviewer</guimenuitem>
            </menuchoice>
            For example, if you right click in the log dialog bottom pane
            on a file entry <literal>/trunk/src/file</literal> then the
            <literal>%PATH%</literal> in the URL will be replaced with
            <literal>/trunk/src/file</literal>.
          </para>
        </listitem>
      </varlistentry>
    </variablelist>
  </para>
  <para>
    You can also use relative URLs instead of absolute ones. This is useful
    in case your web viewer is on the same domain/server as your source
    repository. In case the domain name ever changes, you don't have to adjust
    the <literal>webviewer:revision</literal> and <literal>webviewer:pathrevision</literal>
    property. The format is the same as for the <literal>bugtraq:url</literal> property.
    See <xref linkend="tsvn-dug-bugtracker"/>.
  </para>
  <important>
    <title>Set the Properties on Folders</title>
    <para>
      These properties must be set on folders for the system to work.
      When you commit a file or folder the properties are read from that folder.
      If the properties are not found there, TortoiseSVN will search upwards
      through the folder tree to find them until it comes to an unversioned
      folder, or the tree root (e.g. <literal>C:\</literal>) is found.
      If you can be sure that each user checks out only from e.g
      <filename>trunk/</filename> and not some sub-folder, then it's enough if
      you set the properties on <filename>trunk/</filename>.
      If you can't be sure, you should set the properties recursively
      on each sub-folder.
      A property setting deeper in the project hierarchy overrides settings on
      higher levels (closer to <filename>trunk/</filename>).
    </para>
    <para>
      For project properties <emphasis>only</emphasis>,
      i.e. <literal>tsvn:</literal>, <literal>bugtraq:</literal>
      and <literal>webviewer:</literal>
      you can use the <guilabel>Recursive</guilabel> checkbox to set
      the property to all sub-folders in the hierarchy, without also
      setting it on all files.
    </para>
  </important>
  <para>
    When you add new sub-folders to a working copy using TortoiseSVN, any
    project properties present in the parent folder
    will automatically be added to the new child folder too.
  </para>
  <tip>
    <title>Limitations Using the Repository Browser</title>
    <para>
      Because the repo viewer integration depends upon accessing Subversion
      properties, you will only see the results when using a checked
      out working copy. Fetching properties remotely is a slow operation,
      so you will not see this feature in action from the repo browser
      unless you started the repo browser from your working copy. If you
      started the repo browser by entering the URL of the repository
      you won't see this feature.
    </para>
    <para>
      For the same reason, project properties will not be propagated
      automatically when a child folder is added using the repo browser.
    </para>
  </tip>
</sect1>
