in javatests/com/googlesource/gerrit/plugins/supermanifest/RepoSuperManifestIT.java [278:329]
public void rawSha1Ref() throws Exception {
setupTestRepos("project");
String remoteXml = " <remote name=\"origin\" fetch=\"" + canonicalWebUrl.get() + "\" />\n";
String defaultXml = " <default remote=\"origin\" revision=\"refs/heads/master\" />\n";
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n"
+ remoteXml
+ defaultXml
+ " <project name=\""
+ testRepoKeys[0].get()
+ "\" path=\"project1\""
+ " revision=\""
+ testRepoCommits[0]
+ "\" />\n"
+ "</manifest>\n";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default.xml", xml)
.to("refs/heads/srcbranch")
.assertOkStatus();
// Push config after XML. Needs a manual trigger to create the destination.
pushConfig(
"[superproject \""
+ superKey.get()
+ ":refs/heads/destbranch\"]\n"
+ " srcRepo = "
+ manifestKey.get()
+ "\n"
+ " srcRef = refs/heads/srcbranch\n"
+ " srcPath = default.xml\n"
+ " ignoreRemoteFailures = true\n"
+ "");
{ // Advance head, but the manifest refers to the previous one.
TestRepository<InMemoryRepository> repo = cloneProject(testRepoKeys[0], admin);
PushOneCommit push = pushFactory.create(admin.newIdent(), repo, "Subject", "file3", "file");
Result r = push.to("refs/heads/master");
r.assertOkStatus();
}
adminRestSession
.post("/projects/" + manifestKey + "/branches/srcbranch/update_manifest")
.assertOK();
BranchApi branch = gApi.projects().name(superKey.get()).branch("refs/heads/destbranch");
assertThat(branch.file("project1").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
assertThat(branch.file("project1").asString()).isEqualTo(testRepoCommits[0]);
}