/** * POST /projects/{projectName}/repos/{repoName}/contents?revision={revision} * * <p>Adds or edits a file. */ @Post("/projects/{projectName}/repos/{repoName}/contents") @RequiresWritePermission public CompletableFuture<PushResultDto> commit( @Param("revision") @Default("-1") String revision, Repository repository, Author author, CommitMessageDto commitMessage, @RequestConverter(ChangesRequestConverter.class) Iterable<Change<?>> changes) { final Revision normalizedRevision = repository.normalizeNow(new Revision(revision)); final CompletableFuture<Map<String, Change<?>>> changesFuture = repository.previewDiff(normalizedRevision, changes); return changesFuture.thenCompose(previewDiffs -> { final long commitTimeMillis = System.currentTimeMillis(); if (previewDiffs.isEmpty()) { throw new RedundantChangeException(); } return push(commitTimeMillis, author, repository, normalizedRevision, commitMessage, previewDiffs.values()) .toCompletableFuture() .thenApply(rrev -> convert(rrev, commitTimeMillis)); }); }
/** * POST /projects/{projectName}/repos/{repoName}/contents?revision={revision} * * <p>Adds or edits a file. */ @Post("/projects/{projectName}/repos/{repoName}/contents") @RequiresWritePermission public CompletableFuture<PushResultDto> commit( @Param("revision") @Default("-1") String revision, Repository repository, Author author, CommitMessageDto commitMessage, @RequestConverter(ChangesRequestConverter.class) Iterable<Change<?>> changes) { final Revision normalizedRevision = repository.normalizeNow(new Revision(revision)); final CompletableFuture<Map<String, Change<?>>> changesFuture = repository.previewDiff(normalizedRevision, changes); return changesFuture.thenCompose(previewDiffs -> { final long commitTimeMillis = System.currentTimeMillis(); if (previewDiffs.isEmpty()) { throw new RedundantChangeException(); } return push(commitTimeMillis, author, repository, normalizedRevision, commitMessage, previewDiffs.values()) .toCompletableFuture() .thenApply(rrev -> convert(rrev, commitTimeMillis)); }); }
/** * POST /projects/{projectName}/repos/{repoName}/contents?revision={revision} * * <p>Adds or edits a file. */ @Post("/projects/{projectName}/repos/{repoName}/contents") @Decorator(HasWritePermission.class) public CompletableFuture<PushResultDto> commit( @Param("revision") @Default("-1") String revision, Repository repository, Author author, CommitMessageDto commitMessage, @RequestConverter(ChangesRequestConverter.class) Iterable<Change<?>> changes) { final Revision normalizedRevision = repository.normalizeNow(new Revision(revision)); final CompletableFuture<Map<String, Change<?>>> changesFuture = repository.previewDiff(normalizedRevision, changes); return changesFuture.thenCompose(previewDiffs -> { final long commitTimeMillis = System.currentTimeMillis(); if (previewDiffs.isEmpty()) { throw new RedundantChangeException(); } return push(commitTimeMillis, author, repository, normalizedRevision, commitMessage, previewDiffs.values()) .toCompletableFuture() .thenApply(rrev -> convert(rrev, commitTimeMillis)); }); }
break; case REDUNDANT_CHANGE: convertedCause = new RedundantChangeException(message, false); break; case CHANGE_CONFLICT:
break; case REDUNDANT_CHANGE: convertedCause = new RedundantChangeException(message, false); break; case CHANGE_CONFLICT:
break; case REDUNDANT_CHANGE: convertedCause = new RedundantChangeException(message, false); break; case CHANGE_CONFLICT:
throw new RedundantChangeException( "changes did not change anything in " + parent().name() + '/' + name() + " at revision " + (prevRevision != null ? prevRevision.major() : 0) +
throw new RedundantChangeException( "changes did not change anything in " + parent().name() + '/' + name() + " at revision " + (prevRevision != null ? prevRevision.major() : 0) +
throw new RedundantChangeException( "changes did not change anything in " + parent().name() + '/' + name() + " at revision " + (prevRevision != null ? prevRevision.major() : 0) +