本文整理汇总了Java中git4idea.repo.GitRepository.getRoot方法的典型用法代码示例。如果您正苦于以下问题:Java GitRepository.getRoot方法的具体用法?Java GitRepository.getRoot怎么用?Java GitRepository.getRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git4idea.repo.GitRepository
的用法示例。
在下文中一共展示了GitRepository.getRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RepositoryNotifier
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
public RepositoryNotifier(CloudGitDeploymentDetector deploymentDetector, GitRepository repository) {
myDeploymentDetector = deploymentDetector;
myRepositoryRoot = repository.getRoot();
myCloudName = deploymentDetector.getCloudType().getPresentableName();
String path = FileUtil.toSystemDependentName(myRepositoryRoot.getPath());
myNotification = myNotifier.showMessage(CloudBundle.getText("git.cloud.app.detected", myCloudName, path),
MessageType.INFO,
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification,
@NotNull HyperlinkEvent event) {
setupRunConfiguration();
}
});
}
示例2: checkout
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
/**
* {@code git checkout <reference>} <br/>
* {@code git checkout -b <newBranch> <reference>}
*/
@NotNull
@Override
public GitCommandResult checkout(@NotNull GitRepository repository,
@NotNull String reference,
@Nullable String newBranch,
boolean force,
boolean detach,
@NotNull GitLineHandlerListener... listeners) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.CHECKOUT);
h.setSilent(false);
h.setStdoutSuppressed(false);
if (force) {
h.addParameters("--force");
}
if (newBranch == null) { // simply checkout
h.addParameters(detach ? reference + "^0" : reference); // we could use `--detach` here, but it is supported only since 1.7.5.
}
else { // checkout reference as new branch
h.addParameters("-b", newBranch, reference);
}
for (GitLineHandlerListener listener : listeners) {
h.addLineListener(listener);
}
return run(h);
}
示例3: branchDelete
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
/**
* {@code git branch -d <reference>} or {@code git branch -D <reference>}
*/
@NotNull
@Override
public GitCommandResult branchDelete(@NotNull GitRepository repository,
@NotNull String branchName,
boolean force,
@NotNull GitLineHandlerListener... listeners) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.BRANCH);
h.setSilent(false);
h.setStdoutSuppressed(false);
h.addParameters(force ? "-D" : "-d");
h.addParameters(branchName);
for (GitLineHandlerListener listener : listeners) {
h.addLineListener(listener);
}
return run(h);
}
示例4: handleResult
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
private void handleResult(GitCommandResult result,
Project project,
GitSimpleEventDetector mergeConflictDetector,
GitLocalChangesWouldBeOverwrittenDetector localChangesDetector,
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector,
GitRepository repository,
GitRevisionNumber currentRev,
Set<VirtualFile> affectedRoots,
Label beforeLabel) {
GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
VirtualFile root = repository.getRoot();
if (result.success() || mergeConflictDetector.hasHappened()) {
VfsUtil.markDirtyAndRefresh(false, true, false, root);
List<VcsException> exceptions = new ArrayList<VcsException>();
GitMergeUtil.showUpdates(this, project, exceptions, root, currentRev, beforeLabel, getActionName(), ActionInfo.UPDATE);
repositoryManager.updateRepository(root);
runFinalTasks(project, GitVcs.getInstance(project), affectedRoots, getActionName(), exceptions);
}
else if (localChangesDetector.wasMessageDetected()) {
LocalChangesWouldBeOverwrittenHelper.showErrorNotification(project, repository.getRoot(), getActionName(),
localChangesDetector.getRelativeFilePaths());
}
else if (untrackedFilesDetector.wasMessageDetected()) {
GitUntrackedFilesHelper.notifyUntrackedFilesOverwrittenBy(project, root, untrackedFilesDetector.getRelativeFilePaths(),
getActionName(), null);
}
else {
GitUIUtil.notifyError(project, "Git " + getActionName() + " Failed", result.getErrorOutputAsJoinedString(), true, null);
repositoryManager.updateRepository(root);
}
}
示例5: notifyConflictWarning
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
private void notifyConflictWarning(@NotNull GitRepository repository, @NotNull GitCommitWrapper commit,
@NotNull List<GitCommitWrapper> successfulCommits) {
NotificationListener resolveLinkListener = new ResolveLinkListener(myProject, myGit, myPlatformFacade, repository.getRoot(),
commit.getCommit().getId().toShortString(),
commit.getCommit().getAuthor().getName(),
commit.getSubject());
String description = commitDetails(commit)
+ "<br/>Unresolved conflicts remain in the working tree. <a href='resolve'>Resolve them.<a/>";
description += getSuccessfulCommitDetailsIfAny(successfulCommits);
VcsNotifier.getInstance(myProject).notifyImportantWarning("Cherry-picked with conflicts", description, resolveLinkListener);
}
示例6: execute
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
public void execute() {
saveAllDocuments();
AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
Map<GitRepository, GitCommandResult> results = ContainerUtil.newHashMap();
try {
for (Map.Entry<GitRepository, VcsFullCommitDetails> entry : myCommits.entrySet()) {
GitRepository repository = entry.getKey();
VirtualFile root = repository.getRoot();
String target = entry.getValue().getId().asString();
GitLocalChangesWouldBeOverwrittenDetector detector = new GitLocalChangesWouldBeOverwrittenDetector(root, RESET);
GitCommandResult result = myGit.reset(repository, myMode, target, detector);
if (!result.success() && detector.wasMessageDetected()) {
GitCommandResult smartResult = proposeSmartReset(detector, repository, target);
if (smartResult != null) {
result = smartResult;
}
}
results.put(repository, result);
repository.update();
VfsUtil.markDirtyAndRefresh(true, true, false, root);
VcsDirtyScopeManager.getInstance(myProject).dirDirtyRecursively(root);
}
}
finally {
DvcsUtil.workingTreeChangeFinished(myProject, token);
}
notifyResult(results);
}
示例7: collectUpdatedFiles
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
private void collectUpdatedFiles(@NotNull UpdatedFiles updatedFiles, @NotNull GitRepository repository,
@NotNull String preUpdatePosition) {
MergeChangeCollector collector = new MergeChangeCollector(myProject, repository.getRoot(), new GitRevisionNumber(preUpdatePosition));
ArrayList<VcsException> exceptions = new ArrayList<VcsException>();
collector.collect(updatedFiles, exceptions);
for (VcsException exception : exceptions) {
LOG.info(exception);
}
}
示例8: config
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@NotNull
@Override
public GitCommandResult config(@NotNull GitRepository repository, String... params) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.CONFIG);
h.addParameters(params);
return run(h);
}
示例9: stashSave
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@NotNull
@Override
public GitCommandResult stashSave(@NotNull GitRepository repository, @NotNull String message) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.STASH);
h.addParameters("save");
h.addParameters(message);
return run(h);
}
示例10: rebase
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@NotNull
@Override
public GitCommandResult rebase(@NotNull GitRepository repository,
@NotNull GitRebaseParams params,
@NotNull GitLineHandlerListener... listeners) {
GitLineHandler handler = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.REBASE);
handler.addParameters(params.getCommandLineArguments());
addListeners(handler, listeners);
return run(handler);
}
示例11: history
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@NotNull
@Override
public List<GitCommit> history(@NotNull GitRepository repository, @NotNull String range) {
try {
return GitHistoryUtils.history(repository.getProject(), repository.getRoot(), range);
}
catch (VcsException e) {
// this is critical, because we need to show the list of unmerged commits, and it shouldn't happen => inform user and developer
throw new GitExecutionException("Couldn't get [git log " + range + "] on repository [" + repository.getRoot() + "]", e);
}
}
示例12: getDefaultRoot
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@NotNull
private static VirtualFile getDefaultRoot(@NotNull Project project, @NotNull List<VirtualFile> roots, @Nullable VirtualFile[] vFiles) {
if (vFiles != null) {
for (VirtualFile file : vFiles) {
VirtualFile root = GitUtil.gitRootOrNull(file);
if (root != null) {
return root;
}
}
}
GitRepository currentRepository = GitBranchUtil.getCurrentRepository(project);
return currentRepository != null ? currentRepository.getRoot() : roots.get(0);
}
示例13: checkoutNewBranch
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
/**
* {@code git checkout -b <branchName>}
*/
@NotNull
@Override
public GitCommandResult checkoutNewBranch(@NotNull GitRepository repository, @NotNull String branchName,
@Nullable GitLineHandlerListener listener) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.CHECKOUT.readLockingCommand());
h.setSilent(false);
h.setStdoutSuppressed(false);
h.addParameters("-b");
h.addParameters(branchName);
if (listener != null) {
h.addLineListener(listener);
}
return run(h);
}
示例14: createNewTag
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@NotNull
@Override
public GitCommandResult createNewTag(@NotNull GitRepository repository, @NotNull String tagName,
@Nullable GitLineHandlerListener listener, @NotNull String reference) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.TAG);
h.setSilent(false);
h.addParameters(tagName);
if (!reference.isEmpty()) {
h.addParameters(reference);
}
if (listener != null) {
h.addLineListener(listener);
}
return run(h);
}
示例15: branchCreate
import git4idea.repo.GitRepository; //导入方法依赖的package包/类
/**
* Create branch without checking it out.
* {@code git branch <branchName>}
*/
@Override
@NotNull
public GitCommandResult branchCreate(@NotNull GitRepository repository, @NotNull String branchName) {
final GitLineHandler h = new GitLineHandler(repository.getProject(), repository.getRoot(), GitCommand.BRANCH);
h.setStdoutSuppressed(false);
h.addParameters(branchName);
return run(h);
}