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

Java DvcsUtil类代码示例

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

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



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

示例1: getAffectedSupports

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@NotNull
private <R extends Repository, S extends PushSource, T extends PushTarget> List<PushSupport<R, S, T>> getAffectedSupports() {
  Collection<Repository> repositories = myGlobalRepositoryManager.getRepositories();
  Collection<AbstractVcs> vcss = ContainerUtil.map2Set(repositories, new Function<Repository, AbstractVcs>() {
    @Override
    public AbstractVcs fun(@NotNull Repository repository) {
      return repository.getVcs();
    }
  });
  return ContainerUtil.map(vcss, new Function<AbstractVcs, PushSupport<R, S, T>>() {
    @Override
    public PushSupport<R, S, T> fun(AbstractVcs vcs) {
      //noinspection unchecked
      return DvcsUtil.getPushSupport(vcs);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PushController.java


示例2: rebaseCurrentBranch

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
private static void rebaseCurrentBranch(@NotNull final Project project,
                                        @NotNull final GitRepository gitRepository,
                                        @NotNull final ProgressIndicator indicator) {
  final Git git = ServiceManager.getService(project, Git.class);
  final GitPlatformFacade facade = ServiceManager.getService(project, GitPlatformFacade.class);
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    List<VirtualFile> rootsToSave = Collections.singletonList(gitRepository.getRoot());
    GitPreservingProcess process = new GitPreservingProcess(project, facade, git, rootsToSave, "Rebasing", "upstream/master",
                                                            GitVcsSettings.UpdateChangesPolicy.STASH, indicator,
      new Runnable() {
        @Override
        public void run() {
          doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);
        }
      });
    process.execute();
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GithubRebaseAction.java


示例3: getDefaultMessageFor

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@Nullable
public String getDefaultMessageFor(FilePath[] filesToCheckin) {
  LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet();
  for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
    VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
    VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
    try {
      if (mergeMsg == null && squashMsg == null) {
        continue;
      }
      String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
      if (mergeMsg != null) {
        messages.add(loadMessage(mergeMsg, encoding));
      }
      else {
        messages.add(loadMessage(squashMsg, encoding));
      }
    }
    catch (IOException e) {
      if (log.isDebugEnabled()) {
        log.debug("Unable to load merge message", e);
      }
    }
  }
  return DvcsUtil.joinMessagesOrNull(messages);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitCheckinEnvironment.java


示例4: GitRepositoryUpdater

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
GitRepositoryUpdater(@NotNull GitRepository repository) {
  myRepository = repository;
  VirtualFile gitDir = repository.getGitDir();
  myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(gitDir.getPath(), true);

  myRepositoryFiles = GitRepositoryFiles.getInstance(gitDir);
  DvcsUtil.visitVcsDirVfs(gitDir, GitRepositoryFiles.getSubDirRelativePaths());
  myHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsHeadsPath());
  myRemotesDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsRemotesPath());
  myTagsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsTagsPath());

  Project project = repository.getProject();
  myUpdateQueue = new QueueProcessor<Object>(new DvcsUtil.Updater(repository), project.getDisposed());
  if (!project.isDisposed()) {
    myMessageBusConnection = project.getMessageBus().connect();
    myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
  }
  else {
    myMessageBusConnection = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitRepositoryUpdater.java


示例5: readPackedBranches

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@NotNull
private Map<String, String> readPackedBranches() {
  if (!myPackedRefsFile.exists()) {
    return Collections.emptyMap();
  }
  try {
    String content = DvcsUtil.tryLoadFile(myPackedRefsFile);
    return ContainerUtil.map2MapNotNull(LineTokenizer.tokenize(content, false), new Function<String, Pair<String, String>>() {
      @Override
      public Pair<String, String> fun(String line) {
        return parsePackedRefsLine(line);
      }
    });
  }
  catch (RepoStateException e) {
    return Collections.emptyMap();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitRepositoryReader.java


示例6: readHead

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@NotNull
private HeadInfo readHead() {
  String headContent;
  try {
    headContent = DvcsUtil.tryLoadFile(myHeadFile);
  }
  catch (RepoStateException e) {
    LOG.error(e);
    return new HeadInfo(false, null);
  }

  Hash hash = parseHash(headContent);
  if (hash != null) {
    return new HeadInfo(false, headContent);
  }
  String target = getTarget(headContent);
  if (target != null) {
    return new HeadInfo(true, target);
  }
  LOG.error(new RepoStateException("Invalid format of the .git/HEAD file: [" + headContent + "]")); // including "refs/tags/v1"
  return new HeadInfo(false, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GitRepositoryReader.java


示例7: makeAdditionalInfoByRoot

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@NotNull
private String makeAdditionalInfoByRoot(@NotNull Map<VirtualFile, String> additionalInfo) {
  if (additionalInfo.isEmpty()) {
    return "";
  }
  StringBuilder info = new StringBuilder();
  if (myRepositoryManager.moreThanOneRoot()) {
    for (Map.Entry<VirtualFile, String> entry : additionalInfo.entrySet()) {
      info.append(entry.getValue()).append(" in ").append(DvcsUtil.getShortRepositoryName(myProject, entry.getKey())).append("<br/>");
    }
  }
  else {
    info.append(additionalInfo.values().iterator().next());
  }
  return info.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GitFetcher.java


示例8: perform

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void perform(@NotNull final Project project,
                       @NotNull final List<VirtualFile> gitRoots,
                       @NotNull final VirtualFile defaultRoot,
                       final Set<VirtualFile> affectedRoots,
                       final List<VcsException> exceptions) throws VcsException {
  final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
  if (changeListManager.isFreezedWithNotification("Can not stash changes now")) return;
  GitStashDialog d = new GitStashDialog(project, gitRoots, defaultRoot);
  if (!d.showAndGet()) {
    return;
  }
  VirtualFile root = d.getGitRoot();
  affectedRoots.add(root);
  final GitLineHandler h = d.handler();
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
  ServiceManager.getService(project, GitPlatformFacade.class).hardRefresh(root);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitStash.java


示例9: perform

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void perform(@NotNull Project project,
                       @NotNull List<VirtualFile> gitRoots,
                       @NotNull VirtualFile defaultRoot,
                       Set<VirtualFile> affectedRoots,
                       List<VcsException> exceptions) throws VcsException {
  GitResetDialog d = new GitResetDialog(project, gitRoots, defaultRoot);
  if (!d.showAndGet()) {
    return;
  }
  GitLineHandler h = d.handler();
  affectedRoots.add(d.getGitRoot());
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
  GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
  manager.updateRepository(d.getGitRoot());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GitResetHead.java


示例10: cherryPick

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
public void cherryPick(@NotNull List<VcsFullCommitDetails> commits) {
  Map<GitRepository, List<VcsFullCommitDetails>> commitsInRoots =
    DvcsUtil.<GitRepository>groupCommitsByRoots(myPlatformFacade.getRepositoryManager(myProject), commits);
  List<GitCommitWrapper> successfulCommits = ContainerUtil.newArrayList();
  List<GitCommitWrapper> alreadyPicked = ContainerUtil.newArrayList();
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    for (Map.Entry<GitRepository, List<VcsFullCommitDetails>> entry : commitsInRoots.entrySet()) {
      GitRepository repository = entry.getKey();
      boolean result = cherryPick(repository, entry.getValue(), successfulCommits, alreadyPicked);
      repository.update();
      if (!result) {
        return;
      }
    }
    notifyResult(successfulCommits, alreadyPicked);
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitCherryPicker.java


示例11: setCurrentBranchInfo

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@Override
protected void setCurrentBranchInfo() {
  String currentBranchText = "Current branch";
  if (myRepositoryManager.moreThanOneRoot()) {
    if (myMultiRootBranchConfig.diverged()) {
      currentBranchText += " in " + DvcsUtil.getShortRepositoryName(myCurrentRepository) + ": " +
                           GitBranchUtil.getDisplayableBranchText(myCurrentRepository);
    }
    else {
      currentBranchText += ": " + myMultiRootBranchConfig.getCurrentBranch();
    }
  }
  else {
    currentBranchText += ": " + GitBranchUtil.getDisplayableBranchText(myCurrentRepository);
  }
  myPopup.setAdText(currentBranchText, SwingConstants.CENTER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GitBranchPopup.java


示例12: GitCompareBranchesDialog

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
public GitCompareBranchesDialog(@NotNull Project project,
                                @NotNull String branchName,
                                @NotNull String currentBranchName,
                                @NotNull GitCommitCompareInfo compareInfo,
                                @NotNull GitRepository initialRepo,
                                boolean dialog) {
  myProject = project;

  String rootString;
  if (compareInfo.getRepositories().size() == 1 && GitUtil.getRepositoryManager(myProject).moreThanOneRoot()) {
    rootString = " in root " + DvcsUtil.getShortRepositoryName(initialRepo);
  }
  else {
    rootString = "";
  }
  myTitle = String.format("Comparing %s with %s%s", currentBranchName, branchName, rootString);
  myMode = dialog ? Mode.MODAL : Mode.FRAME;

  JPanel diffPanel = new GitCompareBranchesDiffPanel(myProject, branchName, currentBranchName, compareInfo);
  myLogPanel = new GitCompareBranchesLogPanel(myProject, branchName, currentBranchName, compareInfo, initialRepo);

  myTabbedPane = new TabbedPaneImpl(SwingConstants.TOP);
  myTabbedPane.addTab("Log", VcsLogIcons.Branch, myLogPanel);
  myTabbedPane.addTab("Diff", AllIcons.Actions.Diff, diffPanel);
  myTabbedPane.setKeyboardNavigation(TabbedPaneImpl.DEFAULT_PREV_NEXT_SHORTCUTS);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitCompareBranchesDialog.java


示例13: mentionSkippedCommits

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@NotNull
private String mentionSkippedCommits() {
  if (mySkippedCommits.isEmpty()) return "";
  String message = "<br/>";
  if (mySkippedCommits.values().size() == 1) {
    message += "The following commit was skipped during rebase:<br/>";
  }
  else {
    message += "The following commits were skipped during rebase:<br/>";
  }
  message += StringUtil.join(mySkippedCommits.values(), new Function<GitRebaseUtils.CommitInfo, String>() {
    @Override
    public String fun(@NotNull GitRebaseUtils.CommitInfo commitInfo) {
      String commitMessage = StringUtil.shortenPathWithEllipsis(commitInfo.subject, 72, true);
      String hash = commitInfo.revision.asString();
      String shortHash = DvcsUtil.getShortHash(commitInfo.revision.asString());
      return String.format("<a href='%s'>%s</a> %s", hash, shortHash, commitMessage);
    }
  }, "<br/>");
  return message;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitRebaseProcess.java


示例14: HgRepositoryReader

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
public HgRepositoryReader(@NotNull HgVcs vcs, @NotNull File hgDir) {
  myHgDir = hgDir;
  DvcsUtil.assertFileExists(myHgDir, ".hg directory not found in " + myHgDir);
  myVcs = vcs;
  HgVersion version = myVcs.getVersion();
  myStatusInBranchFile = version.hasBranch2();
  myCacheDir = new File(myHgDir, "cache");
  myBranchHeadsFile = identifyBranchHeadFile(version, myCacheDir);
  myCurrentBranch = new File(myHgDir, "branch");
  myBookmarksFile = new File(myHgDir, "bookmarks");
  myCurrentBookmark = new File(myHgDir, "bookmarks.current");
  myLocalTagsFile = new File(myHgDir, "localtags");
  myTagsFile = new File(myHgDir.getParentFile(), ".hgtags");
  mySubrepoFile = new File(myHgDir.getParentFile(), ".hgsubstate");
  myDirStateFile = new File(myHgDir, "dirstate");
  myMqInternalDir = new File(myHgDir, "patches");
  myVcsObjectsFactory = ServiceManager.getService(vcs.getProject(), VcsLogObjectsFactory.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgRepositoryReader.java


示例15: readCurrentTipRevision

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
/**
 * Finds tip revision value.
 *
 * @return The tip revision hash, or <b>{@code null}</b> if tip revision is unknown - it is the initial repository state.
 */
@Nullable
public String readCurrentTipRevision() {
  if (!isBranchInfoAvailable()) return null;
  String[] branchesWithHeads;
  try {
    branchesWithHeads = DvcsUtil.tryLoadFile(myBranchHeadsFile).split("\n");
  }
  catch (RepoStateException e) {
    LOG.error(e);
    return null;
  }
  String head = branchesWithHeads[0];
  Matcher matcher = HASH_NAME.matcher(head);
  if (matcher.matches()) {
    return (matcher.group(1));
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:HgRepositoryReader.java


示例16: readBranches

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@NotNull
public Map<String, Set<Hash>> readBranches() {
  Map<String, Set<Hash>> branchesWithHashes = new HashMap<String, Set<Hash>>();
  // Set<String> branchNames = new HashSet<String>();
  if (isBranchInfoAvailable()) {
    Pattern activeBranchPattern = myStatusInBranchFile ? HASH_STATUS_NAME : HASH_NAME;
    String[] branchesWithHeads = DvcsUtil.tryLoadFileOrReturn(myBranchHeadsFile, "").split("\n");
    // first one - is a head revision: head hash + head number;
    for (int i = 1; i < branchesWithHeads.length; ++i) {
      Matcher matcher = activeBranchPattern.matcher(branchesWithHeads[i]);
      if (matcher.matches()) {
        String name = matcher.group(2);
        if (branchesWithHashes.containsKey(name)) {
          branchesWithHashes.get(name).add(myVcsObjectsFactory.createHash(matcher.group(1)));
        }
        else {
          Set<Hash> hashes = new HashSet<Hash>();
          hashes.add(myVcsObjectsFactory.createHash(matcher.group(1)));
          branchesWithHashes.put(name, hashes);
        }
      }
    }
  }
  return branchesWithHashes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgRepositoryReader.java


示例17: HgRepositoryUpdater

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
HgRepositoryUpdater(@NotNull final HgRepository repository) {
  VirtualFile hgDir = repository.getHgDir();
  myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(hgDir.getPath(), true);
  myRepositoryFiles = HgRepositoryFiles.getInstance(hgDir);
  DvcsUtil.visitVcsDirVfs(hgDir, HgRepositoryFiles.getSubDirRelativePaths());

  myBranchHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getBranchHeadsDirPath());
  myMqDir = VcsUtil.getVirtualFile(myRepositoryFiles.getMQDirPath());

  Project project = repository.getProject();
  myUpdateQueue = new QueueProcessor<Object>(new DvcsUtil.Updater(repository), project.getDisposed());
  myUpdateConfigQueue = new QueueProcessor<Object>(new Consumer<Object>() {
    @Override
    public void consume(Object dummy) {
      repository.updateConfig();
    }
  }, project.getDisposed());
  if (!project.isDisposed()) {
    myMessageBusConnection = project.getMessageBus().connect();
    myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
  }
  else {
    myMessageBusConnection = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgRepositoryUpdater.java


示例18: cherryPick

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@Override
public void cherryPick(@NotNull final List<VcsFullCommitDetails> commits) {
  Map<HgRepository, List<VcsFullCommitDetails>> commitsInRoots = DvcsUtil.groupCommitsByRoots(
    HgUtil.getRepositoryManager(myProject), commits);
  for (Map.Entry<HgRepository, List<VcsFullCommitDetails>> entry : commitsInRoots.entrySet()) {
    processGrafting(entry.getKey(), ContainerUtil.map(entry.getValue(),
                                                      new Function<VcsFullCommitDetails, String>() {
                                                        @Override
                                                        public String fun(
                                                          VcsFullCommitDetails commitDetails) {
                                                          return commitDetails.getId()
                                                            .asString();
                                                        }
                                                      }));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HgCherryPicker.java


示例19: execute

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@Nullable
private HgCommandResult execute() {
  HgPromptCommandExecutor commandExecutor = new HgPromptCommandExecutor(project);
  commandExecutor.setShowOutput(true);
  List<String> arguments = new LinkedList<String>();
  if (!StringUtil.isEmptyOrSpaces(revision)) {
    arguments.add("--rev");
    arguments.add(revision);
  }
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    HgCommandResult result = commandExecutor.executeInCurrentThread(repo.getRoot(), "merge", arguments);
    repo.update();
    return result;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HgMergeCommand.java


示例20: graft

import com.intellij.dvcs.DvcsUtil; //导入依赖的package包/类
@Nullable
private HgCommandResult graft(@NotNull List<String> params) {
  List<String> args = new ArrayList<String>();
  args.add("--log");
  args.addAll(params);
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    HgCommandResult result =
      new HgCommandExecutor(myProject)
        .executeInCurrentThread(myRepository.getRoot(), "graft", args);
    myRepository.update();
    return result;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HgGraftCommand.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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