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


Java Change.getBeforeRevision方法代码示例

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


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

示例1: 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

示例2: doMerge

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
protected void doMerge() throws VcsException {
  for (Change change : mySelectedChanges) {
    SvnRepositoryContentRevision before = (SvnRepositoryContentRevision)change.getBeforeRevision();
    SvnRepositoryContentRevision after = (SvnRepositoryContentRevision)change.getAfterRevision();

    if (before == null) {
      //noinspection ConstantConditions
      add(after);
    }
    else if (after == null) {
      delete(before);
    }
    else {
      merge(before, after);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PointMerger.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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: convert

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public DiffRequestPresentable convert(final Change ch, final boolean forceText) {
  if (ch.hasOtherLayers() && myRecursive) {
    return new MultipleDiffRequestPresentable(myProject, ch);
  }
  if (ChangesUtil.isTextConflictingChange(ch)) {
    final AbstractVcs vcs = ChangesUtil.getVcsForChange(ch, myProject);
    if (vcs == null || vcs.getMergeProvider() == null) return null;
    final FilePath path = ChangesUtil.getFilePath(ch);
    VirtualFile vf = path.getVirtualFile();
    if (vf == null) {
      vf = LocalFileSystem.getInstance().refreshAndFindFileByPath(path.getPath());
    }
    if (vf == null) return null;

    return new ConflictedDiffRequestPresentable(myProject, vf, ch);
  } else {
    if (forceText) {
      if (ch.getBeforeRevision() != null && ch.getAfterRevision() != null) {
        try {
          if (StringUtil.isEmptyOrSpaces(ch.getBeforeRevision().getContent()) &&
              StringUtil.isEmptyOrSpaces(ch.getAfterRevision().getContent())) {
            return null;
          }
          if (StringUtil.equals(ch.getBeforeRevision().getContent(), ch.getAfterRevision().getContent())) {
            return null;
          }
        }
        catch (VcsException e) {
          //
        }
      }
    }
    final ChangeDiffRequestPresentable presentable = new ChangeDiffRequestPresentable(myProject, ch);
    if (forceText) {
      presentable.setIgnoreDirectoryFlag(true);
    }
    return presentable;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ChangeForDiffConvertor.java

示例10: isMoveRenameReplace

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public static boolean isMoveRenameReplace(@NotNull Change c) {
  if (c.getAfterRevision() == null || c.getBeforeRevision() == null) return false;

  return c.isIsReplaced() ||
         c.isMoved() ||
         c.isRenamed() ||
         (!Comparing.equal(c.getBeforeRevision().getFile(), c.getAfterRevision().getFile()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SvnRollbackEnvironment.java

示例11: 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

示例12: isChangeForFolder

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public static boolean isChangeForFolder(Change change) {
  ContentRevision revB = change.getBeforeRevision();
  ContentRevision revA = change.getAfterRevision();
  return (revA != null && revA.getFile().isDirectory()) || (revB != null && revB.getFile().isDirectory());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:VcsUtil.java

示例13: afterNull

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public boolean afterNull(Change change) {
  return change.getBeforeRevision() == null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RefreshVFsSynchronously.java

示例14: beforeNull

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public boolean beforeNull(Change change) {
  return change.getBeforeRevision() == null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RefreshVFsSynchronously.java

示例15: testMineFull

import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@Test
public void testMineFull() throws Exception {
  int cnt = 0;
  myWorkingCopyDir = createDirInCommand(myWorkingCopyDir, "test--");
  myTheirs = createDirInCommand(myTheirs, "theirs--");
  // todo debug
  //final TreeConflictData.Data data = TreeConflictData.DirToDir.MINE_UNV_THEIRS_MOVE;
  //final TreeConflictData.Data data = TreeConflictData.FileToFile.MINE_EDIT_THEIRS_MOVE;
  for (final TreeConflictData.Data data : TreeConflictData.ourAll) {
    if (myTraceClient) {
      System.out.println("========= TEST " + getTestName(data) + " =========");
    }

    ((ChangeListManagerImpl) myChangeListManager).stopEveryThingIfInTestMode();
    myWorkingCopyDir = createDirInCommand(myWorkingCopyDir.getParent(), "test" + cnt);
    myTheirs = createDirInCommand(myTheirs.getParent(), "theirs" + cnt);
    mySvnClientRunner.checkout(myRepoUrl, myTheirs);
    mySvnClientRunner.checkout(myRepoUrl, myWorkingCopyDir);
    sleep(200);

    ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings(
      Collections.singletonList(new VcsDirectoryMapping(myWorkingCopyDir.getPath(), myVcs.getName())));
    createSubTree(data);
    myTheirs.refresh(false, true);
    final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner);
    creator.create();
    sleep(200);

    ((ChangeListManagerImpl)myChangeListManager).forceGoInTestMode();
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);

    final String conflictFile = data.getConflictFile();

    final File conflictIoFile = new File(myWorkingCopyDir.getPath(), conflictFile);
    final FilePath filePath = VcsUtil.getFilePath(conflictIoFile);
    final Change change = myChangeListManager.getChange(filePath);
    Assert.assertNotNull(change);
    Assert.assertTrue(change instanceof ConflictedSvnChange);
    final SvnRevisionNumber committedRevision =
      change.getBeforeRevision() != null ? (SvnRevisionNumber)change.getBeforeRevision().getRevisionNumber() : null;
    //SvnRevisionNumber committedRevision = new SvnRevisionNumber(SVNRevision.create(cnt * 2 + 1));
    final SvnTreeConflictResolver resolver = new SvnTreeConflictResolver(myVcs, filePath, null);

    resolver.resolveSelectMineFull();

    myTheirs.refresh(false, true);
    myWorkingCopyDir.refresh(false, true);
    checkStatusesAfterMineFullResolve(data, conflictIoFile);
    checkFileContents(data, conflictIoFile);

    ++ cnt;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:SvnResolveTreeAcceptVariantsTest.java


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