Normalized to ends with '/', like http://svn.apache.org/wsvn/ + * It may contain a query parameter like ?root=foobar, so relative + * URL construction needs to be done with care.
+ */ + public final URL url; + + /** + * Creates a new SVNWeb object. + * + * @param url DOCUMENT ME! + * + * @throws MalformedURLException DOCUMENT ME! + */ + @DataBoundConstructor + public SVNWeb(URL url) throws MalformedURLException { + this.url = normalizeToEndWithSlash(url); + } + + /** + * Returns the diff link value. + * + * @param path the given path value. + * + * @return the diff link value. + * + * @throws IOException DOCUMENT ME! + */ + @Override public URL getDiffLink(Path path) throws IOException { + if (path.getEditType() != EditType.EDIT) { + return null; // no diff if this is not an edit change + } + final int r = path.getLogEntry().getRevision(); + return new URL(url, + "diff/" + trimHeadSlash(path.getValue()) + + param().add("rev1=" + (r-1) + ";rev2=" + r) + ); + } + + /** + * Returns the file link value. + * + * @param path the given path value. + * + * @return the file link value. + * + * @throws IOException DOCUMENT ME! + */ + @Override public URL getFileLink(Path path) throws IOException { + final int r = path.getLogEntry().getRevision(); + return new URL(url, + "view/" + trimHeadSlash(path.getValue()) + + param().add("rev=" + r) + ); + } + + /** + * Returns the change set link value. + * + * @param changeSet the given changeSet value. + * + * @return the change set link value. + * + * @throws IOException DOCUMENT ME! + */ + @Override public URL getChangeSetLink(SubversionChangeLogSet.LogEntry changeSet) + throws IOException { + final int r = changeSet.getRevision(); + return new URL(url, + "revision/" + + param().add("rev=" + r) + ); + } + + private QueryBuilder param() { + return new QueryBuilder(url.getQuery()); + } +} \ No newline at end of file Property changes on: src\main\java\hudson\scm\browsers\SVNWeb.java ___________________________________________________________________ Added: svn:mime-type + text/plain