use of com.intellij.cvsSupport2.history.CvsRevisionNumber in project intellij-community by JetBrains.
the class UpdatedFilesProcessor method addFileMessage.
public void addFileMessage(FileMessage message) {
String path = message.getFileAbsolutePath();
VirtualFile virtualFile = getVirtualFileFor(path);
final int messageType = message.getType();
if (virtualFile != null && messageType == FileMessage.NOT_IN_REPOSITORY && FileTypeManager.getInstance().isFileIgnored(virtualFile)) {
return;
}
FileGroup collection = getCollectionFor(messageType, virtualFile);
LOG.assertTrue(collection != null, String.valueOf(messageType));
final CvsRevisionNumber revision = message.getRevision();
collection.add(path, CvsVcs2.getKey(), revision);
}
use of com.intellij.cvsSupport2.history.CvsRevisionNumber 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.history.CvsRevisionNumber in project intellij-community by JetBrains.
the class CvsChangeListsBuilder method getBranchName.
@Nullable
private static String getBranchName(final Revision revision, final List<SymbolicName> symbolicNames) {
final CvsRevisionNumber number = new CvsRevisionNumber(revision.getNumber().trim());
final int[] subRevisions = number.getSubRevisions();
String branchNumberString = null;
if (subRevisions != null && subRevisions.length >= 4) {
final int branchRevNumber = subRevisions[subRevisions.length - 2];
final CvsRevisionNumber branchNumber = number.removeTailVersions(2).addTailVersions(0, branchRevNumber);
branchNumberString = branchNumber.asString();
}
if (branchNumberString == null) {
final String branches = revision.getBranches();
if (branches != null && branches.length() > 0) {
final String[] branchNames = branches.split(";");
final CvsRevisionNumber revisionNumber = new CvsRevisionNumber(branchNames[0].trim());
final int[] branchSubRevisions = revisionNumber.getSubRevisions();
assert branchSubRevisions != null;
final int rev = branchSubRevisions[branchSubRevisions.length - 1];
final CvsRevisionNumber branchNumber = revisionNumber.removeTailVersions(1).addTailVersions(0, rev);
branchNumberString = branchNumber.asString();
}
}
if (branchNumberString != null) {
for (SymbolicName name : symbolicNames) {
if (name.getRevision().equals(branchNumberString)) {
return name.getName();
}
}
}
return null;
}
use of com.intellij.cvsSupport2.history.CvsRevisionNumber in project intellij-community by JetBrains.
the class StickyHeadGetter method getBranchHeadRevision.
@Nullable
protected String getBranchHeadRevision(final VirtualFile parent, final String name, final Convertor<CvsRevisionNumber, Boolean> chooser) {
final LocalPathIndifferentLogOperation operation = new LocalPathIndifferentLogOperation(new File(parent.getPath(), name));
final Ref<Boolean> logSuccess = new Ref<>(Boolean.TRUE);
final CvsExecutionEnvironment cvsExecutionEnvironment = new CvsExecutionEnvironment(new CvsMessagesAdapter(), CvsExecutionEnvironment.DUMMY_STOPPER, new ErrorProcessor() {
public void addError(VcsException ex) {
logSuccess.set(Boolean.FALSE);
}
public List<VcsException> getErrors() {
return null;
}
}, PostCvsActivity.DEAF, myProject);
try {
// should already be logged in
//operation.login(context);
operation.execute(cvsExecutionEnvironment, false);
} catch (VcsException | CommandAbortedException e) {
//
}
if (Boolean.TRUE.equals(logSuccess.get())) {
return extractRevision(operation, chooser);
}
return null;
}
use of com.intellij.cvsSupport2.history.CvsRevisionNumber in project intellij-community by JetBrains.
the class TagsHelper method collectSortedRevisionsNames.
private static Collection<String> collectSortedRevisionsNames(Collection<CvsRevisionNumber> revisions) {
if (revisions == null)
return new ArrayList<>();
final ArrayList<CvsRevisionNumber> list = new ArrayList<>(revisions);
Collections.sort(list, (o, o1) -> o.compareTo(o1));
final ArrayList<String> result = new ArrayList<>();
for (final CvsRevisionNumber aList : list) {
result.add(aList.toString());
}
return result;
}
Aggregations