mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
Add raw stream result to cat command
This commit is contained in:
@@ -37,17 +37,16 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Closeables;
|
||||
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.web.HgUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -83,16 +82,9 @@ public class HgCatCommand extends AbstractCommand implements CatCommand
|
||||
public void getCatResult(CatCommandRequest request, OutputStream output)
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
com.aragost.javahg.commands.CatCommand cmd =
|
||||
com.aragost.javahg.commands.CatCommand.on(open());
|
||||
|
||||
cmd.rev(HgUtil.getRevision(request.getRevision()));
|
||||
|
||||
InputStream input = null;
|
||||
|
||||
InputStream input = getCatResultStream(request);
|
||||
try
|
||||
{
|
||||
input = cmd.execute(request.getPath());
|
||||
ByteStreams.copy(input, output);
|
||||
}
|
||||
finally
|
||||
@@ -100,4 +92,14 @@ public class HgCatCommand extends AbstractCommand implements CatCommand
|
||||
Closeables.close(input, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getCatResultStream(CatCommandRequest request) throws IOException, RepositoryException {
|
||||
com.aragost.javahg.commands.CatCommand cmd =
|
||||
com.aragost.javahg.commands.CatCommand.on(open());
|
||||
|
||||
cmd.rev(HgUtil.getRevision(request.getRevision()));
|
||||
|
||||
return cmd.execute(request.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user