Applies to: VisualSVN 8.4 and later
This article provides instructions on how to set the so-called webviewer (or web interface) Subversion properties, which allow Subversion clients to provide additional commands and features related to viewing the repository in the web interface.
In particular, when the webviewer properties are set in the repository, it becomes possible to use the Open in Web Interface command in the VisualSVN plug-in for Microsoft Visual Studio. For details about this feature and other uses of these properties, see Features relying on webviewer properties.
Typically, the webviewer properties should be set by the administrator of the repository server or by a user who has similar extensive Write permissions to this repository's folders.
Why are webviewer properties required?
Webviewer properties are used to specify the URLs at which users can access the repository's web interface in a web browser. The URLs of the web interface for viewing the repository in a web browser may differ from the URLs used to access the repository from a dedicated Subversion client (e.g. when checking out files on the command line). The URLs of the repository's web interface may also be different, depending on the particular Subversion server or repository hosting service.
For example, the URL to check out the trunk directory from a repository with the command-line Subversion client might be as follows:
Whereas for this same repository, the URL to view the trunk in the repository's web interface in a web browser might look as follows (in this example, for VisualSVN Server):
Features relying on webviewer properties
The following features become available for the repository only when the repository has the webviewer properties set in it.
Additional command in the VisualSVN plugin
Available since VisualSVN 8.4
When the webviewer:pathrevision
property is set, it is
possible to use the Open in Web Interface command in the VisualSVN
plug-in for Microsoft Visual Studio. In Visual Studio, using this command
in a working copy is the quick way to open the corresponding repository in
a web browser. If the webviewer:pathrevline
property is set
as well, you can also right-click a line in a file and select VisualSVN
| Open in Web Interface to go directly to this line in the
repository's web interface.
Additional commands in TortoiseSVN
When the webviewer:pathrevision
and
webviewer:revision
properties are defined, the following two
additional commands will become available in the right-click context menu
in the Repo-browser window and in the Show log window of
TortoiseSVN:
-
View revision for path in webviewer command (opens the link from
webviewer:pathrevision
in a web browser for the currently selected path and revision) -
View revision in webviewer command (opens the link from
webviewer:revision
in a web browser for the currently selected revision)
Link to the commit in email commit notifications
If you use VisualSVN Server as your Subversion server and the
webviewer:revision
property is defined in the repository, it
is used by the VisualSVNServerHooks.exe
commit-notification hook. Inside the commit notification email, the
hook will add a web link (URL) for viewing the details of the respective
commit in a web browser.
On which directory should you set webviewer properties?
The webviewer properties should be set as directory (folder) properties inside the repository. Like any versioned property in Subversion, a webviewer property applies to the path (directory) on which it is explicitly set, and is also inherited recursively by all the children of that path in the directory hierarchy. However, to receive the inherited property on such child paths, the user needs to have Read access to the parent path that has the explicitly set property.
Because of that, choose one of the following ways to set the webviewer properties:
- Set the webviewer properties just in one place—on the root folder of the repository—if users have Read access to this root folder.
- Or set the properties on the highest level folder that users are allowed to Read. For example, on the root folder of a particular project in the repository. Or on the project's trunk, branches and tags folders.
What value should you set in webviewer properties?
In the webviewer properties, you should specify the template of the web address (URL) at which users can view the repository in a web browser. There are the following three webviewer properties, which have slightly different purposes:
-
webviewer:pathrevision
should contain the URL for viewing a requested path in the repository at a requested revision. This URL should contain placeholder variables%REVISION%
and%PATH%
. At this URL, the web browser should display the contents of the requested directory or file as it was at the requested revision. -
webviewer:pathrevline
should contain the URL that links directly to a requested line in a file, which is located at a requested repository path at a requested revision. This URL should contain placeholder variables%REVISION%
,%PATH%
and%LINE%
. This webviewer property is optional and is currently used only by the supporting VisualSVN plug-in for Microsoft Visual Studio. If this property is not set, then thewebviewer:pathrevision
property is used as a fallback, but without the ability to open a file directly at a specific line in the web interface. -
webviewer:revision
should contain the URL for viewing a requested revision. This URL should contain only one placeholder variable:%REVISION%
. Typically, the URL provided in this property should display the details about a requested commit (the committed changes and the commit message) in a web browser.
The commands that use these properties will automatically substitute the
%REVISION%
and %PATH%
and %LINE%
variables with a requested revision number (e.g. 42
),
requested path (relative to the root of the repository, e.g.
/branches/my_feature
) and the requested line number
respectively.
Example for VisualSVN Server
For example, if you use VisualSVN Server as your Subversion server, then the webviewer properties should be set as follows:
Property name: webviewer:pathrevision
Property value:
https://svn.example.com/!/#MyRepo/view/r%REVISION%%PATH%
Property name: webviewer:pathrevline
Property value:
https://svn.example.com/!/#MyRepo/view/r%REVISION%%PATH%?line=%LINE%
Property name: webviewer:revision
Property value:
https://svn.example.com/!/#MyRepo/commit/r%REVISION%
In these property values, you need to replace
svn.example.com
with the domain name of the computer
that runs VisualSVN Server, and replace MyRepo
with
the name of your repository.
How to set webviewer properties with TortoiseSVN
To set the webviewer properties with the help of TortoiseSVN, perform the following steps:
- Open the TortoiseSVN Repository Browser.
-
When prompted, enter the URL of the repository, in the standard format
for accessing the repository from a dedicated Subversion client. For
example:
https://svn.example.com/svn/MyRepo/
. Click OK. -
In the left-hand pane of the repository browser, right-click the directory on which you want to set the property. For example, right-click the repository's root directory, displayed as the topmost node:
https://svn.example.com/svn/MyRepo
. From the context menu, select Show properties.If unsure, see the section On which directory should you set webviewer properties? above.
- In the Properties window, click New | Other.
-
In the Property name field specify
webviewer:pathrevision
by selecting it from the drop-down list or by entering (pasting) it into the field.TipSelecting the Property name from the drop-down box is generally recommended, to avoid typos in the property name. -
Specify the Property value. For
webviewer:pathrevision
, the value should be the URL template for viewing a requested path at a requested revision in a web browser. For example:https://svn.example.com/!/#MyRepo/view/r%REVISION%%PATH%
For more information, see the section What value should you set in webviewer properties? above. Click OK to confirm the change.
NoteDo not select the Apply property recursively checkbox (which would explicitly set the property on the child paths), if your version of TortoiseSVN displays it. The child paths will inherit the property even when this option is disabled. - When prompted, enter any commit log message. And commit this change by clicking OK again.
-
In the same way as described in steps 3-7 above, set the
webviewer:pathrevline
property.It should specify the URL template for opening a requested file at a requested line in a web browser, if your server's web interface supports links to specific lines in a file.
TipWhen specifying the Property name for this particular property, you need to type (or paste) its name into the field, since currently this property name is not listed in the drop-down box.For example, the Property value for
webviewer:pathrevline
might be:https://svn.example.com/!/#MyRepo/view/r%REVISION%%PATH%?line=%LINE%
For more information, see the section What value should you set in webviewer properties? above.
-
In the same way as described in steps 3-7 above, set the
webviewer:revision
property.This should be the URL template for viewing a requested revision in a web browser. Typically, this is the URL template for viewing a particular commit.
For example, the Property value for
webviewer:revision
might be:https://svn.example.com/!/#MyRepo/commit/r%REVISION%
For more information, see the section What value should you set in webviewer properties? above.
- Close the Repo-browser windows.
- Once users update their working copy, they will be able to use the Open in Web Interface command in the VisualSVN plug-in in Visual Studio.