use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class FilesInCommitIT method setUp.
@Before
public void setUp() throws Exception {
baseConfig.setString("cache", "git_file_diff", "timeout", "1 minute");
ObjectId headCommit = testRepo.getRepository().resolve("HEAD");
addCommit(headCommit, ImmutableMap.of("file_1.txt", "file 1 content", "file_2.txt", "file 2 content"));
Result result = createEmptyChange();
changeId = result.getChangeId();
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class FilesInCommitIT method listFilesForMergeCommitAgainstParent1.
@Test
public void listFilesForMergeCommitAgainstParent1() throws Exception {
PushOneCommit.Result result = createMergeCommitChange("refs/for/master", "my_file.txt");
String changeId = result.getChangeId();
addModifiedPatchSet(changeId, "my_file.txt", content -> content.concat("Line I\nLine II\n"));
String lastCommitId = gApi.changes().id(changeId).get().currentRevision;
// Diffing against the first parent.
Map<String, FileInfo> changedFiles = gApi.projects().name(project.get()).commit(lastCommitId).files(1);
assertThat(changedFiles.keySet()).containsExactly("/COMMIT_MSG", "/MERGE_LIST", // file bar is coming from parent two
"bar", "my_file.txt");
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class FilesInCommitIT method listFilesForMergeCommitAgainstDefaultParent.
@Test
public void listFilesForMergeCommitAgainstDefaultParent() throws Exception {
PushOneCommit.Result result = createMergeCommitChange("refs/for/master", "my_file.txt");
String changeId = result.getChangeId();
addModifiedPatchSet(changeId, "my_file.txt", content -> content.concat("Line I\nLine II\n"));
String lastCommitId = gApi.changes().id(changeId).get().currentRevision;
// When parentNum is 0, the diff is performed against the default base. In this case, the
// auto-merge commit.
Map<String, FileInfo> changedFiles = gApi.projects().name(project.get()).commit(lastCommitId).files(0);
assertThat(changedFiles.keySet()).containsExactly("/COMMIT_MSG", "/MERGE_LIST", // file bar is coming from parent two
"bar", "my_file.txt");
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class RestApiServletIT method xGerritUpdatedRefNotSetWhenUpdatedRefNotEnabled.
@Test
public void xGerritUpdatedRefNotSetWhenUpdatedRefNotEnabled() throws Exception {
Result change = createChange();
String origin = adminRestSession.url();
RestResponse response = adminRestSession.putWithHeaders("/changes/" + change.getChangeId() + "/topic", /* content= */
"A", new BasicHeader(ORIGIN, origin), new BasicHeader(X_GERRIT_UPDATED_REF_ENABLED, "false"));
response.assertOK();
assertThat(gApi.changes().id(change.getChangeId()).topic()).isEqualTo("A");
// Meta ref updated because of topic update, but updated refs are not enabled.
assertThat(response.getHeader(X_GERRIT_UPDATED_REF)).isNull();
}
use of com.google.gerrit.acceptance.PushOneCommit.Result in project gerrit by GerritCodeReview.
the class RestApiServletIT method xGerritUpdatedRefNotSetByDefault.
@Test
public void xGerritUpdatedRefNotSetByDefault() throws Exception {
Result change = createChange();
String origin = adminRestSession.url();
RestResponse response = adminRestSession.putWithHeaders("/changes/" + change.getChangeId() + "/topic", /* content= */
"A", new BasicHeader(ORIGIN, origin));
response.assertOK();
assertThat(gApi.changes().id(change.getChangeId()).topic()).isEqualTo("A");
// Meta ref updated because of topic update, but updated refs are not set by default.
assertThat(response.getHeader(X_GERRIT_UPDATED_REF)).isNull();
}
Aggregations