Search in sources :

Example 1 with PatchScriptFactoryForAutoFix

use of com.google.gerrit.server.patch.PatchScriptFactoryForAutoFix in project gerrit by GerritCodeReview.

the class GetFixPreview method getFixPreviewForSingleFile.

private DiffInfo getFixPreviewForSingleFile(Repository git, PatchSet patchSet, ProjectState state, ChangeNotes notes, String fileName, ImmutableList<FixReplacement> fixReplacements) throws PermissionBackendException, AuthException, LargeObjectException, InvalidChangeOperationException, IOException, ResourceNotFoundException {
    PatchScriptFactoryForAutoFix psf = patchScriptFactoryFactory.create(git, notes, fileName, patchSet, fixReplacements, DiffPreferencesInfo.defaults());
    PatchScript ps = psf.call();
    DiffSide sideA = DiffSide.create(ps.getFileInfoA(), MoreObjects.firstNonNull(ps.getOldName(), ps.getNewName()), DiffSide.Type.SIDE_A);
    DiffSide sideB = DiffSide.create(ps.getFileInfoB(), ps.getNewName(), DiffSide.Type.SIDE_B);
    DiffInfoCreator diffInfoCreator = new DiffInfoCreator(state, new DiffWebLinksProviderImpl(), true);
    return diffInfoCreator.create(ps, sideA, sideB);
}
Also used : PatchScriptFactoryForAutoFix(com.google.gerrit.server.patch.PatchScriptFactoryForAutoFix) PatchScript(com.google.gerrit.common.data.PatchScript) DiffInfoCreator(com.google.gerrit.server.diff.DiffInfoCreator) DiffSide(com.google.gerrit.server.diff.DiffSide)

Aggregations

PatchScript (com.google.gerrit.common.data.PatchScript)1 DiffInfoCreator (com.google.gerrit.server.diff.DiffInfoCreator)1 DiffSide (com.google.gerrit.server.diff.DiffSide)1 PatchScriptFactoryForAutoFix (com.google.gerrit.server.patch.PatchScriptFactoryForAutoFix)1