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

Java GitCommand类代码示例

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

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



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

示例1: update

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
public void update(ProjectController controller) throws IllegalStateException {
	if (Utils.isNetworkOnline(context) == false)
		throw new IllegalStateException("Network is not available");
	
	this.controller = controller;
	File sourceRepo = new File(project.getSourcePath(context));
	
   	GitCommand<?> command;
   	
	if(sourceRepo.exists()) {
		command = git.pull();
	}
    else {
    	command = Git.cloneRepository().setURI(project.getUrl())
		.setDirectory(new File(project.getSourcePath(context)));
    }
	
	new GitTask(project.getName()).execute(command);
}
 
开发者ID:hdweiss,项目名称:codemap,代码行数:20,代码来源:JGitWrapper.java


示例2: configureCommand

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
/**
 * Configures the transport of the command to deal with things like SSH
 */
public static <C extends GitCommand> void configureCommand(TransportCommand<C, ?> command, CredentialsProvider credentialsProvider, final File sshPrivateKey, final File sshPublicKey) {
    if (sshPrivateKey != null) {
        final CredentialsProvider provider = credentialsProvider;
        command.setTransportConfigCallback(new TransportConfigCallback() {
            @Override
            public void configure(Transport transport) {
                if (transport instanceof SshTransport) {
                    SshTransport sshTransport = (SshTransport) transport;
                    SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() {
                        @Override
                        protected void configure(OpenSshConfig.Host host, Session session) {
                            session.setConfig("StrictHostKeyChecking", "no");
                            UserInfo userInfo = new CredentialsProviderUserInfo(session, provider);
                            session.setUserInfo(userInfo);
                        }

                        @Override
                        protected JSch createDefaultJSch(FS fs) throws JSchException {
                            JSch jsch = super.createDefaultJSch(fs);
                            jsch.removeAllIdentity();
                            String absolutePath = sshPrivateKey.getAbsolutePath();
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("Adding identity privateKey: " + sshPrivateKey + " publicKey: " + sshPublicKey);
                            }
                            if (sshPublicKey != null) {
                                jsch.addIdentity(absolutePath, sshPublicKey.getAbsolutePath(), null);
                            } else {
                                jsch.addIdentity(absolutePath);
                            }
                            return jsch;
                        }
                    };
                    sshTransport.setSshSessionFactory(sshSessionFactory);
                }
            }
        });
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-devops,代码行数:42,代码来源:GitHelpers.java


示例3: handle

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
@Override
public void handle(GitCommand<Git> command, final Caller caller, final String callerWorkspaceName, final Git result) {
    final VarScript plugin = caller.getService().getPlugin();
    Bukkit.getScheduler().runTask(plugin, new Runnable() {
        @Override
        public void run() {
            executor.onCommandGitCloneDone(caller, callerWorkspaceName, result, folderName);
        }
    });
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:11,代码来源:GitCloneHandler.java


示例4: doInBackground

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
@Override
protected Long doInBackground(GitCommand<?>... params) {
	GitCommand<?> command = params[0];
	
	Utils.announceSyncStart(context, projectName);

	if(command instanceof CloneCommand) {
		((CloneCommand)command).setProgressMonitor(monitor);
		status = "Cloning";
	} else if(command instanceof PullCommand) {
		((PullCommand)command).setProgressMonitor(monitor);
		status = "Pulling";
	} else {
		throw new IllegalArgumentException(
				"Coudln't attach progressMonitor to git command");
	}
	
	publishProgress(-1);
	
	try {
		command.call();
	} catch (Exception e) {
		status = e.getLocalizedMessage();
		publishProgress(100);
	}
	return 0L;
}
 
开发者ID:hdweiss,项目名称:codemap,代码行数:28,代码来源:JGitWrapper.java


示例5: setupCredentials

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
/**
 * Setups the Git credentials if specified and needed
 *
 * @param command The git command to configure
 */
@SuppressWarnings("rawtypes")
protected void setupCredentials(GitCommand<?> command) {
        GitSettings settings = lookupSettings();

        if (settings != null && command instanceof TransportCommand) {
                TransportCommand cmd = (TransportCommand) command;
                cmd.setCredentialsProvider(settings.getCredentials());
        }
}
 
开发者ID:rimerosolutions,项目名称:ant-git-tasks,代码行数:15,代码来源:AbstractGitTask.java


示例6: doInBackground

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
@Override
protected String doInBackground(GitCommand... commands) {
    Integer nbChanges = null;
    for (GitCommand command : commands) {
        Log.d("doInBackground", "Executing the command <" + command.toString() + ">");
        try {
            if (command instanceof StatusCommand) {
                // in case we have changes, we want to keep track of it
                org.eclipse.jgit.api.Status status = ((StatusCommand) command).call();
                nbChanges = status.getChanged().size() + status.getMissing().size();
            } else if (command instanceof CommitCommand) {
                // the previous status will eventually be used to avoid a commit
                if (nbChanges == null || nbChanges > 0)
                    command.call();
            }else if (command instanceof PushCommand) {
                for (final PushResult result : ((PushCommand) command).call()) {
                    // Code imported (modified) from Gerrit PushOp, license Apache v2
                    for (final RemoteRefUpdate rru : result.getRemoteUpdates()) {
                        switch (rru.getStatus()) {
                            case REJECTED_NONFASTFORWARD:
                                return activity.getString(R.string.git_push_nff_error);
                            case REJECTED_NODELETE:
                            case REJECTED_REMOTE_CHANGED:
                            case NON_EXISTING:
                            case NOT_ATTEMPTED:
                                return activity.getString(R.string.git_push_generic_error) + rru.getStatus().name();
                            case REJECTED_OTHER_REASON:
                                if ("non-fast-forward".equals(rru.getMessage())) {
                                    return activity.getString(R.string.git_push_other_error);
                                } else {
                                    return activity.getString(R.string.git_push_generic_error) + rru.getMessage();
                                }
                            default:
                                break;
                        }
                    }
                }
            } else {
                command.call();
            }

        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage() + "\nCaused by:\n" + e.getCause();
        }
    }
    return "";
}
 
开发者ID:zeapo,项目名称:Android-Password-Store,代码行数:49,代码来源:GitAsyncTask.java


示例7: setCommand

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
public void setCommand(GitCommand<T> command) {
    this.command = command;
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:4,代码来源:GitExecutor.java


示例8: handle

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
@Override
public void handle(GitCommand<FetchResult> command, Caller caller, String callerWorkspaceName, FetchResult result) {
    String message = "Fetch done. " + ChatColor.AQUA + result.getMessages();
    VarScript plugin = caller.getService().getPlugin();
    Bukkit.getScheduler().runTask(plugin, new MessageSender(caller, message, callerWorkspaceName,0));
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:7,代码来源:GitFetchHandler.java


示例9: handle

import org.eclipse.jgit.api.GitCommand; //导入依赖的package包/类
void handle(GitCommand<T> command, Caller caller, String callerWorkspaceName, T result); 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:2,代码来源:GitResultHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java WritableRpcEngine类代码示例发布时间:2022-05-22
下一篇:
Java Event类代码示例发布时间: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