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

Java GitClient类代码示例

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

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



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

示例1: doFillCredentialsIdItems

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(
    @AncestorInPath Item context,
    @QueryParameter String remote,
    @QueryParameter String credentialsId) {
  if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
      || context != null && !context.hasPermission(Item.EXTENDED_READ)) {
    return new StandardListBoxModel().includeCurrentValue(credentialsId);
  }
  return new StandardListBoxModel()
      .includeEmptyValue()
      .includeMatchingAs(
          context instanceof Queue.Task
              ? Tasks.getAuthenticationOf((Queue.Task) context)
              : ACL.SYSTEM,
          context,
          StandardUsernameCredentials.class,
          URIRequirementBuilder.fromUri(remote).build(),
          GitClient.CREDENTIALS_MATCHER)
      .includeCurrentValue(credentialsId);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:21,代码来源:GerritSCMSource.java


示例2: decorateRevisionToBuild

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
@Override
public Revision decorateRevisionToBuild(GitSCM scm, Run<?, ?> build, GitClient git, TaskListener listener, Revision marked, Revision rev) throws IOException, InterruptedException, GitException {
    listener.getLogger().println("Merging " + targetBranch.getName() + " commit " + targetBranch.getRevision().getHash() + " into merge-request head commit " + rev.getSha1String());
    checkout(scm, build, git, listener, rev);
    try {
        git.setAuthor("Jenkins", /* could parse out of JenkinsLocationConfiguration.get().getAdminAddress() but seems overkill */"[email protected]");
        git.setCommitter("Jenkins", "[email protected]");
        MergeCommand cmd = git.merge().setRevisionToMerge(ObjectId.fromString(targetBranch.getRevision().getHash()));
        for (GitSCMExtension ext : scm.getExtensions()) {
            // By default we do a regular merge, allowing it to fast-forward.
            ext.decorateMergeCommand(scm, build, git, listener, cmd);
        }
        cmd.execute();
    } catch (GitException e) {
        // Try to revert merge conflict markers.
        checkout(scm, build, git, listener, rev);
        throw e;
    }
    build.addAction(new MergeRecord(targetBranch.getRefSpec().destinationRef(targetBranch.getName()), targetBranch.getRevision().getHash())); // does not seem to be used, but just in case
    ObjectId mergeRev = git.revParse(Constants.HEAD);
    listener.getLogger().println("Merge succeeded, producing " + mergeRev.name());
    return new Revision(mergeRev, rev.getBranches()); // note that this ensures Build.revision != Build.marked
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:24,代码来源:GitLabSCMMergeRequestHead.java


示例3: doFillCheckoutCredentialsIdItems

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
@Restricted(NoExternalUse.class)
public ListBoxModel doFillCheckoutCredentialsIdItems(@AncestorInPath SCMSourceOwner context, @QueryParameter String connectionName, @QueryParameter String checkoutCredentialsId) {
    if (context == null && !Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ||
            context != null && !context.hasPermission(Item.EXTENDED_READ)) {
        return new StandardListBoxModel().includeCurrentValue(checkoutCredentialsId);
    }

    StandardListBoxModel result = new StandardListBoxModel();
    result.add("- anonymous -", CHECKOUT_CREDENTIALS_ANONYMOUS);
    return result.includeMatchingAs(
            context instanceof Queue.Task
                    ? Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                    : ACL.SYSTEM,
            context,
            StandardUsernameCredentials.class,
            SettingsUtils.gitLabConnectionRequirements(connectionName),
            GitClient.CREDENTIALS_MATCHER
    );
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:20,代码来源:GitLabSCMSourceSettings.java


示例4: getCandidateRevisions

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/**
 * Get failing build revision if this is a deflake build, otherwise use the default build chooser
 */
@Override
public Collection<Revision> getCandidateRevisions(boolean isPollCall, String singleBranch,
    GitClient git,
    TaskListener listener, BuildData buildData,
    BuildChooserContext context)
    throws GitException, IOException, InterruptedException {

  AbstractBuild build = context.actOnBuild(new GetBuild());
  // Not sure why it cannot be inferred and we have to put cast here
  DeflakeCause cause = (DeflakeCause) build.getCause(DeflakeCause.class);

  if (cause != null) {
    BuildData gitBuildData = gitSCM.getBuildData(cause.getUpstreamRun(), true);
    Revision revision = gitBuildData.getLastBuiltRevision();
    if (revision != null) {
      return Collections.singletonList(revision);
    }
  }

  // If it is not a deflake run, then use the default git checkout strategy
  defaultBuildChooser.gitSCM = this.gitSCM;
  return defaultBuildChooser
      .getCandidateRevisions(isPollCall, singleBranch, git, listener, buildData, context);
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:28,代码来源:DeflakeGitBuildChooser.java


示例5: touchAndCommit

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public void touchAndCommit(File repo, String... names) throws Exception {
    GitClient client = gitClient(repo);
    for (String name : names) {
        FilePath toTouch = new FilePath(repo).child(name);
        if (!toTouch.exists()) {
            toTouch.getParent().mkdirs();
            toTouch.touch(0);
            client.add(name);
        } else {
            toTouch.write(toTouch.readToString() + "extra line\n", "UTF-8");
        }
    }
    client.setAuthor("dummy", "[email protected]");
    client.setCommitter("dummy", "[email protected]");
    client.commit("added " + Arrays.toString(names));
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:17,代码来源:GitRule.java


示例6: integrateAsGitPluginExt

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
@Override
public void integrateAsGitPluginExt(GitSCM scm, Run<?, ?> build, GitClient git, TaskListener listener, Revision marked, Revision rev, GitBridge gitbridge) throws NothingToDoException, IntegrationFailedException, IOException, InterruptedException {


    String expandedRepoName;
    try {
        expandedRepoName = gitbridge.getExpandedRepository(build.getEnvironment(listener));
    } catch (IOException | InterruptedException ex) {
        expandedRepoName = gitbridge.getRepoName();
    }

    if (!PretestedIntegrationGitUtils.isRelevant(rev, expandedRepoName)) {
        throw new NothingToDoException("No revision matches configuration in 'Integration repository'");
    }

    Branch triggerBranch = rev.getBranches().iterator().next();
    String expandedIntegrationBranch = gitbridge.getExpandedIntegrationBranch(build.getEnvironment(listener));
    doTheIntegration((Run) build, listener, gitbridge, triggerBranch.getSHA1(), git, expandedIntegrationBranch, triggerBranch);
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:20,代码来源:AccumulatedCommitStrategy.java


示例7: tryFastForward

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/**
 * Attempts to fast-forward merge the integration integrationBranch to the ready integrationBranch.
 * Only when the ready integrationBranch consists of a single commit.
 *
 * @param commitId The commit
 * @param commitCount The amount of commits
 * @param logger The logger for console logging
 * @param client The GitClient
 * @return true if the FF merge was a success, false if the integrationBranch isn't
 * suitable for a FF merge.
 * @throws IntegrationFailedException When commit counting fails
 * @throws NothingToDoException In case there is no commit to integrate/FF
 */
protected boolean tryFastForward(ObjectId commitId, PrintStream logger, GitClient client, int commitCount ) throws IntegrationFailedException, NothingToDoException {
    LOGGER.log(Level.INFO, GitMessages.LOG_PREFIX+ "Entering tryFastForward");

    if ( commitCount == 1) {
        logger.println(GitMessages.LOG_PREFIX+ "Try FF as there is only one commit");
    } else {
        logger.println(GitMessages.LOG_PREFIX+ "Skip FF as there are several commits");
        return false;
    }

    //FF merge the commit
    try {
        LOGGER.log(Level.INFO, GitMessages.LOG_PREFIX+ "Attempting merge with FF.");
        client.merge().setGitPluginFastForwardMode(MergeCommand.GitPluginFastForwardMode.FF_ONLY).setRevisionToMerge(commitId).execute();
        logger.println(GitMessages.LOG_PREFIX+ "FF merge successful.");
        LOGGER.log(Level.INFO, GitMessages.LOG_PREFIX+ " Exiting tryFastForward.");
        return true;
    } catch (GitException | InterruptedException ex) {
        logger.println(GitMessages.LOG_PREFIX+ "FF merge failed.");
        LOGGER.log(Level.INFO, GitMessages.LOG_PREFIX+ " Exiting tryFastForward.");
        return false;
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:37,代码来源:GitIntegrationStrategy.java


示例8: containsRemoteBranch

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/**
 * Checks whether or not we can find the given remote integrationBranch.
 * @param client the Git Client
 * @param branch the integrationBranch to look for
 * @return True if the integrationBranch was found, otherwise False.
 * @throws IntegrationFailedException when the Git call failed unexpectedly
 */
protected boolean containsRemoteBranch(GitClient client, Branch branch) throws IntegrationFailedException {
    try {
        LOGGER.fine("Resolving and getting Git client from workspace:");
        LOGGER.fine("Remote branches:");
        for (Branch remoteBranch : client.getRemoteBranches()) {
            LOGGER.fine(String.format("Found remote branch %s", remoteBranch.getName()));
            if (remoteBranch.getName().equals(branch.getName())) {
                return true;
            }
        }
    } catch (GitException | InterruptedException ex) {
        LOGGER.log(Level.SEVERE, "GitClient error", ex);
        throw new IntegrationFailedException("GitClient error, unspecified", ex);
    }
    return false;
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:24,代码来源:GitIntegrationStrategy.java


示例9: pushToIntegrationBranch

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/**
 * {@inheritDoc }
 */
@Override
public void pushToIntegrationBranch(AbstractBuild<?, ?> build, BuildListener listener) throws PushFailedException {
    try {
        EnvVars environment = build.getEnvironment(listener);
        String expandedRepo = getExpandedRepository(environment);
        String expandedBranch = getExpandedIntegrationBranch(environment);

        GitSCM gitSCM = findScm(build, listener);
        GitClient client = gitSCM.createClient(listener, build.getEnvironment(listener), build, build.getWorkspace());
        pushToBranch(listener, client, expandedBranch, expandedRepo);
    } catch (IOException | InterruptedException ex) {
        LOGGER.log(Level.SEVERE, "Failed to push changes to integration branch. Exception:", ex);
        listener.getLogger().println(GitMessages.LOG_PREFIX+ String.format("Failed to push changes to integration branch. Exception %s", ex));
        throw new PushFailedException(String.format("Failed to push changes to integration branch, message was:%n%s", ex));
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:20,代码来源:GitBridge.java


示例10: retrieveActions

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/** {@inheritDoc} */
@NonNull
@Override
protected List<Action> retrieveActions(
    @CheckForNull SCMSourceEvent event, @NonNull TaskListener listener)
    throws IOException, InterruptedException {
  return doRetrieve(
      new Retriever<List<Action>>() {
        @Override
        public List<Action> run(
            GitClient client, String remoteName, Changes.QueryRequest queryRequest)
            throws IOException, InterruptedException {
          Map<String, String> symrefs = client.getRemoteSymbolicReferences(getRemote(), null);
          if (symrefs.containsKey(Constants.HEAD)) {
            // Hurrah! The Server is Git 1.8.5 or newer and our client has symref reporting
            String target = symrefs.get(Constants.HEAD);
            if (target.startsWith(Constants.R_HEADS)) {
              // shorten standard names
              target = target.substring(Constants.R_HEADS.length());
            }
            List<Action> result = new ArrayList<>();
            if (StringUtils.isNotBlank(target)) {
              result.add(new GitRemoteHeadRefAction(getRemote(), target));
            }
            result.add(new GerritLogo());
            return result;
          }

          // Give up, there's no way to get the primary branch
          return new ArrayList<>();
        }
      },
      new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(getTraits()),
      listener,
      false);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:37,代码来源:AbstractGerritSCMSource.java


示例11: doCheckCredentialsId

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public FormValidation doCheckCredentialsId(
    @AncestorInPath Item context, @QueryParameter String remote, @QueryParameter String value) {
  if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
      || context != null && !context.hasPermission(Item.EXTENDED_READ)) {
    return FormValidation.ok();
  }

  value = Util.fixEmptyAndTrim(value);
  if (value == null) {
    return FormValidation.ok();
  }

  remote = Util.fixEmptyAndTrim(remote);
  if (remote == null)
  // not set, can't check
  {
    return FormValidation.ok();
  }

  for (ListBoxModel.Option o :
      CredentialsProvider.listCredentials(
          StandardUsernameCredentials.class,
          context,
          context instanceof Queue.Task
              ? Tasks.getAuthenticationOf((Queue.Task) context)
              : ACL.SYSTEM,
          URIRequirementBuilder.fromUri(remote).build(),
          GitClient.CREDENTIALS_MATCHER)) {
    if (StringUtils.equals(value, o.value)) {
      // TODO check if this type of credential is acceptable to the Git client or does it merit warning
      // NOTE: we would need to actually lookup the credential to do the check, which may require
      // fetching the actual credential instance from a remote credentials store. Perhaps this is
      // not required
      return FormValidation.ok();
    }
  }
  // no credentials available, can't check
  return FormValidation.warning("Cannot find any credentials with id " + value);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:40,代码来源:GerritSCMSource.java


示例12: checkout

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
private void checkout(GitSCM scm, Run<?, ?> build, GitClient git, TaskListener listener, Revision rev) throws InterruptedException, IOException, GitException {
    CheckoutCommand checkoutCommand = git.checkout().ref(rev.getSha1String());
    for (GitSCMExtension ext : scm.getExtensions()) {
        ext.decorateCheckoutCommand(scm, build, git, listener, checkoutCommand);
    }
    checkoutCommand.execute();
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:8,代码来源:GitLabSCMMergeRequestHead.java


示例13: getSSHCredentials

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public static SSHUserPrivateKey getSSHCredentials(BuildContext context, EnvVars envVars) {
    SCM scm = context.build.getProject().getScm();
    if (!(scm instanceof GitSCM)) {
        context.listener.getLogger().println("Error: SCM is not a GitSCM: " + scm.getType());
        return null;
    }

    GitSCM git = (GitSCM) scm;

    SSHUserPrivateKey theCreds = null;
    for (UserRemoteConfig uc : git.getUserRemoteConfigs()) {
        if (uc.getCredentialsId() != null) {
            String url = uc.getUrl();
            url = GitSCM.getParameterString(url, envVars);
            theCreds = CredentialsMatchers
                    .firstOrNull(
                            CredentialsProvider.lookupCredentials(SSHUserPrivateKey.class, context.build.getProject(),
                                    ACL.SYSTEM, URIRequirementBuilder.fromUri(url).build()),
                            CredentialsMatchers.allOf(CredentialsMatchers.withId(uc.getCredentialsId()),
                                    GitClient.CREDENTIALS_MATCHER));
            // just choose the first one. there should only be one...
            if (theCreds != null) {
                break;

            }
        }
    }

    return theCreds;
}
 
开发者ID:tanium,项目名称:pyjenkins,代码行数:31,代码来源:GitSSHKeyHelper.java


示例14: getCredentials

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
private StandardUsernameCredentials getCredentials(String credentialsID) {
	GitSCMSource source = new GitSCMSource("id", this.remote, credentialsID, "*", "", false);

	return CredentialsMatchers.firstOrNull(
			CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, source.getOwner(), ACL.SYSTEM,
					URIRequirementBuilder.fromUri(source.getRemoteName()).build()),
			CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsID), GitClient.CREDENTIALS_MATCHER));
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:9,代码来源:Git.java


示例15: testBasicMerge

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
@Test
public void testBasicMerge() throws Exception {
    FreeStyleProject p = j.createFreeStyleProject();
    List<UserRemoteConfig> remotes = new ArrayList<UserRemoteConfig>();
    remotes.add(new UserRemoteConfig(repo.getPath(), "origin", "master", null));
    List<BranchSpec> branches = new ArrayList<BranchSpec>();
    branches.add(new BranchSpec("master"));
    p.setScm(new GitSCM(remotes, branches, false, null, null, null, null));

    // Init repo with release and feature branch.
    GitClient client = g.gitClient(repo);
    client.init();
    g.touchAndCommit(repo, "init");
    client.checkout("HEAD", "r1336");
    g.touchAndCommit(repo, "r1336");
    client.checkout("HEAD", "c3");
    g.touchAndCommit(repo, "c3");

    // Custom builder that merges feature branch with release branch using AdvancedSCMManager.
    p.getBuildersList().add(new TestBuilder() {
        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            try {
                AdvancedSCMManager amm = SCMManagerFactory.getManager(build, launcher, listener);
                amm.update("r1336");
                amm.mergeWorkspaceWith("c3", null);
                amm.commit("merge c3", "test <[email protected]>");
                return true;
            } catch (Exception e) {
                e.printStackTrace(listener.getLogger());
                return false;
            }
        }
    });

    // Assert file is here (should be after successful merge)
    g.buildAndCheck(p, "c3");
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:39,代码来源:BasicGitTest.java


示例16: pushToIntegrationBranchGit

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public static void pushToIntegrationBranchGit(Run<?, ?> run, TaskListener listener, GitClient client, String expandedRepo, String expandedBranch) throws PushFailedException {
    try {
        pushToBranch(listener, client, expandedBranch, expandedRepo);
    } catch (IOException ex) {
        LOGGER.log(Level.SEVERE, "Failed to push changes to integration branch. Exception:", ex);
        listener.getLogger().println(GitMessages.LOG_PREFIX + String.format("Failed to push changes to integration branch. Exception %s", ex));
        throw new PushFailedException(String.format("Failed to push changes to integration branch, message was:%n%s", ex));
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:10,代码来源:GitBridge.java


示例17: pushToBranch

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public static void pushToBranch(TaskListener listener, GitClient client, String branchToPush, String expandedRepo) throws PushFailedException {
    try {
        LOGGER.log(Level.INFO, "Pushing changes to: " + branchToPush);
        listener.getLogger().println(GitMessages.LOG_PREFIX+ "Pushing changes to integration branch:");
        client.push(expandedRepo, "HEAD:refs/heads/" + branchToPush);
        LOGGER.log(Level.INFO, "Done pushing changes");
        listener.getLogger().println(GitMessages.LOG_PREFIX+ "Done pushing changes");
    } catch (InterruptedException ex) {
        LOGGER.log(Level.SEVERE, "Failed to push changes to: " + branchToPush + ".\nException:", ex);
        listener.getLogger().println(GitMessages.LOG_PREFIX+ String.format("Failed to push changes to: " + branchToPush + ".\nException: %s", ex));
        throw new PushFailedException(String.format("Failed to push changes to integration branch, message was:%n%s", ex));
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:14,代码来源:GitBridge.java


示例18: deleteBranch

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
public static void deleteBranch(Run<?, ?> run, TaskListener listener, GitClient client, String branchToBeDeleted, String expandedRepo) throws BranchDeletionFailedException, IOException {
    try {
        LOGGER.log(Level.INFO, "Deleting branch:");
        listener.getLogger().println(GitMessages.LOG_PREFIX+ "Deleting branch:");
        client.push(expandedRepo, ":refs/heads" + branchToBeDeleted.replace(expandedRepo, ""));
        listener.getLogger().println("push " + expandedRepo + " :" + branchToBeDeleted);
        LOGGER.log(Level.INFO, "Done deleting branch");
        listener.getLogger().println(GitMessages.LOG_PREFIX+ "Done deleting development branch");
    } catch (InterruptedException ex) {
        LOGGER.log(Level.SEVERE, "Failed to delete branch. Exception:", ex);
        listener.getLogger().println(GitMessages.LOG_PREFIX+ "Failed to delete development branch. Exception:" + ex.getMessage());
        throw new BranchDeletionFailedException(String.format("Failed to delete branch %s with the following error:%n%s", branchToBeDeleted, ex.getMessage()));
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:15,代码来源:GitBridge.java


示例19: ensureBranch

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/**
 * {@inheritDoc }
 */
@Override
public void ensureBranch(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener, String branch) throws EstablishingWorkspaceFailedException {
    try {
        EnvVars environment = build.getEnvironment(listener);
        String expandedBranch = getExpandedIntegrationBranch(environment);
        String expandedRepo = getExpandedRepository(environment);
        GitClient client = findScm(build, listener).createClient(listener, environment, build, build.getWorkspace());
        listener.getLogger().println(String.format(GitMessages.LOG_PREFIX+ "Checking out integration branch %s:", expandedBranch));
        client.checkout().branch(expandedBranch).ref(expandedRepo + "/" + expandedBranch).deleteBranchIfExist(true).execute();
    } catch (IOException | InterruptedException ex) {
        LOGGER.log(Level.SEVERE, "ensureBranch", ex);
        throw new EstablishingWorkspaceFailedException(ex);
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:18,代码来源:GitBridge.java


示例20: deleteIntegratedBranch

import org.jenkinsci.plugins.gitclient.GitClient; //导入依赖的package包/类
/**
 * {@inheritDoc }
 */
@Override
public void deleteIntegratedBranch(AbstractBuild<?, ?> build, TaskListener listener) throws BranchDeletionFailedException, NothingToDoException, UnsupportedConfigurationException, IOException {
    String triggeredBranch = build.getAction(PretestTriggerCommitAction.class).triggerBranch.getName();

    try {
        String expandedRepo = getExpandedRepository(build.getEnvironment(listener));
        GitClient client = findScm(build, listener).createClient(listener, build.getEnvironment(listener), build, build.getWorkspace());
        deleteBranch(build, listener, client, triggeredBranch, expandedRepo);

    } catch (InterruptedException | IOException ex) {
        throw new BranchDeletionFailedException(String.format("Failed to delete development branch %s with the following error:%n%s", triggeredBranch, ex.getMessage()));
    }
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:17,代码来源:GitBridge.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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