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


Java Repository类代码示例

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


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

示例1: getAffectedSupports

import com.intellij.dvcs.repo.Repository; //导入依赖的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: startLoadingCommits

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
private void startLoadingCommits() {
  Map<RepositoryNode, MyRepoModel> priorityLoading = ContainerUtil.newLinkedHashMap();
  Map<RepositoryNode, MyRepoModel> others = ContainerUtil.newLinkedHashMap();
  RepositoryNode nodeForCurrentEditor = findNodeByRepo(myCurrentlyOpenedRepository);
  for (Map.Entry<RepositoryNode, MyRepoModel<?, ?, ?>> entry : myView2Model.entrySet()) {
    MyRepoModel model = entry.getValue();
    Repository repository = model.getRepository();
    RepositoryNode repoNode = entry.getKey();
    if (preselectByUser(repository)) {
      priorityLoading.put(repoNode, model);
    }
    else if (model.getSupport().shouldRequestIncomingChangesForNotCheckedRepositories() && !repoNode.equals(nodeForCurrentEditor)) {
      others.put(repoNode, model);
    }
  }
  if (nodeForCurrentEditor != null) {
    //add repo for currently opened editor to the end of priority queue
    priorityLoading.put(nodeForCurrentEditor, myView2Model.get(nodeForCurrentEditor));
  }
  loadCommitsFromMap(priorityLoading);
  loadCommitsFromMap(others);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PushController.java

示例3: groupCommitsByRoots

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@NotNull
public static <R extends Repository> Map<R, List<VcsFullCommitDetails>> groupCommitsByRoots(@NotNull RepositoryManager<R> repoManager,
                                                                                            @NotNull List<? extends VcsFullCommitDetails> commits) {
  Map<R, List<VcsFullCommitDetails>> groupedCommits = ContainerUtil.newHashMap();
  for (VcsFullCommitDetails commit : commits) {
    R repository = repoManager.getRepositoryForRoot(commit.getRoot());
    if (repository == null) {
      LOGGER.info("No repository found for commit " + commit);
      continue;
    }
    List<VcsFullCommitDetails> commitsInRoot = groupedCommits.get(repository);
    if (commitsInRoot == null) {
      commitsInRoot = ContainerUtil.newArrayList();
      groupedCommits.put(repository, commitsInRoot);
    }
    commitsInRoot.add(commit);
  }
  return groupedCommits;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DvcsUtil.java

示例4: createMockRepositoryCreator

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@NotNull
private VcsRepositoryCreator createMockRepositoryCreator() {
  return new VcsRepositoryCreator() {
    @NotNull
    @Override
    public VcsKey getVcsKey() {
      return myVcs.getKeyInstanceMethod();
    }

    @Nullable
    @Override
    public Repository createRepositoryIfValid(@NotNull VirtualFile root) {
      READY_TO_READ.countDown();
      try {
        //wait until reading thread gets existing info
        if (!CONTINUE_MODIFY.await(1, TimeUnit.SECONDS)) return null;
      }
      catch (InterruptedException e) {
        return null;
      }
      return new MockRepositoryImpl(myProject, root, myProject);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:VcsRepositoryManagerTest.java

示例5: initRepository

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@NotNull
@Override
protected Repository initRepository(@NotNull String name) {
  String tempDirectory = FileUtil.getTempDirectory();
  String root = tempDirectory + "/" + name;
  assertTrue(new File(root).mkdirs());
  HgPlatformTest.initRepo(root);
  touch("a.txt");
  hg("add a.txt");
  hg("commit -m another");
  hg("up -r 0");
  ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(myProject);
  vcsManager.setDirectoryMapping(root, HgVcs.VCS_NAME);
  VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(root));
  HgRepository repository = HgUtil.getRepositoryManager(myProject).getRepositoryForRoot(file);
  assertNotNull("Couldn't find repository for root " + root, repository);
  return repository;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgTaskBranchesTest.java

示例6: testCleanupRemovedBranch

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
public void testCleanupRemovedBranch() throws InterruptedException {
  Repository repository = initRepository("foo");
  LocalTask defaultTask = myTaskManager.getActiveTask();
  assertNotNull(defaultTask);
  assertEquals(0, defaultTask.getBranches().size());
  LocalTaskImpl foo = myTaskManager.createLocalTask("foo");
  LocalTask localTask = myTaskManager.activateTask(foo, false);
  myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask));
  assertEquals(2, localTask.getBranches().size());
  assertEquals(1, defaultTask.getBranches().size());

  // let's add non-existing branch
  BranchInfo info = new BranchInfo();
  info.name = "non-existing";
  info.repository = defaultTask.getBranches().get(0).repository;
  defaultTask.addBranch(info);
  assertEquals("foo", repository.getCurrentBranchName());
  myTaskManager.activateTask(defaultTask, false);
  assertEquals(getDefaultBranchName(), repository.getCurrentBranchName());
  // do not re-create "non-existing"
  assertEquals(2, getNumberOfBranches(repository));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TaskBranchesTest.java

示例7: HgRepoInfo

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
public HgRepoInfo(@NotNull String currentBranch,
                  @Nullable String currentRevision,
                  @Nullable String currentTipRevision,
                  @NotNull Repository.State state,
                  @NotNull Map<String, Set<Hash>> branches,
                  @NotNull Collection<HgNameWithHashInfo> bookmarks,
                  @Nullable String currentBookmark,
                  @NotNull Collection<HgNameWithHashInfo> tags,
                  @NotNull Collection<HgNameWithHashInfo> localTags, @NotNull Collection<HgNameWithHashInfo> subrepos,
                  @NotNull List<HgNameWithHashInfo> mqApplied, @NotNull List<String> mqNames) {
  myCurrentBranch = currentBranch;
  myCurrentRevision = currentRevision;
  myTipRevision = currentTipRevision;
  myState = state;
  myBranches = branches;
  myBookmarks = new LinkedHashSet<HgNameWithHashInfo>(bookmarks);
  myCurrentBookmark = currentBookmark;
  myTags = new LinkedHashSet<HgNameWithHashInfo>(tags);
  myLocalTags = new LinkedHashSet<HgNameWithHashInfo>(localTags);
  mySubrepos = new HashSet<HgNameWithHashInfo>(subrepos);
  myMQApplied = mqApplied;
  myMqNames = mqNames;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:HgRepoInfo.java

示例8: commitChunkFiles

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
private void commitChunkFiles(@NotNull List<String> chunk, boolean amendCommit, boolean withSubrepos, boolean closeBranch)
  throws VcsException {
  List<String> parameters = new LinkedList<String>();
  parameters.add("--logfile");
  parameters.add(saveCommitMessage().getAbsolutePath());
  // note: for now mercurial could not perform amend commit with -S option
  if (withSubrepos) {
    parameters.add("-S");
    parameters.addAll(mySubrepos);
  }
  else if (amendCommit) {
    parameters.add("--amend");
  }
  if (closeBranch) {
    if (chunk.isEmpty() && myRepository.getState() != Repository.State.MERGING) {
      //if there are changed files but nothing selected -> need to exclude all; if merge commit then nothing excluded
      parameters.add("-X");
      parameters.add("\"**\"");
    }
    parameters.add("--close-branch");
  }
  parameters.addAll(chunk);
  HgCommandExecutor executor = new HgCommandExecutor(myProject);
  ensureSuccess(executor.executeInCurrentThread(myRepository.getRoot(), "commit", parameters));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgCommitCommand.java

示例9: filterUnnamedHeads

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@NotNull
private Collection<Hash> filterUnnamedHeads() {
  Collection<Hash> branchWithHashes = myRepository.getBranches().get(myCurrentBranchName);
  String currentHead = myRepository.getCurrentRevision();
  if (branchWithHashes == null || currentHead == null || myRepository.getState() != Repository.State.NORMAL) {
    // repository is fresh or branch is fresh or complex state
    return Collections.emptySet();
  }
  else {
    Collection<Hash> bookmarkHashes = ContainerUtil.map(myRepository.getBookmarks(), new Function<HgNameWithHashInfo, Hash>() {
      @Override
      public Hash fun(HgNameWithHashInfo info) {
        return info.getHash();
      }
    });
    branchWithHashes.removeAll(bookmarkHashes);
    branchWithHashes.remove(HashImpl.build(currentHead));
  }
  return branchWithHashes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HgBranchPopupActions.java

示例10: getAffectedSupports

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@Nonnull
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(@Nonnull 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:consulo,项目名称:consulo,代码行数:18,代码来源:PushController.java

示例11: startLoadingCommits

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
private void startLoadingCommits() {
  Map<RepositoryNode, MyRepoModel> priorityLoading = ContainerUtil.newLinkedHashMap();
  Map<RepositoryNode, MyRepoModel> others = ContainerUtil.newLinkedHashMap();
  RepositoryNode nodeForCurrentEditor = findNodeByRepo(myCurrentlyOpenedRepository);
  for (Map.Entry<RepositoryNode, MyRepoModel<?, ?, ?>> entry : myView2Model.entrySet()) {
    MyRepoModel model = entry.getValue();
    Repository repository = model.getRepository();
    RepositoryNode repoNode = entry.getKey();
    if (preselectByUser(repository)) {
      priorityLoading.put(repoNode, model);
    }
    else if (model.getSupport().shouldRequestIncomingChangesForNotCheckedRepositories() && !repoNode.equals(nodeForCurrentEditor)) {
      others.put(repoNode, model);
    }
    if (shouldPreSelect(model)) {
      model.setChecked(true);
    }
  }
  if (nodeForCurrentEditor != null) {
    //add repo for currently opened editor to the end of priority queue
    priorityLoading.put(nodeForCurrentEditor, myView2Model.get(nodeForCurrentEditor));
  }
  loadCommitsFromMap(priorityLoading);
  loadCommitsFromMap(others);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:PushController.java

示例12: groupCommitsByRoots

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@Nonnull
public static <R extends Repository> Map<R, List<VcsFullCommitDetails>> groupCommitsByRoots(@Nonnull RepositoryManager<R> repoManager,
                                                                                            @Nonnull List<? extends VcsFullCommitDetails> commits) {
  Map<R, List<VcsFullCommitDetails>> groupedCommits = ContainerUtil.newHashMap();
  for (VcsFullCommitDetails commit : commits) {
    R repository = repoManager.getRepositoryForRoot(commit.getRoot());
    if (repository == null) {
      LOGGER.info("No repository found for commit " + commit);
      continue;
    }
    List<VcsFullCommitDetails> commitsInRoot = groupedCommits.get(repository);
    if (commitsInRoot == null) {
      commitsInRoot = ContainerUtil.newArrayList();
      groupedCommits.put(repository, commitsInRoot);
    }
    commitsInRoot.add(commit);
  }
  return groupedCommits;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:DvcsUtil.java

示例13: PushController

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
public PushController(@NotNull Project project,
                      @NotNull VcsPushDialog dialog,
                      @NotNull List<? extends Repository> preselectedRepositories, @Nullable Repository currentRepo) {
  myProject = project;
  myPushSettings = ServiceManager.getService(project, PushSettings.class);
  myGlobalRepositoryManager = VcsRepositoryManager.getInstance(project);
  myExcludedRepositoryRoots = ContainerUtil.newHashSet(myPushSettings.getExcludedRepoRoots());
  myPreselectedRepositories = preselectedRepositories;
  myCurrentlyOpenedRepository = currentRepo;
  myPushSupports = getAffectedSupports();
  mySingleRepoProject = isSingleRepoProject();
  myDialog = dialog;
  CheckedTreeNode rootNode = new CheckedTreeNode(null);
  createTreeModel(rootNode);
  myPushLog = new PushLog(myProject, rootNode, isSyncStrategiesAllowed());
  myPushLog.getTree().addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      // when user starts edit we need to force disable ok actions, because tree.isEditing() still false;
      // after editing completed okActions will be enabled automatically by dialog validation
      Boolean isEditMode = (Boolean)evt.getNewValue();
      if (isEditMode) {
        myDialog.disableOkActions();
      }
    }
  });
  startLoadingCommits();
  Disposer.register(dialog.getDisposable(), this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PushController.java

示例14: isSyncStrategiesAllowed

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
private boolean isSyncStrategiesAllowed() {
  return !mySingleRepoProject &&
         ContainerUtil.and(getAffectedSupports(), new Condition<PushSupport<Repository, PushSource, PushTarget>>() {
           @Override
           public boolean value(PushSupport<Repository, PushSource, PushTarget> support) {
             return support.mayChangeTargetsSync();
           }
         });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PushController.java

示例15: getPushSupportByRepository

import com.intellij.dvcs.repo.Repository; //导入依赖的package包/类
@Nullable
private <R extends Repository, S extends PushSource, T extends PushTarget> PushSupport<R, S, T> getPushSupportByRepository(@NotNull final R repository) {
  //noinspection unchecked
  return (PushSupport<R, S, T>)ContainerUtil.find(
    myPushSupports,
    new Condition<PushSupport<? extends Repository, ? extends PushSource, ? extends PushTarget>>() {
      @Override
      public boolean value(PushSupport<? extends Repository, ? extends PushSource, ? extends PushTarget> support) {
        return support.getVcs().equals(repository.getVcs());
      }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PushController.java


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