}
}
- public int updateMainBranchName(DbSession dbSession, String projectUuid, String newBranchKey) {
+ public int updateBranchName(DbSession dbSession, String branchUuid, String newBranchKey) {
long now = system2.now();
- return mapper(dbSession).updateMainBranchName(projectUuid, newBranchKey, now);
+ return mapper(dbSession).updateBranchName(branchUuid, newBranchKey, now);
}
public int updateExcludeFromPurge(DbSession dbSession, String branchUuid, boolean excludeFromPurge) {
int update(@Param("dto") BranchDto dto, @Param("now") long now);
- int updateMainBranchName(@Param("projectUuid") String projectUuid, @Param("newBranchName") String newBranchName, @Param("now") long now);
+ int updateBranchName(@Param("branchUuid") String branchUuid, @Param("newBranchName") String newBranchName, @Param("now") long now);
int updateExcludeFromPurge(@Param("uuid") String uuid, @Param("excludeFromPurge") boolean excludeFromPurge,
@Param("now") long now);
)
</insert>
- <update id="updateMainBranchName" parameterType="map">
+ <update id="updateBranchName" parameterType="map">
update project_branches
set
kee = #{newBranchName, jdbcType=VARCHAR},
updated_at = #{now, jdbcType=BIGINT}
where
- uuid = #{projectUuid, jdbcType=VARCHAR}
+ uuid = #{branchUuid, jdbcType=VARCHAR}
</update>
<update id="updateExcludeFromPurge">
dto2.setKey("branch");
underTest.insert(dbSession, dto2);
- underTest.updateMainBranchName(dbSession, "U1", "master");
+ underTest.updateBranchName(dbSession, "U1", "master");
BranchDto loaded = underTest.selectByBranchKey(dbSession, "U1", "master").get();
assertThat(loaded.getMergeBranchUuid()).isNull();
assertThat(loaded.getProjectUuid()).isEqualTo("U1");
checkArgument(!existingBranch.filter(b -> !b.isMain()).isPresent(),
"Impossible to update branch name: a branch with name \"%s\" already exists in the project.", newBranchName);
- dbClient.branchDao().updateMainBranchName(dbSession, project.getUuid(), newBranchName);
+ dbClient.branchDao().updateBranchName(dbSession, project.getUuid(), newBranchName);
dbSession.commit();
response.noContent();
}
@Test
public void main_branch_with_specified_name() {
ComponentDto project = db.components().insertPrivateProject();
- db.getDbClient().branchDao().updateMainBranchName(db.getSession(), project.uuid(), "head");
+ db.getDbClient().branchDao().updateBranchName(db.getSession(), project.uuid(), "head");
db.commit();
userSession.logIn().addProjectPermission(USER, project);