mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
added blame support to client api
This commit is contained in:
@@ -79,6 +79,9 @@ public class ScmUrlProvider
|
||||
/** Field description */
|
||||
public static final String URLPART_USERS = "users";
|
||||
|
||||
/** Field description */
|
||||
public static final String URLPATTERN_BLAME = "repositories/{0}/blame";
|
||||
|
||||
/** Field description */
|
||||
public static final String URLPATTERN_BROWSE = "repositories/{0}/browse";
|
||||
|
||||
@@ -153,6 +156,24 @@ public class ScmUrlProvider
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repositoryId
|
||||
* @param path
|
||||
* @param revision
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getBlameUrl(String repositoryId, String path, String revision)
|
||||
{
|
||||
String url = MessageFormat.format(getResourceUrl(URLPATTERN_BLAME),
|
||||
repositoryId);
|
||||
|
||||
return appendParameter(url, path, revision);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -215,20 +236,8 @@ public class ScmUrlProvider
|
||||
{
|
||||
String url = MessageFormat.format(getResourceUrl(URLPATTERN_BROWSE),
|
||||
repositoryId);
|
||||
String s = "?";
|
||||
|
||||
if (Util.isNotEmpty(path))
|
||||
{
|
||||
url = url.concat(s).concat("path=").concat(path);
|
||||
s = "&";
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(revision))
|
||||
{
|
||||
url = url.concat(s).concat("revision=").concat(revision);
|
||||
}
|
||||
|
||||
return url;
|
||||
return appendParameter(url, path, revision);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -391,6 +400,36 @@ public class ScmUrlProvider
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param url
|
||||
* @param path
|
||||
* @param revision
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String appendParameter(String url, String path, String revision)
|
||||
{
|
||||
String s = "?";
|
||||
|
||||
if (Util.isNotEmpty(path))
|
||||
{
|
||||
url = url.concat(s).concat("path=").concat(path);
|
||||
s = "&";
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(revision))
|
||||
{
|
||||
url = url.concat(s).concat("revision=").concat(revision);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
|
||||
Reference in New Issue
Block a user