mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[patch]: rename method
* add an ability to get single hunk text for any single hunk patches, e.g. deleted, new files changes
This commit is contained in:
+2
-1
@@ -67,7 +67,8 @@ public class TextFilePatch extends FilePatch {
|
||||
return myHunks.size() == 1 && myHunks.get(0).isNewContent();
|
||||
}
|
||||
|
||||
public String getNewFileText() {
|
||||
public String getSingleHunkPatchText() {
|
||||
assert myHunks.size() == 1;
|
||||
return myHunks.get(0).getText();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class ApplyTextFilePatch extends ApplyFilePatchBase<TextFilePatch> {
|
||||
//
|
||||
}
|
||||
}
|
||||
document.setText(myPatch.getNewFileText());
|
||||
document.setText(myPatch.getSingleHunkPatchText());
|
||||
FileDocumentManager.getInstance().saveDocument(document);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class TextFilePatchInProgress extends AbstractFilePatchInProgress<TextFil
|
||||
myConflicts = null;
|
||||
if (FilePatchStatus.ADDED.equals(myStatus)) {
|
||||
final FilePath newFilePath = VcsUtil.getFilePath(myIoCurrentBase, false);
|
||||
final String content = myPatch.getNewFileText();
|
||||
final String content = myPatch.getSingleHunkPatchText();
|
||||
myNewContentRevision = new SimpleContentRevision(content, newFilePath, myPatch.getAfterVersionId());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -220,7 +220,7 @@ public class ShelvedChange {
|
||||
|
||||
private String loadContent(final TextFilePatch patch) throws ApplyPatchException {
|
||||
if (patch.isNewFile()) {
|
||||
return patch.getNewFileText();
|
||||
return patch.getSingleHunkPatchText();
|
||||
}
|
||||
if (patch.isDeletedFile()) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user