mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
added client method to fetch a single changeset
This commit is contained in:
@@ -35,6 +35,7 @@ package sonia.scm.client;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.repository.Changeset;
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,6 +46,18 @@ import sonia.scm.repository.ChangesetPagingResult;
|
|||||||
public interface ClientChangesetHandler
|
public interface ClientChangesetHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param revision
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
public Changeset getChangeset(String revision);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.client;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.repository.Changeset;
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
|
|
||||||
@@ -66,6 +67,42 @@ public class JerseyClientChangesetHandler implements ClientChangesetHandler
|
|||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param revision
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Changeset getChangeset(String revision)
|
||||||
|
{
|
||||||
|
Changeset changeset = null;
|
||||||
|
String url =
|
||||||
|
session.getUrlProvider().getRepositoryUrlProvider().getChangesetUrl(
|
||||||
|
repository.getId(), revision);
|
||||||
|
WebResource resource = session.getClient().resource(url);
|
||||||
|
ClientResponse response = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = resource.get(ClientResponse.class);
|
||||||
|
|
||||||
|
if (response.getStatus() != ScmClientException.SC_NOTFOUND)
|
||||||
|
{
|
||||||
|
ClientUtil.checkResponse(response, 200);
|
||||||
|
changeset = response.getEntity(Changeset.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ClientUtil.close(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return changeset;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -79,6 +79,19 @@ public interface RepositoryUrlProvider extends ModelUrlProvider
|
|||||||
public String getChangesetUrl(String repositoryId, String path,
|
public String getChangesetUrl(String repositoryId, String path,
|
||||||
String revision, int start, int limit);
|
String revision, int start, int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param repositoryId
|
||||||
|
* @param revision
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
public String getChangesetUrl(String repositoryId, String revision);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ public class RestRepositoryUrlProvider extends RestModelUrlProvider
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String PART_BROWSE = "browse";
|
public static final String PART_BROWSE = "browse";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
public static final String PART_CHANGESET = "changeset";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String PART_CHANGESETS = "changesets";
|
public static final String PART_CHANGESETS = "changesets";
|
||||||
|
|
||||||
@@ -177,6 +182,26 @@ public class RestRepositoryUrlProvider extends RestModelUrlProvider
|
|||||||
PARAMETER_LIMIT, limit).toString();
|
PARAMETER_LIMIT, limit).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param repositoryId
|
||||||
|
* @param revision
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getChangesetUrl(String repositoryId, String revision)
|
||||||
|
{
|
||||||
|
revision = UrlUtil.fixRevision(revision);
|
||||||
|
|
||||||
|
return new UrlBuilder(base).appendUrlPart(repositoryId).appendUrlPart(
|
||||||
|
PART_CHANGESET).appendUrlPart(revision).append(extension).toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ public class WUIRepositoryUrlProvider extends WUIModelUrlProvider
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String VIEW_BLAME = "blame";
|
public static final String VIEW_BLAME = "blame";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
public static final String VIEW_CHANGESET = "changeset";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String VIEW_CONTENT = "content";
|
public static final String VIEW_CONTENT = "content";
|
||||||
|
|
||||||
@@ -167,6 +172,26 @@ public class WUIRepositoryUrlProvider extends WUIModelUrlProvider
|
|||||||
repositoryId).append(start).append(limit).toString();
|
repositoryId).append(start).append(limit).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param repositoryId
|
||||||
|
* @param revision
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* @since 1.12
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getChangesetUrl(String repositoryId, String revision)
|
||||||
|
{
|
||||||
|
revision = UrlUtil.fixRevision(revision);
|
||||||
|
|
||||||
|
return new WUIUrlBuilder(baseUrl, VIEW_CHANGESET).append(
|
||||||
|
repositoryId).append(revision).toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user