use of org.eclipse.che.api.git.DiffPage in project che by eclipse.
the class DiffTest method readDiff.
private List<String> readDiff(DiffParams params, GitConnection connection) throws GitException, IOException {
DiffPage diffPage = connection.diff(params);
ByteArrayOutputStream out = new ByteArrayOutputStream();
diffPage.writeTo(out);
BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(out.toByteArray())));
String line;
List<String> diff = new ArrayList<>();
while ((line = reader.readLine()) != null) diff.add(line);
return diff;
}
use of org.eclipse.che.api.git.DiffPage in project che by eclipse.
the class DiffTest method testDiffRawWithCommits.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffRawWithCommits(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
makeCommitInMaster(connection);
connection.add(AddParams.create(singletonList("aaa")));
connection.rm(RmParams.create(singletonList("README.txt")));
connection.commit(CommitParams.create("testDiffNameStatusWithCommits"));
//when
DiffParams params = DiffParams.create().withFileFilter(null).withType(DiffType.RAW).withNoRenames(false).withRenameLimit(0).withCommitA("HEAD^1").withCommitB("HEAD");
DiffPage diffPage = connection.diff(params);
//then
diffPage.writeTo(System.out);
}
use of org.eclipse.che.api.git.DiffPage in project che by eclipse.
the class DiffTest method testDiffRaw.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffRaw(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
makeCommitInMaster(connection);
//when
DiffParams params = DiffParams.create().withFileFilter(null).withType(DiffType.RAW).withNoRenames(false).withRenameLimit(0);
DiffPage diffPage = connection.diff(params);
//then
diffPage.writeTo(System.out);
}
Aggregations