当前位置: 首页>>代码示例>>Java>>正文


Java Change.getAfterRevision方法代码示例

本文整理汇总了Java中com.intellij.openapi.vcs.changes.Change.getAfterRevision方法的典型用法代码示例。如果您正苦于以下问题:Java Change.getAfterRevision方法的具体用法?Java Change.getAfterRevision怎么用?Java Change.getAfterRevision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vcs.changes.Change的用法示例。


在下文中一共展示了Change.getAfterRevision方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAffectedFiles

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@NotNull
private static List<VirtualFile> getAffectedFiles(String changeListName, Project project) {
  final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
  if (changeListName == null) {
    return changeListManager.getAffectedFiles();
  }
  final LocalChangeList changeList = changeListManager.findChangeList(changeListName);
  if (changeList != null) {
    List<VirtualFile> files = new ArrayList<VirtualFile>();
    for (Change change : changeList.getChanges()) {
      final ContentRevision afterRevision = change.getAfterRevision();
      if (afterRevision != null) {
        final VirtualFile file = afterRevision.getFile().getVirtualFile();
        if (file != null) {
          files.add(file);
        }
      }
    }
    return files;
  }

  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TestDiscoverySearchHelper.java

示例2: matches

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@Override
public boolean matches(@NotNull VcsCommitMetadata details) {
  if ((details instanceof VcsFullCommitDetails)) {
    for (Change change : ((VcsFullCommitDetails)details).getChanges()) {
      ContentRevision before = change.getBeforeRevision();
      if (before != null && matches(before.getFile().getPath())) {
        return true;
      }
      ContentRevision after = change.getAfterRevision();
      if (after != null && matches(after.getFile().getPath())) {
        return true;
      }
    }
    return false;
  }
  else {
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:VcsLogStructureFilterImpl.java

示例3: addOrReplaceChange

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private static void addOrReplaceChange(final List<Change> changes, final Change c) {
  final ContentRevision beforeRev = c.getBeforeRevision();
  // todo!!! further improvements needed
  if (beforeRev != null) {
    final String beforeName = beforeRev.getFile().getName();
    final String beforeAbsolutePath = beforeRev.getFile().getIOFile().getAbsolutePath();
    for(Change oldChange: changes) {
      ContentRevision rev = oldChange.getAfterRevision();
      // first compare name, which is many times faster - to remove 99% not matching
      if (rev != null && (rev.getFile().getName().equals(beforeName)) && rev.getFile().getIOFile().getAbsolutePath().equals(beforeAbsolutePath)) {
        changes.remove(oldChange);
        if (oldChange.getBeforeRevision() != null || c.getAfterRevision() != null) {
          changes.add(new Change(oldChange.getBeforeRevision(), c.getAfterRevision()));
        }
        return;
      }
    }
  }
  changes.add(c);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CommittedChangesTreeBrowser.java

示例4: createParentRevision

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@NotNull
private GitFileRevision createParentRevision(@NotNull GitRepository repository, @NotNull GitFileRevision currentRevision,
                                             @NotNull String parentHash) throws VcsException {
  FilePath currentRevisionPath = currentRevision.getPath();
  if (currentRevisionPath.isDirectory()) {
    // for directories the history doesn't follow renames
    return makeRevisionFromHash(currentRevisionPath, parentHash);
  }

  // can't limit by the path: in that case rename information will be missed
  Collection<Change> changes = GitChangeUtils.getDiff(myProject, repository.getRoot(), parentHash, currentRevision.getHash(), null);
  for (Change change : changes) {
    ContentRevision afterRevision = change.getAfterRevision();
    ContentRevision beforeRevision = change.getBeforeRevision();
    if (afterRevision != null && afterRevision.getFile().equals(currentRevisionPath)) {
      // if the file was renamed, taking the path how it was in the parent; otherwise the path didn't change
      FilePath path = (beforeRevision != null ? beforeRevision.getFile() : afterRevision.getFile());
      return new GitFileRevision(myProject, path, new GitRevisionNumber(parentHash));
    }
  }
  LOG.error(String.format("Could not find parent revision. Will use the path from parent revision. Current revision: %s, parent hash: %s",
                          currentRevision, parentHash));
  return makeRevisionFromHash(currentRevisionPath, parentHash);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GitDiffFromHistoryHandler.java

示例5: isRenameChange

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
/**
 * @param change "Change" description.
 * @return Return true if the "Change" object is created for "Rename" operation:
 *         in this case name of files for "before" and "after" revisions must not
 *         coniside.
 */
public static boolean isRenameChange(Change change) {
  boolean isRenamed = false;
  ContentRevision before = change.getBeforeRevision();
  ContentRevision after = change.getAfterRevision();
  if (before != null && after != null) {
    String prevFile = getCanonicalLocalPath(before.getFile().getPath());
    String newFile = getCanonicalLocalPath(after.getFile().getPath());
    isRenamed = !prevFile.equals(newFile);
  }
  return isRenamed;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:VcsUtil.java

示例6: shouldBeComparedWithChange

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public boolean shouldBeComparedWithChange(final Change change) {
  if (FileStatus.DELETED.equals(myStatus) && (change.getAfterRevision() == null)) {
    // before path
    return (change.getBeforeRevision() != null) && myLocalPath.equals(change.getBeforeRevision().getFile().getIOFile().getAbsolutePath());
  } else {
    return (change.getAfterRevision() != null) && myLocalPath.equals(change.getAfterRevision().getFile().getIOFile().getAbsolutePath());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SvnCommittedViewTest.java

示例7: printChanges

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private static String printChanges(final Data data, final Collection<Change> changes) {
  final StringBuilder sb = new StringBuilder("Data: ").append(data.myLocalPath).append(" exists: ").
    append(new File(data.myLocalPath).exists()).append(" Changes: ");
  for (Change change : changes) {
    final ContentRevision cr = change.getAfterRevision() == null ? change.getBeforeRevision() : change.getAfterRevision();
    final File ioFile = cr.getFile().getIOFile();
    sb.append("'").append(ioFile.getAbsolutePath()).append("' exists: ").append(ioFile.exists()).append(" | ");
  }
  return sb.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SvnCommittedViewTest.java

示例8: execute

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public void execute() {
  for (Change change : changes) {
    ProgressManager.checkCanceled();
    if (change.getAfterRevision() == null) continue;
    final VirtualFile afterFile = getFileWithRefresh(change.getAfterRevision().getFile());
    if (afterFile == null || afterFile.isDirectory() || afterFile.getFileType().isBinary()) continue;
    myPsiFile = null;

    if (afterFile.isValid()) {
      myPsiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
        @Override
        public PsiFile compute() {
          return myPsiManager.findFile(afterFile);
        }
      });
    }
    if (myPsiFile == null) {
      mySkipped.add(Pair.create(change.getAfterRevision().getFile(), ourInvalidFile));
      continue;
    }

    myNewTodoItems = new ArrayList<TodoItem>(Arrays.asList(
      ApplicationManager.getApplication().runReadAction(new Computable<TodoItem[]>() {
        @Override
        public TodoItem[] compute() {
          return mySearchHelper.findTodoItems(myPsiFile);
        }
      })));
    applyFilterAndRemoveDuplicates(myNewTodoItems, myTodoFilter);
    if (change.getBeforeRevision() == null) {
      // take just all todos
      if (myNewTodoItems.isEmpty()) continue;
      myAddedOrEditedTodos.addAll(myNewTodoItems);
    }
    else {
      myEditedFileProcessor.process(change, myNewTodoItems);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:TodoCheckinHandlerWorker.java

示例9: processChangeImpl

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private void processChangeImpl(final Change change) {
  if (change.getAfterRevision() != null) {
    final FilePath after = change.getAfterRevision().getFile();
    final ThroughRenameInfo info = findToFile(after, change.getBeforeRevision() == null ? null : change.getBeforeRevision().getFile().getIOFile());
    if (info != null) {
      myFromTo.put(after.getIOFile(), info);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:UnversionedAndNotTouchedFilesGroupCollector.java

示例10: fillCompletionVariants

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
  PsiFile file = parameters.getOriginalFile();
  Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
  if (document != null) {
    DataContext dataContext = document.getUserData(CommitMessage.DATA_CONTEXT_KEY);
    if (dataContext != null) {
      result.stopHere();
      if (parameters.getInvocationCount() > 0) {
        ChangeList[] lists = VcsDataKeys.CHANGE_LISTS.getData(dataContext);
        if (lists != null) {
          String prefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters);
          CompletionResultSet insensitive = result.caseInsensitive().withPrefixMatcher(new CamelHumpMatcher(prefix));
          for (ChangeList list : lists) {
            for (Change change : list.getChanges()) {
              ContentRevision revision = change.getAfterRevision() == null ? change.getBeforeRevision() : change.getAfterRevision();
              if (revision != null) {
                FilePath filePath = revision.getFile();
                LookupElementBuilder element = LookupElementBuilder.create(filePath.getName()).
                    withIcon(filePath.getFileType().getIcon());
                insensitive.addElement(element);
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CommitCompletionContributor.java

示例11: hasValidChanges

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private static boolean hasValidChanges(final Change[] changes) {
  for(Change c: changes) {
    final ContentRevision contentRevision = c.getAfterRevision();
    if (contentRevision != null && !contentRevision.getFile().isDirectory()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:OpenRepositoryVersionAction.java

示例12: getDistinctFiles

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private Collection<FilePath> getDistinctFiles(final Change change) {
  final List<FilePath> result = new ArrayList<FilePath>(2);
  if (change.getBeforeRevision() != null) {
    result.add(change.getBeforeRevision().getFile());
  }
  if (change.getAfterRevision() != null) {
    if (change.getBeforeRevision() == null || change.getBeforeRevision() != null && (change.isMoved() || change.isRenamed())) {
      result.add(change.getAfterRevision().getFile());
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MarkTreeConflictResolvedAction.java

示例13: getLocalChangesFilteredByFiles

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private Collection<Change> getLocalChangesFilteredByFiles(List<FilePath> paths) {
  final Collection<Change> changes = new HashSet<Change>();
  for(LocalChangeList list : myChangeListManager.getChangeLists()) {
    for (Change change : list.getChanges()) {
      final ContentRevision afterRevision = change.getAfterRevision();
      final ContentRevision beforeRevision = change.getBeforeRevision();
      if ((afterRevision != null && paths.contains(afterRevision.getFile())) || (beforeRevision != null && paths.contains(beforeRevision.getFile()))) {
        changes.add(change);
      }
    }
  }
  return changes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GitMergeUpdater.java

示例14: seemsToBeMoved

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private static boolean seemsToBeMoved(Change change, VirtualFile toSelect) {
  ContentRevision afterRevision = change.getAfterRevision();
  if (afterRevision == null) return false;
  FilePath file = afterRevision.getFile();
  return FileUtil.pathsEqual(file.getPath(), toSelect.getPath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ChangesTreeList.java

示例15: getScope

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@NotNull
public AnalysisScope getScope(@NotNull AnalysisUIOptions uiOptions, @NotNull AnalysisScope defaultScope, @NotNull Project project, Module module) {
  AnalysisScope scope;
  if (isProjectScopeSelected()) {
    scope = new AnalysisScope(project);
    uiOptions.SCOPE_TYPE = AnalysisScope.PROJECT;
  }
  else {
    final SearchScope customScope = getCustomScope();
    if (customScope != null) {
      scope = new AnalysisScope(customScope, project);
      uiOptions.SCOPE_TYPE = AnalysisScope.CUSTOM;
      uiOptions.CUSTOM_SCOPE_NAME = customScope.getDisplayName();
    }
    else if (isModuleScopeSelected()) {
      scope = new AnalysisScope(module);
      uiOptions.SCOPE_TYPE = AnalysisScope.MODULE;
    }
    else if (isUncommitedFilesSelected()) {
      final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
      List<VirtualFile> files;
      if (myChangeLists.getSelectedItem() == ALL) {
        files = changeListManager.getAffectedFiles();
      }
      else {
        files = new ArrayList<VirtualFile>();
        for (ChangeList list : changeListManager.getChangeListsCopy()) {
          if (!Comparing.strEqual(list.getName(), (String)myChangeLists.getSelectedItem())) continue;
          final Collection<Change> changes = list.getChanges();
          for (Change change : changes) {
            final ContentRevision afterRevision = change.getAfterRevision();
            if (afterRevision != null) {
              final VirtualFile vFile = afterRevision.getFile().getVirtualFile();
              if (vFile != null) {
                files.add(vFile);
              }
            }
          }
        }
      }
      scope = new AnalysisScope(project, new HashSet<VirtualFile>(files));
      uiOptions.SCOPE_TYPE = AnalysisScope.UNCOMMITTED_FILES;
    }
    else {
      scope = defaultScope;
      uiOptions.SCOPE_TYPE = defaultScope.getScopeType();//just not project scope
    }
  }
  uiOptions.ANALYZE_TEST_SOURCES = isInspectTestSources();
  scope.setIncludeTestSource(isInspectTestSources());
  scope.setScope(getCustomScope());

  FindSettings.getInstance().setDefaultScopeName(scope.getDisplayName());
  return scope;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:BaseAnalysisActionDialog.java


注:本文中的com.intellij.openapi.vcs.changes.Change.getAfterRevision方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。