use of com.intellij.cvsSupport2.changeBrowser.CvsContentRevision in project intellij-community by JetBrains.
the class CvsChangeList method getChanges.
public Collection<Change> getChanges() {
if (myChanges == null) {
myChanges = new ArrayList<>();
for (RevisionWrapper wrapper : myRevisions) {
final Revision revision = wrapper.getRevision();
final String state = revision.getState();
String path = wrapper.getFile();
final File localFile;
if (myRootFile != null) {
final String directorySuffix = myRootFile.isDirectory() ? "/" : "";
if (StringUtil.startsWithConcatenation(path, myRootPath, directorySuffix)) {
path = path.substring(myRootPath.length() + directorySuffix.length());
localFile = new File(myRootFile.getPresentableUrl(), path);
} else {
localFile = new File(wrapper.getFile());
}
} else {
localFile = new File(wrapper.getFile());
}
final boolean added = isAdded(revision);
final ContentRevision beforeRevision = added ? null : new CvsContentRevision(new File(wrapper.getFile()), localFile, new SimpleRevision(new CvsRevisionNumber(revision.getNumber()).getPrevNumber().asString()), myEnvironment, myProject);
final ContentRevision afterRevision = (!added && DEAD_STATE.equals(state)) ? null : new CvsContentRevision(new File(wrapper.getFile()), localFile, new SimpleRevision(revision.getNumber()), myEnvironment, myProject);
myChanges.add(new Change(beforeRevision, afterRevision));
}
}
return myChanges;
}
use of com.intellij.cvsSupport2.changeBrowser.CvsContentRevision in project intellij-community by JetBrains.
the class CvsDiffProvider method createFileContent.
public ContentRevision createFileContent(final VcsRevisionNumber revisionNumber, VirtualFile selectedFile) {
if ((revisionNumber instanceof CvsRevisionNumber)) {
final CvsConnectionSettings settings = CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(selectedFile.getParent());
final File file = new File(CvsUtil.getModuleName(selectedFile));
final CvsRevisionNumber cvsRevisionNumber = ((CvsRevisionNumber) revisionNumber);
final RevisionOrDate versionInfo;
if (cvsRevisionNumber.getDateOrRevision() != null) {
versionInfo = RevisionOrDateImpl.createOn(cvsRevisionNumber.getDateOrRevision());
} else {
versionInfo = new SimpleRevision(cvsRevisionNumber.asString());
}
if (selectedFile.getFileType().isBinary()) {
return new CvsBinaryContentRevision(file, file, versionInfo, settings, myProject);
} else {
return new CvsContentRevision(file, file, versionInfo, settings, myProject);
}
} else {
return null;
}
}
Aggregations