mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
added format option as query param for diff resource
This commit is contained in:
@@ -68,6 +68,7 @@ import sonia.scm.repository.api.BrowseCommandBuilder;
|
|||||||
import sonia.scm.repository.api.CatCommandBuilder;
|
import sonia.scm.repository.api.CatCommandBuilder;
|
||||||
import sonia.scm.repository.api.CommandNotSupportedException;
|
import sonia.scm.repository.api.CommandNotSupportedException;
|
||||||
import sonia.scm.repository.api.DiffCommandBuilder;
|
import sonia.scm.repository.api.DiffCommandBuilder;
|
||||||
|
import sonia.scm.repository.api.DiffFormat;
|
||||||
import sonia.scm.repository.api.LogCommandBuilder;
|
import sonia.scm.repository.api.LogCommandBuilder;
|
||||||
import sonia.scm.repository.api.RepositoryService;
|
import sonia.scm.repository.api.RepositoryService;
|
||||||
import sonia.scm.repository.api.RepositoryServiceFactory;
|
import sonia.scm.repository.api.RepositoryServiceFactory;
|
||||||
@@ -129,11 +130,7 @@ public class RepositoryResource
|
|||||||
*
|
*
|
||||||
* @param configuration
|
* @param configuration
|
||||||
* @param repositoryManager
|
* @param repositoryManager
|
||||||
* @param securityContextProvider
|
|
||||||
* @param servicefactory
|
* @param servicefactory
|
||||||
* @param changesetViewerUtil
|
|
||||||
* @param repositoryBrowserUtil
|
|
||||||
* @param blameViewerUtil
|
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public RepositoryResource(ScmConfiguration configuration,
|
public RepositoryResource(ScmConfiguration configuration,
|
||||||
@@ -837,6 +834,7 @@ public class RepositoryResource
|
|||||||
* @param id the id of the repository
|
* @param id the id of the repository
|
||||||
* @param revision the revision of the file
|
* @param revision the revision of the file
|
||||||
* @param path path to the file
|
* @param path path to the file
|
||||||
|
* @param format
|
||||||
*
|
*
|
||||||
* @return the modifications of a {@link Changeset}
|
* @return the modifications of a {@link Changeset}
|
||||||
*
|
*
|
||||||
@@ -848,7 +846,8 @@ public class RepositoryResource
|
|||||||
@TypeHint(DiffStreamingOutput.class)
|
@TypeHint(DiffStreamingOutput.class)
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
public Response getDiff(@PathParam("id") String id,
|
public Response getDiff(@PathParam("id") String id,
|
||||||
@QueryParam("revision") String revision, @QueryParam("path") String path)
|
@QueryParam("revision") String revision, @QueryParam("path") String path,
|
||||||
|
@QueryParam("format") DiffFormat format)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException, IOException
|
||||||
{
|
{
|
||||||
AssertUtil.assertIsNotEmpty(id);
|
AssertUtil.assertIsNotEmpty(id);
|
||||||
@@ -879,6 +878,11 @@ public class RepositoryResource
|
|||||||
builder.setPath(path);
|
builder.setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (format != null)
|
||||||
|
{
|
||||||
|
builder.setFormat(format);
|
||||||
|
}
|
||||||
|
|
||||||
String name = service.getRepository().getName().concat("-").concat(
|
String name = service.getRepository().getName().concat("-").concat(
|
||||||
revision).concat(".diff");
|
revision).concat(".diff");
|
||||||
String contentDispositionName = getContentDispositionName(name);
|
String contentDispositionName = getContentDispositionName(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user