本文整理汇总了Java中git4idea.commands.Git类的典型用法代码示例。如果您正苦于以下问题:Java Git类的具体用法?Java Git怎么用?Java Git使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Git类属于git4idea.commands包,在下文中一共展示了Git类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: GithubCreatePullRequestWorker
import git4idea.commands.Git; //导入依赖的package包/类
private GithubCreatePullRequestWorker(@NotNull Project project,
@NotNull Git git,
@NotNull GitRepository gitRepository,
@NotNull GithubAuthDataHolder authHolder,
@NotNull GithubFullPath path,
@NotNull String remoteName,
@NotNull String remoteUrl,
@NotNull String currentBranch) {
myProject = project;
myGit = git;
myGitRepository = gitRepository;
myAuthHolder = authHolder;
myPath = path;
myRemoteName = remoteName;
myRemoteUrl = remoteUrl;
myCurrentBranch = currentBranch;
myForks = new ArrayList<ForkInfo>();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GithubCreatePullRequestWorker.java
示例2: testExistingFreshGit
import git4idea.commands.Git; //导入依赖的package包/类
public void testExistingFreshGit() throws Throwable {
registerDefaultShareDialogHandler();
registerDefaultUntrackedFilesDialogHandler();
createProjectFiles();
Git git = ServiceManager.getService(Git.class);
git.init(myProject, myProjectRoot);
GithubShareAction.shareProjectOnGithub(myProject, myProjectRoot);
checkNotification(NotificationType.INFORMATION, "Successfully shared project on GitHub", null);
initGitChecks();
checkGitExists();
checkGithubExists();
checkRemoteConfigured();
checkLastCommitPushed();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GithubShareProjectTest.java
示例3: GitCrlfProblemsDetector
import git4idea.commands.Git; //导入依赖的package包/类
private GitCrlfProblemsDetector(@NotNull Project project, @NotNull GitPlatformFacade platformFacade, @NotNull Git git,
@NotNull Collection<VirtualFile> files) {
myProject = project;
myPlatformFacade = platformFacade;
myGit = git;
Map<VirtualFile, List<VirtualFile>> filesByRoots = sortFilesByRoots(files);
boolean shouldWarn = false;
Collection<VirtualFile> rootsWithIncorrectAutoCrlf = getRootsWithIncorrectAutoCrlf(filesByRoots);
if (!rootsWithIncorrectAutoCrlf.isEmpty()) {
Map<VirtualFile, Collection<VirtualFile>> crlfFilesByRoots = findFilesWithCrlf(filesByRoots, rootsWithIncorrectAutoCrlf);
if (!crlfFilesByRoots.isEmpty()) {
Map<VirtualFile, Collection<VirtualFile>> crlfFilesWithoutAttrsByRoots = findFilesWithoutAttrs(crlfFilesByRoots);
shouldWarn = !crlfFilesWithoutAttrsByRoots.isEmpty();
}
}
myShouldWarn = shouldWarn;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitCrlfProblemsDetector.java
示例4: getUpdater
import git4idea.commands.Git; //导入依赖的package包/类
/**
* Returns proper updater based on the update policy (merge or rebase) selected by user or stored in his .git/config
* @return {@link GitMergeUpdater} or {@link GitRebaseUpdater}.
*/
@NotNull
public static GitUpdater getUpdater(@NotNull Project project,
@NotNull Git git,
@NotNull Map<VirtualFile, GitBranchPair> trackedBranches,
@NotNull VirtualFile root,
@NotNull ProgressIndicator progressIndicator,
@NotNull UpdatedFiles updatedFiles,
@NotNull UpdateMethod updateMethod) {
if (updateMethod == UpdateMethod.BRANCH_DEFAULT) {
updateMethod = resolveUpdateMethod(project, root);
}
return updateMethod == UpdateMethod.REBASE ?
new GitRebaseUpdater(project, git, root, trackedBranches, progressIndicator, updatedFiles):
new GitMergeUpdater(project, git, root, trackedBranches, progressIndicator, updatedFiles);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitUpdater.java
示例5: fetchNatively
import git4idea.commands.Git; //导入依赖的package包/类
@NotNull
private static GitFetchResult fetchNatively(@NotNull GitRepository repository, @NotNull GitRemote remote, @Nullable String branch) {
Git git = ServiceManager.getService(Git.class);
String[] additionalParams = branch != null ?
new String[]{ getFetchSpecForBranch(branch, remote.getName()) } :
ArrayUtil.EMPTY_STRING_ARRAY;
GitFetchPruneDetector pruneDetector = new GitFetchPruneDetector();
GitCommandResult result = git.fetch(repository, remote,
Collections.<GitLineHandlerListener>singletonList(pruneDetector), additionalParams);
GitFetchResult fetchResult;
if (result.success()) {
fetchResult = GitFetchResult.success();
}
else if (result.cancelled()) {
fetchResult = GitFetchResult.cancel();
}
else {
fetchResult = GitFetchResult.error(result.getErrorOutputAsJoinedString());
}
fetchResult.addPruneInfo(pruneDetector.getPrunedRefs());
return fetchResult;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GitFetcher.java
示例6: GitPreservingProcess
import git4idea.commands.Git; //导入依赖的package包/类
public GitPreservingProcess(@NotNull Project project,
@NotNull GitPlatformFacade facade,
@NotNull Git git,
@NotNull Collection<VirtualFile> rootsToSave,
@NotNull String operationTitle,
@NotNull String destinationName,
@NotNull GitVcsSettings.UpdateChangesPolicy saveMethod,
@NotNull ProgressIndicator indicator,
@NotNull Runnable operation) {
myProject = project;
myFacade = facade;
myGit = git;
myRootsToSave = rootsToSave;
myOperationTitle = operationTitle;
myDestinationName = destinationName;
myProgressIndicator = indicator;
myOperation = operation;
myStashMessage = String.format("Uncommitted changes before %s at %s", StringUtil.capitalize(myOperationTitle),
DateFormatUtil.formatDateTime(Clock.getTime()));
mySaver = configureSaver(saveMethod);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitPreservingProcess.java
示例7: GitRebaseProcess
import git4idea.commands.Git; //导入依赖的package包/类
private GitRebaseProcess(@NotNull Project project,
@NotNull List<GitRepository> allRepositories,
@NotNull GitRebaseParams params,
@NotNull GitChangesSaver saver,
@NotNull MultiMap<GitRepository, GitRebaseUtils.CommitInfo> skippedCommits,
@NotNull Map<GitRepository, SuccessType> successfulRepositories) {
myProject = project;
myAllRepositories = allRepositories;
myParams = params;
mySaver = saver;
mySuccessfulRepositories = successfulRepositories;
myGit = ServiceManager.getService(Git.class);
myChangeListManager = ChangeListManager.getInstance(myProject);
myNotifier = VcsNotifier.getInstance(myProject);
myFacade = ServiceManager.getService(GitPlatformFacade.class);
myInitialHeadPositions = readInitialHeadPositions(myAllRepositories);
mySkippedCommits = skippedCommits;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitRebaseProcess.java
示例8: GitBranchOperation
import git4idea.commands.Git; //导入依赖的package包/类
protected GitBranchOperation(@NotNull Project project, @NotNull GitPlatformFacade facade, @NotNull Git git,
@NotNull GitBranchUiHandler uiHandler, @NotNull Collection<GitRepository> repositories) {
myProject = project;
myFacade = facade;
myGit = git;
myUiHandler = uiHandler;
myRepositories = repositories;
myCurrentHeads = ContainerUtil.map2Map(repositories, new Function<GitRepository, Pair<GitRepository, String>>() {
@Override
public Pair<GitRepository, String> fun(GitRepository repository) {
GitLocalBranch currentBranch = repository.getCurrentBranch();
return Pair.create(repository, currentBranch == null ? repository.getCurrentRevision() : currentBranch.getName());
}
});
mySuccessfulRepositories = new ArrayList<GitRepository>();
myRemainingRepositories = new ArrayList<GitRepository>(myRepositories);
mySettings = myFacade.getSettings(myProject);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitBranchOperation.java
示例9: pushChangesToRemoteRepo
import git4idea.commands.Git; //导入依赖的package包/类
private boolean pushChangesToRemoteRepo(final Project project, final GitRepository localRepository,
final com.microsoft.alm.sourcecontrol.webapi.model.GitRepository remoteRepository,
final ServerContext localContext, final ProgressIndicator indicator) {
localRepository.update();
final String remoteGitUrl = UrlHelper.getCmdLineFriendlyUrl(remoteRepository.getRemoteUrl());
//push all branches in local Git repo to remote
indicator.setText(TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_GIT_PUSH));
final Git git = ServiceManager.getService(Git.class);
final GitCommandResult result = git.push(localRepository, REMOTE_ORIGIN, remoteGitUrl, "*", true);
if (!result.success()) {
logger.error("pushChangesToRemoteRepo: push to remote: {} failed with error: {}, outuput: {}",
remoteGitUrl, result.getErrorOutputAsJoinedString(), result.getOutputAsJoinedString());
notifyImportError(project,
result.getErrorOutputAsJoinedString(),
ACTION_NAME, localContext);
return false;
}
return true;
}
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:22,代码来源:ImportPageModelImpl.java
示例10: testExistingFreshGit
import git4idea.commands.Git; //导入依赖的package包/类
public void testExistingFreshGit() throws Throwable {
registerDefaultShareDialogHandler();
registerDefaultUntrackedFilesDialogHandler();
createProjectFiles();
Git git = ServiceManager.getService(Git.class);
git.init(myProject, myProjectRoot);
GithubShareAction.shareProjectOnGithub(myProject, myProjectRoot);
checkNotification(NotificationType.INFORMATION, "Successfully shared project on GitHub", null);
checkGitExists();
checkGithubExists();
checkRemoteConfigured();
checkLastCommitPushed();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GithubShareProjectTest.java
示例11: getUpdater
import git4idea.commands.Git; //导入依赖的package包/类
/**
* Returns proper updater based on the update policy (merge or rebase) selected by user or stored in his .git/config
* @return {@link GitMergeUpdater} or {@link GitRebaseUpdater}.
*/
@NotNull
public static GitUpdater getUpdater(@NotNull Project project, @NotNull Git git, @NotNull Map<VirtualFile, GitBranchPair> trackedBranches,
@NotNull VirtualFile root, @NotNull ProgressIndicator progressIndicator,
@NotNull UpdatedFiles updatedFiles) {
final GitVcsSettings settings = GitVcsSettings.getInstance(project);
if (settings == null) {
return getDefaultUpdaterForBranch(project, git, root, trackedBranches, progressIndicator, updatedFiles);
}
switch (settings.getUpdateType()) {
case REBASE:
return new GitRebaseUpdater(project, git, root, trackedBranches, progressIndicator, updatedFiles);
case MERGE:
return new GitMergeUpdater(project, git, root, trackedBranches, progressIndicator, updatedFiles);
case BRANCH_DEFAULT:
// use default for the branch
return getDefaultUpdaterForBranch(project, git, root, trackedBranches, progressIndicator, updatedFiles);
}
return getDefaultUpdaterForBranch(project, git, root, trackedBranches, progressIndicator, updatedFiles);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GitUpdater.java
示例12: testReturnsExpectedUrl
import git4idea.commands.Git; //导入依赖的package包/类
@Test
@UseDataProvider("urlProvider")
public void testReturnsExpectedUrl(String url, String expected) throws RemoteException
{
GitRemote gitRemote = mock(GitRemote.class);
Git git = mock(Git.class);
when(gitRemote.getFirstUrl()).thenReturn(url);
Remote remote = new Remote(git, gitRemote);
assertEquals(expected, remote.url().toString());
}
开发者ID:ben-gibson,项目名称:GitLink,代码行数:14,代码来源:RemoteTest.java
示例13: testDoesThrowWhenRemoteUrlNotFound
import git4idea.commands.Git; //导入依赖的package包/类
@Test(expected = RemoteException.class)
public void testDoesThrowWhenRemoteUrlNotFound() throws RemoteException
{
GitRemote gitRemote = mock(GitRemote.class);
Git git = mock(Git.class);
when(gitRemote.getFirstUrl()).thenReturn(null);
Remote remote = new Remote(git, gitRemote);
remote.url();
}
开发者ID:ben-gibson,项目名称:GitLink,代码行数:13,代码来源:RemoteTest.java
示例14: GitResetOperation
import git4idea.commands.Git; //导入依赖的package包/类
public GitResetOperation(@NotNull Project project, @NotNull Map<GitRepository, VcsFullCommitDetails> targetCommits,
@NotNull GitResetMode mode, @NotNull ProgressIndicator indicator) {
myProject = project;
myCommits = targetCommits;
myMode = mode;
myIndicator = indicator;
myGit = ServiceManager.getService(Git.class);
myNotifier = VcsNotifier.getInstance(project);
myFacade = ServiceManager.getService(GitPlatformFacade.class);
myUiHandler = new GitBranchUiHandlerImpl(myProject, myFacade, myGit, indicator);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GitResetOperation.java
示例15: GitDefineRemoteDialog
import git4idea.commands.Git; //导入依赖的package包/类
GitDefineRemoteDialog(@NotNull GitRepository repository, @NotNull Git git) {
super(repository.getProject());
myRepository = repository;
myGit = git;
myRemoteName = new JTextField(GitRemote.ORIGIN_NAME, 20);
myRemoteUrl = new JTextField(20);
setTitle("Define Remote");
init();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GitDefineRemoteDialog.java
示例16: GitPushOperation
import git4idea.commands.Git; //导入依赖的package包/类
public GitPushOperation(@NotNull Project project,
@NotNull GitPushSupport pushSupport,
@NotNull Map<GitRepository, PushSpec<GitPushSource, GitPushTarget>> pushSpecs,
@Nullable GitPushTagMode tagMode,
boolean force) {
myProject = project;
myPushSupport = pushSupport;
myPushSpecs = pushSpecs;
myTagMode = tagMode;
myForce = force;
myGit = ServiceManager.getService(Git.class);
myProgressIndicator = ObjectUtils.notNull(ProgressManager.getInstance().getProgressIndicator(), new EmptyProgressIndicator());
mySettings = GitVcsSettings.getInstance(myProject);
myPlatformFacade = ServiceManager.getService(project, GitPlatformFacade.class);
myRepositoryManager = ServiceManager.getService(myProject, GitRepositoryManager.class);
Map<GitRepository, GitRevisionNumber> currentHeads = ContainerUtil.newHashMap();
for (GitRepository repository : pushSpecs.keySet()) {
repository.update();
String head = repository.getCurrentRevision();
if (head == null) {
LOG.error("This repository has no commits");
}
else {
currentHeads.put(repository, new GitRevisionNumber(head));
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GitPushOperation.java
示例17: GitVcs
import git4idea.commands.Git; //导入依赖的package包/类
public GitVcs(@NotNull Project project, @NotNull Git git,
@NotNull final ProjectLevelVcsManager gitVcsManager,
@NotNull final GitAnnotationProvider gitAnnotationProvider,
@NotNull final GitDiffProvider gitDiffProvider,
@NotNull final GitHistoryProvider gitHistoryProvider,
@NotNull final GitRollbackEnvironment gitRollbackEnvironment,
@NotNull final GitVcsApplicationSettings gitSettings,
@NotNull final GitVcsSettings gitProjectSettings,
@NotNull GitSharedSettings sharedSettings) {
super(project, NAME);
myGit = git;
myVcsManager = gitVcsManager;
myAppSettings = gitSettings;
myChangeProvider = project.isDefault() ? null : ServiceManager.getService(project, GitChangeProvider.class);
myCheckinEnvironment = project.isDefault() ? null : ServiceManager.getService(project, GitCheckinEnvironment.class);
myAnnotationProvider = gitAnnotationProvider;
myDiffProvider = gitDiffProvider;
myHistoryProvider = gitHistoryProvider;
myRollbackEnvironment = gitRollbackEnvironment;
myRevSelector = new GitRevisionSelector();
myConfigurable = new GitVcsConfigurable(myProject, gitProjectSettings, sharedSettings);
myUpdateEnvironment = new GitUpdateEnvironment(myProject, gitProjectSettings);
myCommittedChangeListProvider = new GitCommittedChangeListProvider(myProject);
myOutgoingChangesProvider = new GitOutgoingChangesProvider(myProject);
myTreeDiffProvider = new GitTreeDiffProvider(myProject);
myCommitAndPushExecutor = myCheckinEnvironment != null ? new GitCommitAndPushExecutor(myCheckinEnvironment) : null;
myExecutableValidator = new GitExecutableValidator(myProject);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GitVcs.java
示例18: GitChangeProvider
import git4idea.commands.Git; //导入依赖的package包/类
public GitChangeProvider(@NotNull Project project, @NotNull Git git, ChangeListManager changeListManager,
@NotNull FileDocumentManager fileDocumentManager, @NotNull ProjectLevelVcsManager vcsManager) {
myProject = project;
myGit = git;
myChangeListManager = changeListManager;
myFileDocumentManager = fileDocumentManager;
myVcsManager = vcsManager;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitChangeProvider.java
示例19: collect
import git4idea.commands.Git; //导入依赖的package包/类
/**
* Collects the changes from git command line and returns the instance of GitNewChangesCollector from which these changes can be retrieved.
* This may be lengthy.
*/
@NotNull
static GitNewChangesCollector collect(@NotNull Project project, @NotNull Git git, @NotNull ChangeListManager changeListManager,
@NotNull ProjectLevelVcsManager vcsManager, @NotNull AbstractVcs vcs,
@NotNull VcsDirtyScope dirtyScope, @NotNull VirtualFile vcsRoot) throws VcsException {
return new GitNewChangesCollector(project, git, changeListManager, vcsManager, vcs, dirtyScope, vcsRoot);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GitNewChangesCollector.java
示例20: GitNewChangesCollector
import git4idea.commands.Git; //导入依赖的package包/类
private GitNewChangesCollector(@NotNull Project project, @NotNull Git git, @NotNull ChangeListManager changeListManager,
@NotNull ProjectLevelVcsManager vcsManager, @NotNull AbstractVcs vcs,
@NotNull VcsDirtyScope dirtyScope, @NotNull VirtualFile vcsRoot) throws VcsException
{
super(project, changeListManager, vcsManager, vcs, dirtyScope, vcsRoot);
myGit = git;
myRepository = GitUtil.getRepositoryManager(myProject).getRepositoryForRoot(vcsRoot);
Collection<FilePath> dirtyPaths = dirtyPaths(true);
if (!dirtyPaths.isEmpty()) {
collectChanges(dirtyPaths);
collectUnversionedFiles();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GitNewChangesCollector.java
注:本文中的git4idea.commands.Git类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论