use of org.netbeans.lib.cvsclient.command.log.SymbolicName in project intellij-community by JetBrains.
the class CvsFileRevisionImpl method getBranchList.
private Collection<String> getBranchList(final boolean includeRevisionNumbers) {
final ArrayList<String> result = new ArrayList<>();
final Set<SymbolicName> processedSymbolicNames = new HashSet<>();
final String branches = myCvsRevision.getBranches();
if (branches != null && branches.length() != 0) {
final String[] branchNames = branches.split(";");
for (String branchName : branchNames) {
final CvsRevisionNumber revisionNumber = new CvsRevisionNumber(branchName.trim());
final List<SymbolicName> symNames = getSymbolicNames(revisionNumber);
if (!symNames.isEmpty()) {
for (final SymbolicName symName : symNames) {
processedSymbolicNames.add(symName);
if (includeRevisionNumbers) {
result.add(symName.getName() + " (" + revisionNumber.asString() + ")");
} else {
result.add(symName.getName());
}
}
}
}
}
// IDEADEV-15186 - show branch name for just created branch with no revisions yet
//noinspection unchecked
final List<SymbolicName> symNames = myLogInformation.getAllSymbolicNames();
for (final SymbolicName symName : symNames) {
if (StringUtil.startsWithConcatenation(symName.getRevision(), myCvsRevision.getNumber(), ".") && !processedSymbolicNames.contains(symName)) {
CvsRevisionNumber number = new CvsRevisionNumber(symName.getRevision().trim());
final int[] subRevisions = number.getSubRevisions();
if (subRevisions.length == 4) {
int lastSubRevision = subRevisions[subRevisions.length - 1];
number = number.removeTailVersions(2);
number = number.addTailVersions(lastSubRevision);
}
if (includeRevisionNumbers) {
result.add(symName.getName() + " (" + number.asString() + ")");
} else {
result.add(symName.getName());
}
}
}
return result;
}
use of org.netbeans.lib.cvsclient.command.log.SymbolicName in project intellij-community by JetBrains.
the class CvsFileRevisionImpl method collectSymNamesForRevision.
private List<String> collectSymNamesForRevision() {
ArrayList<String> result = new ArrayList<>();
//noinspection unchecked
List<SymbolicName> symNames = myLogInformation.getSymNamesForRevision(myCvsRevision.getNumber());
for (final SymbolicName symName : symNames) {
result.add(symName.getName());
}
return result;
}
use of org.netbeans.lib.cvsclient.command.log.SymbolicName 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;
}
Aggregations