本文整理汇总了Java中org.eclipse.jgit.api.MergeCommand.FastForwardMode类的典型用法代码示例。如果您正苦于以下问题:Java FastForwardMode类的具体用法?Java FastForwardMode怎么用?Java FastForwardMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FastForwardMode类属于org.eclipse.jgit.api.MergeCommand包,在下文中一共展示了FastForwardMode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processSimpleMainline
import org.eclipse.jgit.api.MergeCommand.FastForwardMode; //导入依赖的package包/类
@Test
public void processSimpleMainline() throws Exception {
try (Git git = new Git(db)) {
commitWithFile(git, "first");
git.tag().setName(TAG_PREFIX + "-" + V_1).call();
git.branchCreate().setName("branch").setStartPoint("HEAD").call();
git.checkout().setName("branch").call();
commitWithFile(git, "branch_1");
final RevCommit branch = commitWithFile(git, "branch_2");
git.checkout().setName(MASTER).call();
git.merge().include(branch).setFastForward(FastForwardMode.NO_FF).setMessage("merge1").call();
git.tag().setName(TAG_PREFIX + "-" + V_2).call();
}
final List<TagWrapper> tags = processor.process(db);
assertThat(tags, hasSize(3));
assertTag(tags.get(0), NEXT_VERSION, emptyMap());
assertTag(tags.get(1), V_2, of("merge1", asList("branch_2", "branch_1")));
assertTag(tags.get(2), V_1, of("first", emptyList()));
}
开发者ID:jakubplichta,项目名称:git-changelog-maven-plugin,代码行数:21,代码来源:RepositoryProcessorTest.java
示例2: processMainlineWithLongLivingBranches
import org.eclipse.jgit.api.MergeCommand.FastForwardMode; //导入依赖的package包/类
@Test
public void processMainlineWithLongLivingBranches() throws Exception {
try (Git git = new Git(db)) {
commitWithFile(git, "first");
git.tag().setName(TAG_PREFIX + "-" + V_1).call();
git.branchCreate().setName("branch").setStartPoint("HEAD").call();
git.checkout().setName("branch").call();
commitWithFile(git, "branch_1");
RevCommit branch = commitWithFile(git, "branch_2");
git.checkout().setName(MASTER).call();
git.merge().include(branch).setFastForward(FastForwardMode.NO_FF).setMessage("merge1").call();
git.tag().setName(TAG_PREFIX + "-" + V_2).call();
git.checkout().setName("branch").call();
branch = commitWithFile(git, "branch_3");
git.checkout().setName(MASTER).call();
git.merge().include(branch).setFastForward(FastForwardMode.NO_FF).setMessage("merge2").call();
git.tag().setName(TAG_PREFIX + "-" + V_3).call();
}
final List<TagWrapper> tags = processor.process(db);
assertThat(tags, hasSize(4));
assertTag(tags.get(0), NEXT_VERSION, emptyMap());
assertTag(tags.get(1), V_3, of("merge2", singletonList("branch_3")));
assertTag(tags.get(2), V_2, of("merge1", asList("branch_2", "branch_1")));
assertTag(tags.get(3), V_1, of("first", emptyList()));
}
开发者ID:jakubplichta,项目名称:git-changelog-maven-plugin,代码行数:27,代码来源:RepositoryProcessorTest.java
示例3: mergePullRequestBranchWithTarget
import org.eclipse.jgit.api.MergeCommand.FastForwardMode; //导入依赖的package包/类
private List<Commit> mergePullRequestBranchWithTarget(Git git) throws Exception {
notifier.message("Merging source " + request.getNumber() + " into target " + request.getTarget().getBranch());
MergeResult result = git.merge()
.setFastForward(FastForwardMode.FF_ONLY)
.include(git.getRepository().getRef(String.valueOf(request.getNumber())))
.call();
if(!result.getMergeStatus().isSuccessful()) {
throw new RuntimeException("Merge not successfull, status " + result.getMergeStatus());
} else {
notifier.message("Merged " + request + " : " + result.getMergeStatus());
}
return GitUtil.toCommitList(result.getMergedCommits());
}
开发者ID:aslakknutsen,项目名称:github-merge,代码行数:15,代码来源:GitService.java
示例4: remoteToLocal_merge
import org.eclipse.jgit.api.MergeCommand.FastForwardMode; //导入依赖的package包/类
@Test
public void remoteToLocal_merge() throws Exception {
pushMirrorSettings(null, null);
// Mirror an empty git repository, which will;
// - Create /mirror_state.json
// - Remove the sample files created by createProject().
mirroringService.mirror().join();
// Create a text file, modify it in two branches ('master' and 'fork') and merge 'fork' into 'master'.
addToGitIndex("alphabets.txt", // 'c' and 'x' are missing.
"a\nb\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\ny\nz\n");
git.commit().setMessage("Add alphabets.txt").call();
//// Create a new branch 'fork' and add the missing 'x'.
git.checkout().setCreateBranch(true).setName("fork").call();
addToGitIndex("alphabets.txt", // Add the missing 'x'.
"a\nb\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n");
final RevCommit commit1 = git.commit().setMessage("Add missing 'x'").call();
//// Check out 'master' and add the missing 'c'.
git.checkout().setName("master").call();
addToGitIndex("alphabets.txt", // Add the missing 'c'.
"a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\ny\nz\n");
final RevCommit commit2 = git.commit().setMessage("Add missing 'c'").call();
//// Merge 'fork' into 'master' to create a merge commit.
final MergeResult mergeResult = git.merge()
.include(commit1.getId())
.setFastForward(FastForwardMode.NO_FF)
.setMessage("Merge 'fork'").call();
//// Make sure the merge commit has been added.
assertThat(mergeResult.getMergeStatus()).isEqualTo(MergeStatus.MERGED);
final RevCommit lastCommit = git.log().all().call().iterator().next();
assertThat(lastCommit.getParentCount()).isEqualTo(2);
assertThat(lastCommit.getParents()).containsExactlyInAnyOrder(commit1, commit2);
// Run the mirror and ensure alphabets.txt contains all alphabets.
mirroringService.mirror().join();
final Entry<JsonNode> expectedMirrorState = expectedMirrorState("/");
final Entry<String> expectedAlphabets = Entry.ofText(
"/alphabets.txt",
"a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n");
assertThat(client.getFiles(projName, REPO_MAIN, Revision.HEAD, "/**").join().values())
.containsExactlyInAnyOrder(expectedMirrorState, expectedAlphabets);
}
开发者ID:line,项目名称:centraldogma,代码行数:50,代码来源:GitMirrorTest.java
示例5: setUp
import org.eclipse.jgit.api.MergeCommand.FastForwardMode; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
/*- The following graph will be created.
o tag 2.5, 2.5_annotated, 2.5_annotated_twice
|\
| o tag 2.0.1
| o tag 2.0
o | tag 1.3
|/
o c3
| o tag 1.0.1
|/
o tag 1.0
o c2
o c1
*/
// TODO(dborowitz): Use try/finally when this doesn't double-close the repo.
@SuppressWarnings("resource")
Git git = new Git(db);
revWalk = new RevWalk(db);
// Version 1.0
commit_initial = git.commit().setMessage("c1").call();
git.commit().setMessage("c2").call();
RevCommit commit_v1_0 = git.commit().setMessage("version 1.0").call();
git.tag().setName(TAG_1_0).setObjectId(commit_v1_0).call();
RevCommit c3 = git.commit().setMessage("c3").call();
// Version 1.01
createAndCheckoutBranch(commit_v1_0, BRANCH_1_0);
RevCommit commit_v1_0_1 = git.commit().setMessage("verREFS_HEADS_RELsion 1.0.1").call();
git.tag().setName(TAG_1_0_1).setObjectId(commit_v1_0_1).call();
// Version 1.3
createAndCheckoutBranch(c3, BRANCH_1_3);
commit_v1_3 = git.commit().setMessage("version 1.3").call();
git.tag().setName(TAG_1_3).setObjectId(commit_v1_3).call();
// Version 2.0
createAndCheckoutBranch(c3, BRANCH_2_0);
RevCommit commit_v2_0 = git.commit().setMessage("version 2.0").call();
git.tag().setName(TAG_2_0).setObjectId(commit_v2_0).call();
RevCommit commit_v2_0_1 = git.commit().setMessage("version 2.0.1").call();
git.tag().setName(TAG_2_0_1).setObjectId(commit_v2_0_1).call();
// Version 2.5
createAndCheckoutBranch(commit_v1_3, BRANCH_2_5);
git.merge()
.include(commit_v2_0_1)
.setCommit(false)
.setFastForward(FastForwardMode.NO_FF)
.call();
commit_v2_5 = git.commit().setMessage("version 2.5").call();
git.tag().setName(TAG_2_5).setObjectId(commit_v2_5).setAnnotated(false).call();
Ref ref_tag_2_5_annotated =
git.tag().setName(TAG_2_5_ANNOTATED).setObjectId(commit_v2_5).setAnnotated(true).call();
RevTag tag_2_5_annotated = revWalk.parseTag(ref_tag_2_5_annotated.getObjectId());
git.tag()
.setName(TAG_2_5_ANNOTATED_TWICE)
.setObjectId(tag_2_5_annotated)
.setAnnotated(true)
.call();
}
开发者ID:gerrit-review,项目名称:gerrit,代码行数:67,代码来源:IncludedInResolverTest.java
注:本文中的org.eclipse.jgit.api.MergeCommand.FastForwardMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论