use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class ConfigureBranchesAction method update.
public void update(final AnActionEvent e) {
final Project project = e.getProject();
final Presentation presentation = e.getPresentation();
if (project == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
presentation.setText(SvnBundle.message("configure.branches.item"));
presentation.setDescription(SvnBundle.message("configure.branches.item"));
presentation.setIcon(SvnIcons.ConfigureBranches);
presentation.setVisible(true);
final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
presentation.setEnabled((cls != null) && (cls.length > 0) && (SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) && (((SvnChangeList) cls[0]).getRoot() != null));
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class ConfigureBranchesAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getProject();
final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
if ((cls == null) || (cls.length == 0) || (!SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) || (((SvnChangeList) cls[0]).getRoot() == null)) {
return;
}
final SvnChangeList svnList = (SvnChangeList) cls[0];
BranchConfigurationDialog.configureBranches(project, svnList.getRoot());
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class RootsAndBranches method getPanelData.
private SvnMergeInfoRootPanelManual getPanelData(final List<CommittedChangeList> listsList) {
for (CommittedChangeList list : listsList) {
if (!(list instanceof SvnChangeList)) {
return null;
}
final SvnChangeList svnList = (SvnChangeList) list;
final String wcPath = svnList.getWcPath();
if (wcPath == null) {
continue;
}
return getPanelData(wcPath);
}
return null;
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class LiveProvider method getEarliestBunchInIntervalImpl.
private Fragment getEarliestBunchInIntervalImpl(long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeYoungest, final boolean includeOldest, final long earliestToTake) throws VcsException {
if ((myEarliestRevisionWasAccessed) || ((oldestRevision == myYoungestRevision) && ((!includeYoungest) || (!includeOldest)))) {
return null;
}
final SVNRevision youngRevision = (earliestRevision == -1) ? SVNRevision.HEAD : SVNRevision.create(earliestRevision);
final Ref<List<CommittedChangeList>> refToList = new Ref<>();
final Ref<VcsException> exceptionRef = new Ref<>();
final Runnable loader = () -> {
try {
refToList.set(myLoader.loadInterval(youngRevision, SVNRevision.create(oldestRevision), desirableSize, includeYoungest, includeOldest));
} catch (VcsException e) {
exceptionRef.set(e);
}
};
final Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode() || !application.isDispatchThread()) {
loader.run();
} else {
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
final ProgressIndicator ind = ProgressManager.getInstance().getProgressIndicator();
if (ind != null) {
ind.setText(SvnBundle.message("progress.live.provider.loading.revisions.details.text"));
}
loader.run();
}, SvnBundle.message("progress.live.provider.loading.revisions.text"), false, myVcs.getProject());
}
if (!exceptionRef.isNull()) {
final VcsException e = exceptionRef.get();
if (isElementNotFound(e)) {
// occurs when target URL is deleted in repository
// try to find latest existent revision. expensive ...
final LatestExistentSearcher searcher = new LatestExistentSearcher(oldestRevision, myYoungestRevision, (oldestRevision != 0), myVcs, myLocation.toSvnUrl(), myRepositoryUrl);
final long existent = searcher.getLatestExistent();
if ((existent == -1) || (existent == earliestRevision)) {
myEarliestRevisionWasAccessed = true;
return null;
}
return getEarliestBunchInIntervalImpl(existent, oldestRevision, includeYoungest ? desirableSize : (desirableSize + 1), true, includeOldest, Math.min(existent, earliestRevision));
}
throw e;
}
final List<CommittedChangeList> list = refToList.get();
if (list.isEmpty()) {
myEarliestRevisionWasAccessed = (oldestRevision == 0);
return null;
}
if (earliestToTake > 0) {
for (Iterator<CommittedChangeList> iterator = list.iterator(); iterator.hasNext(); ) {
final CommittedChangeList changeList = iterator.next();
if (changeList.getNumber() > earliestToTake)
iterator.remove();
}
}
myEarliestRevisionWasAccessed = (oldestRevision == 0) && ((list.size() + ((!includeOldest) ? 1 : 0) + ((!includeYoungest) ? 1 : 0)) < desirableSize);
return new Fragment(Origin.LIVE, list, true, true, null);
}
use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.
the class LoadedRevisionsCache method put.
@Nullable
public Bunch put(final List<CommittedChangeList> data, final boolean consistentWithPrevious, final Bunch bindTo) {
if (data.isEmpty()) {
return null;
}
final SvnRepositoryLocation repositoryLocation = ((SvnChangeList) data.get(0)).getLocation();
final String location = repositoryLocation.getURL();
final List<List<CommittedChangeList>> list = split(data, SvnRevisionsNavigationMediator.CHUNK_SIZE);
Bunch bindToBunch = bindTo;
if (bindToBunch == null) {
final Bunch fromCache = myMap.get(location);
if (fromCache != null) {
final long passedSmallestNumber = data.get(data.size() - 1).getNumber();
final List<CommittedChangeList> cachedList = fromCache.getList();
final long greatestNumber = cachedList.get(0).getNumber();
if (greatestNumber < passedSmallestNumber) {
bindToBunch = fromCache;
}
}
}
boolean consistent = consistentWithPrevious;
for (int i = list.size() - 1; i >= 0; --i) {
final List<CommittedChangeList> changeLists = list.get(i);
debugInfo(changeLists, consistent, bindToBunch);
bindToBunch = new Bunch(changeLists, consistent, bindToBunch);
consistent = true;
}
myMap.put(location, bindToBunch);
return bindToBunch;
}
Aggregations