diff --git a/server/src/main/java/com/linecorp/centraldogma/server/metadata/MetadataService.java b/server/src/main/java/com/linecorp/centraldogma/server/metadata/MetadataService.java index 8afed53b4..7450458ec 100644 --- a/server/src/main/java/com/linecorp/centraldogma/server/metadata/MetadataService.java +++ b/server/src/main/java/com/linecorp/centraldogma/server/metadata/MetadataService.java @@ -279,8 +279,7 @@ public CompletableFuture removeMember(Author author, String projectNam projectMetadata.creation(), projectMetadata.removal())); }); - return metadataRepo.pushIgnoringRedundantChange(projectName, Project.REPO_DOGMA, - author, commitSummary, transformer); + return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, transformer); } private static ProjectMetadata projectMetadata(JsonNode node) { @@ -606,8 +605,7 @@ private CompletableFuture removeToken(String projectName, Author autho projectMetadata.creation(), projectMetadata.removal())); }); - return metadataRepo.pushIgnoringRedundantChange(projectName, Project.REPO_DOGMA, author, - commitSummary, transformer); + return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, transformer); } private static ImmutableMap removeTokenFromRepositories( @@ -1175,8 +1173,7 @@ public CompletableFuture destroyToken(Author author, String appId) { final Map newAppIds = appIdsBuilder.build(); return Jackson.valueToTree(new Tokens(newAppIds, tokens.secrets())); }); - return tokenRepo.pushIgnoringRedundantChange(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, - commitSummary, transformer); + return tokenRepo.push(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, commitSummary, transformer); } /** @@ -1220,8 +1217,7 @@ public Revision purgeToken(Author author, String appId) { return Jackson.valueToTree(new Tokens(newAppIds, newSecrets)); }); - return tokenRepo.pushIgnoringRedundantChange(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, - commitSummary, transformer) + return tokenRepo.push(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, commitSummary, transformer) .join(); } @@ -1283,8 +1279,7 @@ public CompletableFuture activateToken(Author author, String appId) { return Jackson.valueToTree(new Tokens(newAppIds, newSecrets)); }); - return tokenRepo.pushIgnoringRedundantChange(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, - commitSummary, transformer); + return tokenRepo.push(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, commitSummary, transformer); } /** @@ -1322,8 +1317,7 @@ public CompletableFuture deactivateToken(Author author, String appId) return Jackson.valueToTree(new Tokens(newAppIds, newSecrets)); }); - return tokenRepo.pushIgnoringRedundantChange(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, - commitSummary, transformer); + return tokenRepo.push(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, commitSummary, transformer); } /** @@ -1354,8 +1348,7 @@ public CompletableFuture updateTokenLevel(Author author, String appId, final Map newAppIds = appIdsBuilder.build(); return Jackson.valueToTree(new Tokens(newAppIds, tokens.secrets())); }); - return tokenRepo.pushIgnoringRedundantChange(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, - commitSummary, transformer); + return tokenRepo.push(INTERNAL_PROJECT_DOGMA, Project.REPO_DOGMA, author, commitSummary, transformer); } /** diff --git a/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositoryMetadataDeserializer.java b/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositoryMetadataDeserializer.java index dbe5045b4..ae69916a4 100644 --- a/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositoryMetadataDeserializer.java +++ b/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositoryMetadataDeserializer.java @@ -58,6 +58,7 @@ public RepositoryMetadata deserialize(JsonParser p, DeserializationContext ctxt) final Map> perUserPermissions; final Map> perTokenPermissions; if (perRolePermissionsNode != null) { + assert jsonNode.get("roles") == null; // legacy format perRolePermissions = Jackson.treeToValue(perRolePermissionsNode, PerRolePermissions.class); perUserPermissions = Jackson.readValue(jsonNode.get("perUserPermissions").traverse(), diff --git a/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositorySupport.java b/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositorySupport.java index 53fde1054..f31792e42 100644 --- a/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositorySupport.java +++ b/server/src/main/java/com/linecorp/centraldogma/server/metadata/RepositorySupport.java @@ -29,7 +29,6 @@ import com.linecorp.centraldogma.common.Change; import com.linecorp.centraldogma.common.Entry; import com.linecorp.centraldogma.common.Markup; -import com.linecorp.centraldogma.common.RedundantChangeException; import com.linecorp.centraldogma.common.Revision; import com.linecorp.centraldogma.internal.Jackson; import com.linecorp.centraldogma.server.command.Command; @@ -118,20 +117,6 @@ CompletableFuture push(String projectName, String repoName, .thenApply(CommitResult::revision); } - CompletableFuture pushIgnoringRedundantChange(String projectName, String repoName, - Author author, String commitSummary, - ContentTransformer transformer) { - return push(projectName, repoName, author, commitSummary, transformer).exceptionally(cause -> { - final Throwable peeled = Exceptions.peel(cause); - if (peeled instanceof RedundantChangeException) { - final Revision revision = ((RedundantChangeException) peeled).headRevision(); - assert revision != null; - return revision; - } - return Exceptions.throwUnsafely(peeled); - }); - } - Revision normalize(Repository repository) { requireNonNull(repository, "repository"); try {