• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VcsRevisionNumber类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.vcs.history.VcsRevisionNumber的典型用法代码示例。如果您正苦于以下问题:Java VcsRevisionNumber类的具体用法?Java VcsRevisionNumber怎么用?Java VcsRevisionNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VcsRevisionNumber类属于com.intellij.openapi.vcs.history包,在下文中一共展示了VcsRevisionNumber类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addChangeToIdx

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
private void addChangeToIdx(final Change change, final VcsKey key) {
  final ContentRevision afterRevision = change.getAfterRevision();
  final ContentRevision beforeRevision = change.getBeforeRevision();
  if (afterRevision != null) {
    add(afterRevision.getFile(), change.getFileStatus(), key, beforeRevision == null ? VcsRevisionNumber.NULL : beforeRevision.getRevisionNumber());
  }
  if (beforeRevision != null) {
    if (afterRevision != null) {
      if (! Comparing.equal(beforeRevision.getFile(), afterRevision.getFile())) {
        add(beforeRevision.getFile(), FileStatus.DELETED, key, beforeRevision.getRevisionNumber());
      }
    } else {
      add(beforeRevision.getFile(), change.getFileStatus(), key, beforeRevision.getRevisionNumber());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ChangeListsIndexes.java


示例2: getCurrentRevisions

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@NotNull
@Override
public Map<VirtualFile, VcsRevisionNumber> getCurrentRevisions(@NotNull Iterable<VirtualFile> files) {
  Map<VirtualFile, VcsRevisionNumber> result = ContainerUtil.newHashMap();
  Map<String, VirtualFile> items = ContainerUtil.newHashMap();
  List<File> ioFiles = ContainerUtil.newArrayList();

  for (VirtualFile file : files) {
    File ioFile = VfsUtilCore.virtualToIoFile(file);
    ioFiles.add(ioFile);
    items.put(ioFile.getAbsolutePath(), file);

    // process in blocks of BATCH_INFO_SIZE size
    if (items.size() == BATCH_INFO_SIZE) {
      collectRevisionsInBatch(result, items, ioFiles);
      items.clear();
      ioFiles.clear();
    }
  }
  // process left files
  collectRevisionsInBatch(result, items, ioFiles);

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnDiffProvider.java


示例3: createFileContent

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public ContentRevision createFileContent(final VcsRevisionNumber revisionNumber, VirtualFile selectedFile) {
  if ((revisionNumber instanceof CvsRevisionNumber)) {
    final CvsConnectionSettings settings = CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(selectedFile.getParent());
    final File file = new File(CvsUtil.getModuleName(selectedFile));
    final CvsRevisionNumber cvsRevisionNumber = ((CvsRevisionNumber)revisionNumber);
    final RevisionOrDate versionInfo;
    if (cvsRevisionNumber.getDateOrRevision() != null) {
      versionInfo = RevisionOrDateImpl.createOn(cvsRevisionNumber.getDateOrRevision());
    }
    else {
      versionInfo = new SimpleRevision(cvsRevisionNumber.asString());
    }

    if (selectedFile.getFileType().isBinary()) {
      return new CvsBinaryContentRevision(file, file, versionInfo, settings, myProject);
    }
    else {
      return new CvsContentRevision(file, file, versionInfo, settings, myProject);
    }

  } else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:CvsDiffProvider.java


示例4: createFileContent

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@NotNull
@Override
public ContentRevision createFileContent(@NotNull VcsRevisionNumber revisionNumber, @NotNull VirtualFile selectedFile) {
  FilePath filePath = VcsUtil.getFilePath(selectedFile);
  SVNRevision svnRevision = ((SvnRevisionNumber)revisionNumber).getRevision();

  if (!SVNRevision.HEAD.equals(svnRevision) && revisionNumber.equals(getCurrentRevision(selectedFile))) {
    return SvnContentRevision.createBaseRevision(myVcs, filePath, svnRevision);
  }

  // not clear why we need it, with remote check..
  Status svnStatus = getFileStatus(VfsUtilCore.virtualToIoFile(selectedFile), false);

  return svnStatus != null && svnRevision.equals(svnStatus.getRevision())
         ? SvnContentRevision.createBaseRevision(myVcs, filePath, svnRevision)
         : SvnContentRevision.createRemote(myVcs, filePath, svnRevision);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SvnDiffProvider.java


示例5: isRecent

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@Override
@Nullable
public ThreeState isRecent(final VirtualFile vf,
                           final VcsKey vcsKey,
                           final VcsRevisionNumber number,
                           final TextRange range,
                           final long boundTime) {
  TreeMap<Integer, Long> treeMap;
  synchronized (myLock) {
    treeMap = myCache.get(new HistoryCacheWithRevisionKey(VcsContextFactory.SERVICE.getInstance().createFilePathOn(vf), vcsKey, number));
  }
  if (treeMap != null) {
    Map.Entry<Integer, Long> last = treeMap.floorEntry(range.getEndOffset());
    if (last == null || last.getKey() < range.getStartOffset()) return ThreeState.NO;
    Map.Entry<Integer, Long> first = treeMap.ceilingEntry(range.getStartOffset());
    assert first != null;
    final SortedMap<Integer,Long> interval = treeMap.subMap(first.getKey(), last.getKey());
    for (Map.Entry<Integer, Long> entry : interval.entrySet()) {
      if (entry.getValue() >= boundTime) return ThreeState.YES;
    }
    return ThreeState.NO;
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ContentAnnotationCacheImpl.java


示例6: register

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@Override
public void register(final VirtualFile vf, final VcsKey vcsKey, final VcsRevisionNumber number, final FileAnnotation fa) {
  final HistoryCacheWithRevisionKey key = new HistoryCacheWithRevisionKey(VcsContextFactory.SERVICE.getInstance().createFilePathOn(vf), vcsKey, number);
  synchronized (myLock) {
    if (myCache.get(key) != null) return;
  }
  final long absoluteLimit = System.currentTimeMillis() - VcsContentAnnotationSettings.ourAbsoluteLimit;
  final TreeMap<Integer, Long> map = new TreeMap<Integer, Long>();
  final int lineCount = fa.getLineCount();
  for (int i = 0; i < lineCount; i++) {
    Date lineDate = fa.getLineDate(i);
    if (lineDate == null) return;
    if (lineDate.getTime() >= absoluteLimit) map.put(i, lineDate.getTime());
  }
  synchronized (myLock) {
    myCache.put(key, map);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ContentAnnotationCacheImpl.java


示例7: VcsAnnotationLocalChangesListenerImpl

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public VcsAnnotationLocalChangesListenerImpl(Project project, final ProjectLevelVcsManager vcsManager) {
  myLock = new Object();
  myUpdateStuff = createUpdateStuff();
  myUpdater = new ZipperUpdater(ApplicationManager.getApplication().isUnitTestMode() ? 10 : 300, Alarm.ThreadToUse.POOLED_THREAD, project);
  myConnection = project.getMessageBus().connect();
  myLocalFileSystem = LocalFileSystem.getInstance();
  VcsAnnotationRefresher handler = createHandler();
  myDirtyPaths = new HashSet<String>();
  myDirtyChanges = new HashMap<String, VcsRevisionNumber>();
  myDirtyFiles = new HashSet<VirtualFile>();
  myFileAnnotationMap = MultiMap.createSet();
  myVcsManager = vcsManager;
  myVcsKeySet = new HashSet<VcsKey>();

  myConnection.subscribe(VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED, handler);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VcsAnnotationLocalChangesListenerImpl.java


示例8: getOrLoadCurrentAsBytes

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public static Pair<VcsRevisionNumber, byte[]> getOrLoadCurrentAsBytes(final Project project, FilePath path, @NotNull VcsKey vcsKey,
    final CurrentRevisionProvider loader) throws VcsException, IOException {
  ContentRevisionCache cache = ProjectLevelVcsManager.getInstance(project).getContentRevisionCache();

  VcsRevisionNumber currentRevision;
  Pair<VcsRevisionNumber, byte[]> loaded;
  while (true) {
    currentRevision = putIntoCurrentCache(cache, path, vcsKey, loader);
    final byte[] cachedCurrent = cache.getBytes(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT);
    if (cachedCurrent != null) {
      return Pair.create(currentRevision, cachedCurrent);
    }
    checkLocalFileSize(path);
    loaded = loader.get();
    if (loaded.getFirst().equals(currentRevision)) break;
  }

  cache.put(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT, loaded.getSecond());
  return loaded;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ContentRevisionCache.java


示例9: getOneList

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@Override
public Pair<CommittedChangeList, FilePath> getOneList(VirtualFile file, VcsRevisionNumber number) throws VcsException {
  final ChangeBrowserSettings settings = createDefaultSettings();
  settings.USE_CHANGE_AFTER_FILTER = true;
  settings.USE_CHANGE_BEFORE_FILTER = true;
  settings.CHANGE_AFTER = number.asString();
  settings.CHANGE_BEFORE = number.asString();
  // todo implement in proper way
  VirtualFile localVirtualFile = HgUtil.convertToLocalVirtualFile(file);
  if (localVirtualFile == null) {
    return null;
  }
  final FilePath filePath = VcsUtil.getFilePath(localVirtualFile);
  final CommittedChangeList list = getCommittedChangesForRevision(getLocationFor(filePath), number.asString());
  if (list != null) {
    return new Pair<CommittedChangeList, FilePath>(list, filePath);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HgCachingCommittedChangesProvider.java


示例10: isChangeLocallyAvailable

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public boolean isChangeLocallyAvailable(final FilePath filePath, @Nullable VcsRevisionNumber localRevision,
                                        VcsRevisionNumber changeRevision, final CvsChangeList changeList) {
  if (localRevision instanceof CvsRevisionNumber && changeRevision instanceof CvsRevisionNumber) {
    final CvsRevisionNumber cvsLocalRevision = (CvsRevisionNumber)localRevision;
    final CvsRevisionNumber cvsChangeRevision = (CvsRevisionNumber)changeRevision;
    final int[] localSubRevisions = cvsLocalRevision.getSubRevisions();
    final int[] changeSubRevisions = cvsChangeRevision.getSubRevisions();
    if (localSubRevisions != null && changeSubRevisions != null) {
      if (localSubRevisions.length != changeSubRevisions.length) {
        // local is trunk, change is branch / vice versa
        return true;
      }
      for(int i=2; i<localSubRevisions.length; i += 2) {
        if (localSubRevisions [i] != changeSubRevisions [i]) {
          // local is one branch, change is a different branch
          return true;
        }
      }
    }
  }

  return isDifferentBranch(filePath, changeList) || (localRevision != null && localRevision.compareTo(changeRevision) >= 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CvsCommittedChangesProvider.java


示例11: next

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@Override
public String next() {
  int nextLine;
  while (lineNumberInBounds()) {
    final VcsRevisionNumber vcsRevisionNumber = myAnnotation.originalRevision(myCurrentLine);
    if (myRevisionNumber.equals(vcsRevisionNumber)) {
      nextLine = myCurrentLine;
      final String text = myContentsLines.getLineContents(nextLine);
      if (!StringUtil.isEmptyOrSpaces(text)) {
        ++myCurrentLine;
        return text;
      }
    }
    ++myCurrentLine;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ShowDiffFromAnnotation.java


示例12: PreparedFragmentedContent

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public PreparedFragmentedContent(final Project project, final FragmentedContent fragmentedContent, final String fileName,
                                 final FileType fileType,
                                 VcsRevisionNumber beforeNumber,
                                 VcsRevisionNumber afterNumber,
                                 FilePath path,
                                 VirtualFile file) {
  myFile = file;
  myProject = project;
  myFragmentedContent = fragmentedContent;
  myFileName = fileName;
  myFileType = fileType;
  myBeforeNumber = beforeNumber;
  myAfterNumber = afterNumber;
  myFilePath = path;
  oldConvertor = new LineNumberConvertor();
  newConvertor = new LineNumberConvertor();
  sbOld = new StringBuilder();
  sbNew = new StringBuilder();
  myBeforeFragments = new ArrayList<TextRange>(fragmentedContent.getSize());
  myAfterFragments = new ArrayList<TextRange>(fragmentedContent.getSize());
  myLineRanges = new ArrayList<BeforeAfter<Integer>>();
  fromFragmentedContent(fragmentedContent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PreparedFragmentedContent.java


示例13: createUpdateStuff

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
private Runnable createUpdateStuff() {
  return new Runnable() {
    @Override
    public void run() {
      final Set<String> paths = new HashSet<String>();
      final Map<String, VcsRevisionNumber> changes = new HashMap<String, VcsRevisionNumber>();
      final Set<VirtualFile> files = new HashSet<VirtualFile>();
      Set<VcsKey> vcsToRefresh;
      synchronized (myLock) {
        vcsToRefresh = new HashSet<VcsKey>(myVcsKeySet);

        paths.addAll(myDirtyPaths);
        changes.putAll(myDirtyChanges);
        files.addAll(myDirtyFiles);
        myDirtyPaths.clear();
        myDirtyChanges.clear();
        myVcsKeySet.clear();
        myDirtyFiles.clear();
      }

      closeForVcs(vcsToRefresh);
      checkByDirtyScope(paths, changes, files);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:VcsAnnotationLocalChangesListenerImpl.java


示例14: AnnotateCurrentRevisionAction

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public AnnotateCurrentRevisionAction(@NotNull FileAnnotation annotation, @NotNull AbstractVcs vcs) {
  super("Annotate Revision", "Annotate selected revision in new tab", AllIcons.Actions.Annotate,
        annotation, vcs);
  List<VcsFileRevision> revisions = annotation.getRevisions();
  if (revisions == null) {
    myRevisions = null;
    return;
  }

  Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<VcsRevisionNumber, VcsFileRevision>();
  for (VcsFileRevision revision : revisions) {
    map.put(revision.getRevisionNumber(), revision);
  }

  myRevisions = new ArrayList<VcsFileRevision>(annotation.getLineCount());
  for (int i = 0; i < annotation.getLineCount(); i++) {
    myRevisions.add(map.get(annotation.getLineRevisionNumber(i)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AnnotateCurrentRevisionAction.java


示例15: AnnotatePreviousRevisionAction

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public AnnotatePreviousRevisionAction(@NotNull FileAnnotation annotation, @NotNull AbstractVcs vcs) {
  super("Annotate Previous Revision", "Annotate successor of selected revision in new tab", AllIcons.Actions.Annotate,
        annotation, vcs);
  List<VcsFileRevision> revisions = annotation.getRevisions();
  if (revisions == null) {
    myRevisions = null;
    return;
  }

  Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<VcsRevisionNumber, VcsFileRevision>();
  for (int i = 0; i < revisions.size(); i++) {
    VcsFileRevision revision = revisions.get(i);
    VcsFileRevision previousRevision = i + 1 < revisions.size() ? revisions.get(i + 1) : null;
    map.put(revision.getRevisionNumber(), previousRevision);
  }

  myRevisions = new ArrayList<VcsFileRevision>(annotation.getLineCount());
  for (int i = 0; i < annotation.getLineCount(); i++) {
    myRevisions.add(map.get(annotation.getLineRevisionNumber(i)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AnnotatePreviousRevisionAction.java


示例16: actionPerformed

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@Override
protected void actionPerformed(@NotNull VcsContext vcsContext) {

  final VirtualFile file = vcsContext.getSelectedFiles()[0];
  final Project project = vcsContext.getProject();
  final AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
  if (vcs == null) {
    return;
  }
  RevisionSelector selector = vcs.getRevisionSelector();
  final DiffProvider diffProvider = vcs.getDiffProvider();

  if (selector != null) {
    final VcsRevisionNumber vcsRevisionNumber = selector.selectNumber(file);

    if (vcsRevisionNumber != null) {
      DiffActionExecutor.showDiff(diffProvider, vcsRevisionNumber, file, project, VcsBackgroundableActions.COMPARE_WITH);
    }
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SelectAndCompareWithSelectedRevisionAction.java


示例17: refreshForPath

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
private void refreshForPath(String path, VcsRevisionNumber number) {
  final File file = new File(path);
  VirtualFile vf = myLocalFileSystem.findFileByIoFile(file);
  if (vf == null) {
    vf = myLocalFileSystem.refreshAndFindFileByIoFile(file);
  }
  if (vf == null) return;
  processFile(number, vf);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:VcsAnnotationLocalChangesListenerImpl.java


示例18: RemoteRevisionsNumbersCache

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
RemoteRevisionsNumbersCache(final Project project) {
  myProject = project;
  myLock = new Object();
  myData = new HashMap<String, Pair<VcsRoot, VcsRevisionNumber>>();
  myRefreshingQueues = Collections.synchronizedMap(new HashMap<VcsRoot, LazyRefreshingSelfQueue<String>>());
  myLatestRevisionsMap = new HashMap<String, VcsRevisionNumber>();
  myLfs = LocalFileSystem.getInstance();
  myVcsManager = ProjectLevelVcsManager.getInstance(project);
  myVcsConfiguration = VcsConfiguration.getInstance(project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:RemoteRevisionsNumbersCache.java


示例19: HgAnnotation

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
public HgAnnotation(@NotNull Project project, @NotNull HgFile hgFile, @NotNull List<HgAnnotationLine> lines,
                    @NotNull List<HgFileRevision> vcsFileRevisions, VcsRevisionNumber revision) {
  super(project);
  myProject = project;
  myLines = lines;
  myFileRevisions = vcsFileRevisions;
  myFile = hgFile;
  myCurrentRevision = revision;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HgAnnotation.java


示例20: getHead

import com.intellij.openapi.vcs.history.VcsRevisionNumber; //导入依赖的package包/类
@NotNull
private VcsRevisionNumber getHead() throws VcsException {
  if (myRepository != null) {
    // we force update the GitRepository, because update is asynchronous, and thus the GitChangeProvider may be asked for changes
    // before the GitRepositoryUpdater has captures the current revision change and has updated the GitRepository.
    myRepository.update();
    final String rev = myRepository.getCurrentRevision();
    return rev != null ? new GitRevisionNumber(rev) : VcsRevisionNumber.NULL;
  } else {
    // this may happen on the project startup, when GitChangeProvider may be queried before GitRepository has been initialized.
    LOG.info("GitRepository is null for root " + myVcsRoot);
    return getHeadFromGit();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GitNewChangesCollector.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ZipSigner类代码示例发布时间:2022-05-22
下一篇:
Java DataOutput类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap