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


Java SetupUpstreamMode类代码示例

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


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

示例1: checkout

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Does not do anything if already on target branch.
 */
public void checkout(String branch) throws Exception {
    if (!branch.equals(getBranch())) {
        createBranchIfNeeded(branch);
        git.checkout().setName(branch).setStartPoint("origin/" + branch)
            .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).call();
        // for some reason jgit needs this when branch is switched
        git.checkout().setName(branch).call();
    }
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:13,代码来源:VersionControlGit.java

示例2: createBranchIfNeeded

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Create a local branch for remote tracking if it doesn't exist already.
 */
protected void createBranchIfNeeded(String branch) throws Exception {
    fetch(); // in case the branch is not known locally
    if (localRepo.findRef(branch) == null) {
        git.branchCreate()
           .setName(branch)
           .setUpstreamMode(SetupUpstreamMode.TRACK)
           .setStartPoint("origin/" + branch)
           .call();
    }
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:14,代码来源:VersionControlGit.java

示例3: createLocalBranch

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
public LocalBranch createLocalBranch() throws GitAPIException {
	GitRepository gitRepository = getGitRepository();
	Repository repository = gitRepository.getRepository();
	Git git = gitRepository.getGit();
	CreateBranchCommand branchCreate = git.branchCreate();
	String name = getName();
	String shortenRefName = repository.shortenRemoteBranchName(name);
	branchCreate.setName(shortenRefName);
	branchCreate.setStartPoint(name);
	branchCreate.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
	Ref call = branchCreate.call();
	return new LocalBranch(gitRepository, call);

}
 
开发者ID:link-intersystems,项目名称:GitDirStat,代码行数:15,代码来源:RemoteBranch.java

示例4: iCheckoutBranch

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
@And("^I checkout branch \"([^\"]*)\"$")
public void iCheckoutBranch(String name) throws Throwable {
    git.checkout()
        .setCreateBranch(!name.equals("master"))
        .setName(name)
        .setUpstreamMode(SetupUpstreamMode.TRACK)
        .setStartPoint("origin/" + name)
        .call();
}
 
开发者ID:devhub-tud,项目名称:git-server,代码行数:10,代码来源:CloneStepDefinitions.java

示例5: testTrackMaster

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
public void testTrackMaster() throws IOException, JGitInternalException, GitAPIException {     
    git.branchCreate() 
       .setName("master")
       .setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM)
       .setStartPoint("origin/master")
       .setForce(true)
       .call();
}
 
开发者ID:hdweiss,项目名称:codemap,代码行数:9,代码来源:JGitTest.java

示例6: execute

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
protected void execute(ExecutionEvent event, final Repository repository, final String branchRef)
		throws ExecutionException {		
	//check if local branch exists
	final String branchName = branchRef.substring("refs/heads/".length()); //$NON-NLS-1$
	try {
		if (repository.getRef(branchRef) == null) {
			//create local branch
			String remoteBranchRef = "refs/remotes/origin/" + branchName; //$NON-NLS-1$
			Ref remoteRef = repository.getRef(remoteBranchRef);
			if (remoteRef == null) {
				throw new RuntimeException(MessageFormat.format(
						"Remote branch {0} doesn't exist",
						remoteBranchRef));
			}
			new Git(repository).branchCreate().
				setName(branchName).
				setStartPoint(remoteBranchRef).
				setUpstreamMode(SetupUpstreamMode.TRACK).
				call();
			repository.getConfig().setBoolean("branch", branchName, "rebase", true);  //$NON-NLS-1$//$NON-NLS-2$
		}
	} catch (Exception e1) {
       	RepositoryUtils.handleException(e1);
		return;
	}
	
	BranchOperationUI op = BranchOperationUI.checkout(repository, branchRef)
			.doneCallback( new DoneCallback() {
				
				public void done(CheckoutResult result) {

					if (result.getStatus() == CheckoutResult.Status.OK) {
						String newUpstreamRef = branchRef + ":refs/for/" + branchName; //$NON-NLS-1$
						repository.getConfig().setString("remote", "origin", "push",  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
								newUpstreamRef);
						//ensure in rebase mode
						repository.getConfig().setBoolean("branch", branchName, "rebase", true);  //$NON-NLS-1$//$NON-NLS-2$
						try {
							repository.getConfig().save();
						} catch (IOException e) {
				        	RepositoryUtils.handleException(e);
						}
					}
				}
			});
	op.start();
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:48,代码来源:SwitchToBranchCommand.java

示例7: trackBranch

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
private void trackBranch(Git git, CheckoutCommand checkout, String label) {
	checkout.setCreateBranch(true).setName(label)
			.setUpstreamMode(SetupUpstreamMode.TRACK)
			.setStartPoint("origin/" + label);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:6,代码来源:JGitEnvironmentRepository.java

示例8: oneValidFeatureBranch_1BuildIsTriggeredTheBranchGetsIntegratedBuildMarkedAsSUCCESS

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Git Plugin
 *
 * Test that show that a ready/feature_1 branch get integrated into master
 *
 * Pretested integration:
 *  - 'Integration branch' : master (default)
 *  - 'Repository name' : origin (default) 
 *  - 'Strategy' : Squash Commit
 *
 * GitSCM:
 *  - 'Name' : (empty)
 *
 * Workflow
 *  - Create a repository containing a 'ready' branch.
 *  - The build is triggered. 
 *
 * Results
 *  - We expect that the plugin triggers, and that the commits on ready branch
 *    is merged into our integration branch master and build result becomes SUCCESS.
 *
 * @throws Exception
 */
@Test
public void oneValidFeatureBranch_1BuildIsTriggeredTheBranchGetsIntegratedBuildMarkedAsSUCCESS() throws Exception {
    repository = TestUtilsFactory.createValidRepository("test-repo");

    File workDir = new File(TestUtilsFactory.WORKDIR,"test-repo");

    Git.cloneRepository().setURI("file:///" + repository.getDirectory().getAbsolutePath()).setDirectory(workDir)
            .setBare(false)
            .setCloneAllBranches(true)
            .setNoCheckout(false)
            .call().close();

    Git git = Git.open(workDir);

    System.out.println("Opening git repository in: " + workDir.getAbsolutePath());

    String readmeFromIntegration = FileUtils.readFileToString(new File(workDir,"readme"));

    git.checkout().setName(FEATURE_BRANCH_NAME).setUpstreamMode(SetupUpstreamMode.TRACK).setCreateBranch(true).call();
    final int COMMIT_COUNT_ON_FEATURE_BEFORE_EXECUTION = TestUtilsFactory.countCommits(git);
    git.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();

    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, repository);
    TestUtilsFactory.triggerProject(project);

    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();

    for (FreeStyleBuild b : builds) {
        String console = jenkinsRule.createWebClient().getPage(b, "console").asText();
        System.out.println(console);
    }

    String readmeFileContents = FileUtils.readFileToString(new File(workDir,"readme"));
    assertEquals(readmeFromIntegration, readmeFileContents);

    git.pull().call();

    final int COMMIT_COUNT_ON_MASTER_AFTER_EXECUTION = TestUtilsFactory.countCommits(git);

    git.close();

    //We assert that 2 commits from branch gets merged + 1 combined merge commit since we do --no-ff
    assertEquals(COMMIT_COUNT_ON_FEATURE_BEFORE_EXECUTION + 3, COMMIT_COUNT_ON_MASTER_AFTER_EXECUTION);
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:70,代码来源:AccumulatedCommitStrategyIT.java

示例9: commitMessagesWithDoubleQuotesSquashedLinux

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes in commit message can be
 * integrated using squashed strategy and a repository created on Linux. See
 * detailed description of test in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Test
public void commitMessagesWithDoubleQuotesSquashedLinux() throws Exception {
    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");

    // Squash commit ends on master, and there is one to start with:
    assertEquals(2, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not a squashed commit. Didn't find the text 'Squashed commit of the following:'", commitFullMessage.contains("Squashed commit of the following:"));
    assertTrue("The integration commit message, doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit 57807c99bea0fa0f929bd32973ff9651f7c0fb04"));
    assertFalse("The integration commit message, doesn't contain lines from the original commits as expected.", commitFullMessage.contains("This is a commit message with double quotes, eg. \"test quotes\"."));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Tue Mar 31 16:13:30 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Praqma Support <[email protected]>"));
    assertFalse("The last commit on integration branch contain 'accumulated' but is not an accumulated commit", commitFullMessage.contains("ccumulated"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:69,代码来源:CommitMessagesWithSpecialCharsIT.java

示例10: commitMessagesWithDoubleQuotesAccumulatedLinux

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes in commit message can be
 * integrated using accumulated strategy and a repository created on Linux.
 * See detailed description of test in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Test
public void commitMessagesWithDoubleQuotesAccumulatedLinux() throws Exception {
    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");
    // All commits end on master, and there is a merge commit
    assertEquals(4, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not an accumulated commit. Didn't find the text 'Accumulated commit'", commitFullMessage.contains("Accumulated commit of the following from branch 'origin/ready/JENKINS-27662_doublequotes':"));
    assertTrue("The integration commit message doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit 57807c99bea0fa0f929bd32973ff9651f7c0fb04"));
    assertTrue("The integration commit message doesn't contain lines from the original commits as expected.", commitFullMessage.contains("This is a commit message with double quotes, eg. 'test quotes'."));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Tue Mar 31 16:13:30 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Praqma Support <[email protected]>"));
    assertFalse("The last commit on integration branch contain 'squash' but is not a squash commit", commitFullMessage.contains("squash"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:68,代码来源:CommitMessagesWithSpecialCharsIT.java

示例11: commitMessagesWithDoubleQuotesSquashedWindows

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes in commit message can be
 * integrated using squashed strategy and a repository created on Windows.
 * See detailed description of test in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Test
public void commitMessagesWithDoubleQuotesSquashedWindows() throws Exception {

    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");

    // All commits end on master, and there is a merge commit
    assertEquals(2, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not a squashed commit. Didn't find the text 'Squashed commit of the following:'", commitFullMessage.contains("Squashed commit of the following:"));
    assertTrue("The integration commit message, doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit fa90cb266c4f737a09ad4a3308ec4fb5b898b9d6"));
    assertFalse("The integration commit message, doesn't contain lines from the original commits as expected.", commitFullMessage.contains("This is a commit message with double quotes (commit made on Windows), eg. \"test quotes\"."));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Tue Mar 31 16:08:22 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Praqma Support <[email protected]>"));
    assertFalse("The last commit on integration branch contain 'accumulated' but is not an accumulated commit", commitFullMessage.contains("ccumulated"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:70,代码来源:CommitMessagesWithSpecialCharsIT.java

示例12: commitMessagesWithDoubleQuotesAccumulatedWindows

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes in commit message can be
 * integrated using accumulated strategy and a repository created on
 * Windows. See detailed description of test in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Test
public void commitMessagesWithDoubleQuotesAccumulatedWindows() throws Exception {

    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");
    // All commits end on master, and there is a merge commit
    assertEquals(4, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not an accumulated commit. Didn't find the text 'Accumulated commit'", commitFullMessage.contains("Accumulated commit of the following from branch 'origin/ready/JENKINS-27662_doublequotes':"));
    assertTrue("The integration commit message doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit fa90cb266c4f737a09ad4a3308ec4fb5b898b9d6"));
    assertTrue("The integration commit message doesn't contain lines from the original commits as expected.", commitFullMessage.contains("This is a commit message with double quotes (commit made on Windows), eg. 'test quotes'."));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Tue Mar 31 16:08:22 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Praqma Support <[email protected]>"));
    assertFalse("The last commit on integration branch contain 'squash' but is not a squash commit", commitFullMessage.contains("squash"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:69,代码来源:CommitMessagesWithSpecialCharsIT.java

示例13: commitMessagesWithDoubleQuotesSingleQuotesMadeWindowsAccumulated

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes, created in a script using single
 * quotes can be integrated using accumulated strategy. Repository created
 * on Windows. See detailed description of test in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Test
public void commitMessagesWithDoubleQuotesSingleQuotesMadeWindowsAccumulated() throws Exception {

    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");

    // All commits end on master, and there is a merge commit
    assertEquals(4, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not an accumulated commit. Didn't find the text 'Accumulated commit'", commitFullMessage.contains("Accumulated commit of the following from branch 'origin/ready/JENKINS-27662_doublequotes':"));
    assertTrue("The integration commit message, doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit a094a8a6e8157b386b651d61997de25cd95af5eb"));
    assertTrue("The integration commit message, doesn't contain lines from the original commits as expected.", commitFullMessage.contains("This is a commit message with double quotes (commit made on Windows), and =, eg. 'test quotes'."));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Wed Jun 3 09:14:28 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Praqma Support <[email protected]>"));
    assertFalse("The last commit on integration branch contain 'squash' but is not a squash commit", commitFullMessage.contains("squash"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:70,代码来源:CommitMessagesWithSpecialCharsIT.java

示例14: commitMessagesWithDoubleQuotesSingleQuotesMadeWindowsSquashed

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes, created in a script using single
 * quotes can be integrated using squash strategy. Repository created on
 * Windows. See detailed description of test in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Test
public void commitMessagesWithDoubleQuotesSingleQuotesMadeWindowsSquashed() throws Exception {

    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");

    // All commits end on master, and there is a merge commit
    assertEquals(2, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not a squashed commit. Didn't find the text 'Squashed commit of the following:'", commitFullMessage.contains("Squashed commit of the following:"));
    assertTrue("The integration commit message, doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit a094a8a6e8157b386b651d61997de25cd95af5eb"));
    assertFalse("The integration commit message, doesn't contain lines from the original commits as expected.", commitFullMessage.contains("This is a commit message with double quotes (commit made on Windows), and =, eg. \"test quotes\"."));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Wed Jun 3 09:14:28 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Praqma Support <[email protected]>"));
    assertFalse("The last commit on integration branch contain 'accumulated' but is not an accumulated commit", commitFullMessage.contains("ccumulated"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:70,代码来源:CommitMessagesWithSpecialCharsIT.java

示例15: commitMessagesWithDoubleQuotesSingleQuotesMadeWindowsAccumulated_customerSuppliedRepo

import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; //导入依赖的package包/类
/**
 * Tests commit message with double quotes, created in a repository we have
 * been supplied with for testing by a customer. Test is using accumulated
 * strategy. Repository created on Windows. See detailed description of test
 * in class documentation.
 * <p>
 * Uses the StaticGitRepositoryTestBase and the setUp method there, so a
 * bareRepository and gitRepo is already available.
 *
 * @throws Exception
 */
@Ignore("Wait for Bue's input on changing double quotes to single quotes during FF merges.")
@Test
public void commitMessagesWithDoubleQuotesSingleQuotesMadeWindowsAccumulated_customerSuppliedRepo() throws Exception {

    /**
     * ********************************************************************
     * Run test with Jenkins job trying to integrate the feature branch
     * ********************************************************************
     */
    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, bareRepository);
    TestUtilsFactory.triggerProject(project);
    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();
    for (FreeStyleBuild b : builds) {
        assertTrue("Could not match console output for pretty printing", TestUtilsFactory.printAndReturnConsoleOfBuild(b, String.format("%s", b.getNumber()), jenkinsRule));
        Result result = b.getResult();
        assertNotNull("Build result was null.", result);
        assertTrue("Build was not a success - that is expected in this test", result.isBetterOrEqualTo(Result.SUCCESS));
    }

    /**
     * ********************************************************************
     * Verify integration in different aspect like commit message content
     * and actual commits
     * ********************************************************************
     */
    // Verify number of commits - first count on master after integration
    gitrepo.checkout().setName("master").call();
    gitrepo.checkout().setName("master").setUpstreamMode(SetupUpstreamMode.TRACK).call();
    gitrepo.pull().call();
    int commitsOnMasterAfterIntegration = TestUtilsFactory.countCommitsOnBranch(gitrepo, "master");

    // Two commits already exists, then add the accumulated commit:
    assertEquals(3, commitsOnMasterAfterIntegration);

    // This will "walk" over the log, but we only take the first entry
    // which will be the integration commit
    RevWalk walk = new RevWalk(gitrepo.getRepository());
    Iterable<RevCommit> log = gitrepo.log().call();
    Iterator<RevCommit> i = log.iterator();
    RevCommit commit = walk.parseCommit(i.next());

    String commitFullMessage = commit.getFullMessage();
    gitrepo.close();

    System.out.println("************************************************************************");
    System.out.println("* Integration commit message (between the ---):");
    System.out.println("---");
    System.out.println(commitFullMessage);
    System.out.println("---");
    System.out.println("************************************************************************");
    assertTrue("The integration commit message was not an accumulated commit. Didn't find the text 'Accumulated commit'", commitFullMessage.contains("Accumulated commit of the following from branch 'origin/ready/JENKINS-28640'"));
    assertTrue("The integration commit message, doesn't contain the SHA from the git log from the first of the included commits", commitFullMessage.contains("commit 036ac2b7c896313bb799eb88ce89d7156b19f9e3"));
    //assertTrue("The integration commit message, didn't contain expected date string from the git log from the first of the included commits", commitFullMessage.contains("Mon Jul 6 13:15:47 2015 +0200"));
    assertTrue("The integration commit message, didn't contain expected author string from the git log from the first of the included commits", commitFullMessage.contains("Author: Test Author <[email protected]>"));
    assertTrue("The integration commit message, doesn't contain lines from the original commits as expected.", commitFullMessage.contains(" AVRSV-6716 'program flash from RAM' option is disable under tools options in properties window and Memories tab in Device programming dialog"));
    assertFalse("The last commit on integration branch contain 'squash' but is not a squash commit", commitFullMessage.contains("squash"));
    System.out.println(String.format("***** phew... last verification (asserts) passed :-)"));
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:72,代码来源:CommitMessagesWithSpecialCharsIT.java


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