List of usage examples for org.eclipse.jgit.lib Repository getFullBranch
@Nullable public String getFullBranch() throws IOException
From source file:org.eclipse.egit.gitflow.op.HotfixFinishOperationTest.java
License:Open Source License
@Test public void testHotfixFinishSingleCommit() throws Exception { testRepository.createInitialCommit("testHotfixFinish\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); new HotfixStartOperation(gfRepo, MY_HOTFIX).execute(null); RevCommit branchCommit = testRepository.createInitialCommit("testHotfixFinish\n\nbranch commit\n"); new HotfixFinishOperation(gfRepo).execute(null); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); String branchName = gfRepo.getConfig().getHotfixBranchName(MY_HOTFIX); // tag created? RevCommit taggedCommit = gfRepo.findCommitForTag(MY_HOTFIX); assertEquals(formatMergeCommitMessage(branchName), taggedCommit.getShortMessage()); // branch removed? assertEquals(findBranch(repository, branchName), null); RevCommit developHead = gfRepo.findHead(DEVELOP); assertNotEquals(branchCommit, developHead); RevCommit masterHead = gfRepo.findHead(MY_MASTER); assertEquals(formatMergeCommitMessage(branchName), masterHead.getShortMessage()); }
From source file:org.eclipse.egit.gitflow.op.HotfixFinishOperationTest.java
License:Open Source License
@Test public void testMergeToDevelopFail() throws Exception { testRepository.createInitialCommit("testMergeToDevelopFail\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); // setup something we can modify later File file = testRepository.createFile(project.getProject(), "folder1/file1.txt"); new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null); testRepository.appendContentAndCommit(project.getProject(), file, "Hello Release", "Release Commit"); testRepository.appendContentAndCommit(project.getProject(), file, "Hello Merge Commit", "Release Commit 2"); new ReleaseFinishOperation(gfRepo).execute(null); new HotfixStartOperation(gfRepo, MY_HOTFIX).execute(null); // modify on first branch testRepository.appendContentAndCommit(project.getProject(), file, "Hello Hotfix", "Hotfix Commit"); new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); // modify on second branch RevCommit developCommit = testRepository.appendContentAndCommit(project.getProject(), file, "Hello Develop", "Develop Commit"); String branchName = gfRepo.getConfig().getHotfixBranchName(MY_HOTFIX); new BranchOperation(repository, branchName).execute(null); HotfixFinishOperation hotfixFinishOperation = new HotfixFinishOperation(gfRepo); hotfixFinishOperation.execute(null); // TODO: check if the reference implementation cleans up in this case assertNotNull(gfRepo.findCommitForTag(MY_HOTFIX)); // branch not removed? assertNotEquals(findBranch(repository, branchName), null); // not merged on develop => conflict RevCommit developHead = gfRepo.findHead(DEVELOP); assertEquals(developCommit, developHead); assertEquals(MergeResult.MergeStatus.CONFLICTING, hotfixFinishOperation.getMergeResult().getMergeStatus()); // merged on master RevCommit masterHead = gfRepo.findHead(MY_MASTER); assertEquals(String.format("Merge branch '%s'", branchName), masterHead.getFullMessage()); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); }
From source file:org.eclipse.egit.gitflow.op.HotfixStartOperationTest.java
License:Open Source License
@Test public void testHotfixStart() throws Exception { testRepository.createInitialCommit("testHotfixStart\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); HotfixStartOperation hotfixStartOperation = new HotfixStartOperation(gfRepo, MY_HOTFIX); assertNull(hotfixStartOperation.getSchedulingRule()); hotfixStartOperation.execute(null);// w w w. j a v a 2s. co m assertEquals(gfRepo.getConfig().getFullHotfixBranchName(MY_HOTFIX), repository.getFullBranch()); }
From source file:org.eclipse.egit.gitflow.op.InitOperationTest.java
License:Open Source License
@Test public void testInit() throws Exception { testRepository.createInitialCommit("testInitOperation\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); InitOperation initOperation = new InitOperation(repository); initOperation.execute(null);//from www.j a va 2s . c om GitFlowRepository gfRepo = new GitFlowRepository(repository); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); assertPrefixEquals(FEATURE_PREFIX, FEATURE_KEY, repository); assertPrefixEquals(RELEASE_PREFIX, RELEASE_KEY, repository); assertPrefixEquals(HOTFIX_PREFIX, HOTFIX_KEY, repository); // TODO this below is unstable and I have no idea why. // Sometimes it receives null instead of the empty string // assertPrefixEquals(VERSION_TAG, VERSION_TAG_KEY, repository); assertBranchEquals(DEVELOP, DEVELOP_KEY, repository); assertBranchEquals(MASTER, MASTER_KEY, repository); }
From source file:org.eclipse.egit.gitflow.op.InitOperationTest.java
License:Open Source License
@Test public void testInitEmptyRepository() throws Exception { Repository repository = testRepository.getRepository(); InitOperation initOperation = new InitOperation(repository); initOperation.execute(null);//from w ww. j a va 2s . c om GitFlowRepository gfRepo = new GitFlowRepository(repository); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); }
From source file:org.eclipse.egit.gitflow.op.ReleaseFinishOperationTest.java
License:Open Source License
@Test public void testReleaseFinishSingleCommit() throws Exception { testRepository.createInitialCommit("testReleaseFinish\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); InitParameters initParameters = new InitParameters(); initParameters.setDevelop(DEVELOP);/*from ww w . ja v a 2 s.com*/ initParameters.setMaster(MASTER); initParameters.setFeature(FEATURE_PREFIX); initParameters.setRelease(RELEASE_PREFIX); initParameters.setHotfix(HOTFIX_PREFIX); initParameters.setVersionTag(MY_VERSION_TAG); new InitOperation(repository, initParameters).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null); RevCommit branchCommit = testRepository.createInitialCommit("testReleaseFinish\n\nbranch commit\n"); new ReleaseFinishOperation(gfRepo).execute(null); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); String branchName = gfRepo.getConfig().getReleaseBranchName(MY_RELEASE); // tag created? RevCommit taggedCommit = gfRepo.findCommitForTag(MY_VERSION_TAG + MY_RELEASE); assertEquals(formatMergeCommitMessage(branchName), taggedCommit.getShortMessage()); // branch removed? assertEquals(findBranch(repository, branchName), null); RevCommit developHead = gfRepo.findHead(DEVELOP); assertNotEquals(branchCommit, developHead); RevCommit masterHead = gfRepo.findHead(MY_MASTER); assertEquals(formatMergeCommitMessage(branchName), masterHead.getShortMessage()); }
From source file:org.eclipse.egit.gitflow.op.ReleaseFinishOperationTest.java
License:Open Source License
@Test public void testReleaseFinish() throws Exception { testRepository.createInitialCommit("testReleaseFinish\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); InitParameters initParameters = new InitParameters(); initParameters.setDevelop(DEVELOP);/*from ww w .j a v a 2 s .c o m*/ initParameters.setMaster(MASTER); initParameters.setFeature(FEATURE_PREFIX); initParameters.setRelease(RELEASE_PREFIX); initParameters.setHotfix(HOTFIX_PREFIX); initParameters.setVersionTag(MY_VERSION_TAG); new InitOperation(repository, initParameters).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null); addFileAndCommit("foo.txt", "testReleaseFinish\n\nbranch commit 1\n"); addFileAndCommit("bar.txt", "testReleaseFinish\n\nbranch commit 2\n"); ReleaseFinishOperation releaseFinishOperation = new ReleaseFinishOperation(gfRepo); releaseFinishOperation.execute(null); assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch()); String branchName = gfRepo.getConfig().getReleaseBranchName(MY_RELEASE); // tag created? RevCommit taggedCommit = gfRepo.findCommitForTag(MY_VERSION_TAG + MY_RELEASE); assertEquals(formatMergeCommitMessage(branchName), taggedCommit.getFullMessage()); // branch removed? assertEquals(findBranch(repository, branchName), null); }
From source file:org.eclipse.egit.gitflow.op.ReleaseStartOperationTest.java
License:Open Source License
@Test public void testReleaseBranchCreated() throws Exception { testRepository.createInitialCommit("testReleaseBranchCreated\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(gfRepo, MY_RELEASE); releaseStartOperation.execute(null); assertNull(releaseStartOperation.getSchedulingRule()); assertEquals(gfRepo.getConfig().getFullReleaseBranchName(MY_RELEASE), repository.getFullBranch()); }
From source file:org.eclipse.egit.gitflow.op.ReleaseStartOperationTest.java
License:Open Source License
@Test public void testReleaseBranchCreatedFromHeadCommit() throws Exception { RevCommit initialCommit = testRepository .createInitialCommit("testReleaseBranchCreatedFromHeadCommit\n\nfirst commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(gfRepo, initialCommit.getName(), MY_RELEASE);//from w w w . j a v a2 s. c o m releaseStartOperation.execute(null); assertNull(releaseStartOperation.getSchedulingRule()); assertEquals(gfRepo.getConfig().getFullReleaseBranchName(MY_RELEASE), repository.getFullBranch()); }
From source file:org.eclipse.egit.gitflow.op.ReleaseStartOperationTest.java
License:Open Source License
@Test public void testReleaseBranchCreatedFromCommit() throws Exception { RevCommit initialCommit = testRepository .createInitialCommit("testReleaseBranchCreatedFromCommit\n\nfirst commit\n"); testRepository.createInitialCommit("testReleaseBranchCreatedFromCommit\n\nsecond commit\n"); Repository repository = testRepository.getRepository(); new InitOperation(repository).execute(null); GitFlowRepository gfRepo = new GitFlowRepository(repository); ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(gfRepo, initialCommit.getName(), MY_RELEASE);//from www . j ava2 s . c om releaseStartOperation.execute(null); assertNotNull(releaseStartOperation.getSchedulingRule()); assertEquals(gfRepo.getConfig().getFullReleaseBranchName(MY_RELEASE), repository.getFullBranch()); assertEquals(initialCommit, gfRepo.findHead()); }