[patch]: deprecate old names, use new ones, annotations added

This commit is contained in:
Nadya Zabrodina
2016-08-23 17:09:10 +03:00
committed by Nadya Zabrodina
parent 5fd5e98682
commit 3779db5e74
4 changed files with 19 additions and 4 deletions
@@ -49,7 +49,7 @@ public abstract class PatchingTestCase extends IntegrationTestCase {
protected void applyPatch() throws Exception {
PatchReader reader = PatchVirtualFileReader.create(LocalFileSystem.getInstance().refreshAndFindFileByPath(patchFilePath));
List<FilePatch> patches = new ArrayList<>(reader.readAllPatches());
List<FilePatch> patches = new ArrayList<>(reader.readTextPatches());
new PatchApplier<BinaryFilePatch>(myProject, myRoot, patches, null, null, null).execute();
}
@@ -72,6 +72,11 @@ public class PatchReader {
myPatchContentParser = new PatchContentParser(saveHunks);
}
/**
* @deprecated use {@link PatchReader#readTextPatches()} instead
*/
@Deprecated
@NotNull
public List<TextFilePatch> readAllPatches() throws PatchSyntaxException {
return readTextPatches();
}
@@ -79,7 +84,7 @@ public class PatchReader {
@NotNull
public List<TextFilePatch> readTextPatches() throws PatchSyntaxException {
parseAllPatches();
return getPatches();
return getTextPatches();
}
@Nullable
@@ -118,7 +123,17 @@ public class PatchReader {
}
}*/
/**
* @deprecated use {@link PatchReader#getTextPatches()} or {@link PatchReader#getAllPatches()} instead
*/
@Deprecated
@NotNull
public List<TextFilePatch> getPatches() {
return getTextPatches();
}
@NotNull
public List<TextFilePatch> getTextPatches() {
return ContainerUtil.findAll(myPatches, TextFilePatch.class);
}
@@ -910,7 +910,7 @@ public class ShelveChangesManager extends AbstractProjectComponent implements JD
boolean loadContent) throws IOException, PatchSyntaxException {
char[] text = FileUtil.loadFileText(new File(patchPath), CharsetToolkit.UTF8);
PatchReader reader = new PatchReader(new CharArrayCharSequence(text), loadContent);
final List<TextFilePatch> textFilePatches = reader.readAllPatches();
final List<TextFilePatch> textFilePatches = reader.readTextPatches();
final TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo = reader.getAdditionalInfo(
null);
ApplyPatchDefaultExecutor.applyAdditionalInfoBefore(project, additionalInfo, commitContext);
@@ -68,7 +68,7 @@ public class ConflictCreator {
}
final PatchReader reader = new PatchReader(myData.getTheirsPatch());
final List<TextFilePatch> patches = reader.readAllPatches();
final List<TextFilePatch> patches = reader.readTextPatches();
final List<FilePatch> filePatchList = new ArrayList<>(patches);
for (Iterator<FilePatch> iterator = filePatchList.iterator(); iterator.hasNext(); ) {
final FilePatch patch = iterator.next();