本文整理汇总了Java中org.eclipse.jgit.revwalk.RevWalk.markStart方法的典型用法代码示例。如果您正苦于以下问题:Java RevWalk.markStart方法的具体用法?Java RevWalk.markStart怎么用?Java RevWalk.markStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.revwalk.RevWalk
的用法示例。
在下文中一共展示了RevWalk.markStart方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSingleBaseCommit
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
private GitRevisionInfo getSingleBaseCommit (RevWalk walk, List<RevCommit> commits) throws IOException {
while (commits.size() > 1) {
walk.reset();
for (RevCommit c : commits) {
walk.markStart(walk.parseCommit(c));
}
walk.setRevFilter(RevFilter.MERGE_BASE);
commits.clear();
for (RevCommit commit = walk.next(); commit != null; commit = walk.next()) {
commits.add(commit);
}
}
if (commits.isEmpty()) {
return null;
} else {
return getClassFactory().createRevisionInfo(commits.get(0), getRepository());
}
}
示例2: getCommonAncestor
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
/**
* Finds the common base for the given commit "a" and the given commit "b"
*
* @param walk
* - used to browse through commits
* @param a
* - commit "a"
* @param b
* - commit "b"
* @return the bese commit
* @throws IncorrectObjectTypeException
* @throws IOException
*/
private RevCommit getCommonAncestor(RevWalk walk, RevCommit a, RevCommit b)
throws IOException {
walk.reset();
walk.setRevFilter(RevFilter.MERGE_BASE);
walk.markStart(a);
walk.markStart(b);
final RevCommit base = walk.next();
if (base == null)
return null;
final RevCommit base2 = walk.next();
if (base2 != null) {
throw new NoMergeBaseException(MergeBaseFailureReason.MULTIPLE_MERGE_BASES_NOT_SUPPORTED,
MessageFormat.format(JGitText.get().multipleMergeBasesFor, a.name(), b.name(), base.name(), base2.name()));
}
return base;
}
示例3: fetchAndCreateNewRevsWalk
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
public RevWalk fetchAndCreateNewRevsWalk(Repository repository, String branch) throws Exception {
List<ObjectId> currentRemoteRefs = new ArrayList<ObjectId>();
for (Ref ref : repository.getAllRefs().values()) {
String refName = ref.getName();
if (refName.startsWith(REMOTE_REFS_PREFIX)) {
currentRemoteRefs.add(ref.getObjectId());
}
}
List<TrackingRefUpdate> newRemoteRefs = this.fetch(repository);
RevWalk walk = new RevWalk(repository);
for (TrackingRefUpdate newRef : newRemoteRefs) {
if (branch == null || newRef.getLocalName().endsWith("/" + branch)) {
walk.markStart(walk.parseCommit(newRef.getNewObjectId()));
}
}
for (ObjectId oldRef : currentRemoteRefs) {
walk.markUninteresting(walk.parseCommit(oldRef));
}
walk.setRevFilter(commitsFilter);
return walk;
}
示例4: createAllRevsWalk
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
public RevWalk createAllRevsWalk(Repository repository, String branch) throws Exception {
List<ObjectId> currentRemoteRefs = new ArrayList<ObjectId>();
for (Ref ref : repository.getAllRefs().values()) {
String refName = ref.getName();
if (refName.startsWith(REMOTE_REFS_PREFIX)) {
if (branch == null || refName.endsWith("/" + branch)) {
currentRemoteRefs.add(ref.getObjectId());
}
}
}
RevWalk walk = new RevWalk(repository);
for (ObjectId newRef : currentRemoteRefs) {
walk.markStart(walk.parseCommit(newRef));
}
walk.setRevFilter(commitsFilter);
return walk;
}
示例5: fetchAndCreateNewRevsWalk
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
public RevWalk fetchAndCreateNewRevsWalk(Repository repository, String branch) throws Exception {
List<ObjectId> currentRemoteRefs = new ArrayList<ObjectId>();
for (Ref ref : repository.getAllRefs().values()) {
String refName = ref.getName();
if (refName.startsWith(REMOTE_REFS_PREFIX)) {
currentRemoteRefs.add(ref.getObjectId());
}
}
List<TrackingRefUpdate> newRemoteRefs = this.fetch(repository);
RevWalk walk = new RevWalk(repository);
for (TrackingRefUpdate newRef : newRemoteRefs) {
if (branch == null || newRef.getLocalName().endsWith("/" + branch)) {
walk.markStart(walk.parseCommit(newRef.getNewObjectId()));
}
}
for (ObjectId oldRef : currentRemoteRefs) {
walk.markUninteresting(walk.parseCommit(oldRef));
}
walk.setRevFilter(commitsFilter);
return walk;
}
示例6: createAllRevsWalk
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
public RevWalk createAllRevsWalk(Repository repository, String branch) throws Exception {
List<ObjectId> currentRemoteRefs = new ArrayList<ObjectId>();
for (Ref ref : repository.getAllRefs().values()) {
String refName = ref.getName();
if (refName.startsWith(REMOTE_REFS_PREFIX)) {
if (branch == null || refName.endsWith("/" + branch)) {
currentRemoteRefs.add(ref.getObjectId());
}
}
}
RevWalk walk = new RevWalk(repository);
for (ObjectId newRef : currentRemoteRefs) {
walk.markStart(walk.parseCommit(newRef));
}
walk.setRevFilter(commitsFilter);
return walk;
}
示例7: listFiles
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
private void listFiles() throws GitException {
RevWalk revWalk = new RevWalk(repository);
TreeWalk walk = new TreeWalk(repository);
try {
List<GitFileInfo> result;
walk.reset();
walk.setRecursive(true);
RevCommit parentCommit = null;
if (revCommit.getParentCount() > 0) {
for (RevCommit commit : revCommit.getParents()) {
revWalk.markStart(revWalk.lookupCommit(commit));
}
revWalk.setRevFilter(RevFilter.MERGE_BASE);
Iterator<RevCommit> it = revWalk.iterator();
if (it.hasNext()) {
parentCommit = it.next();
}
if (parentCommit != null) {
walk.addTree(parentCommit.getTree().getId());
}
}
walk.addTree(revCommit.getTree().getId());
walk.setFilter(AndTreeFilter.create(TreeFilter.ANY_DIFF, PathFilter.ANY_DIFF));
if (parentCommit != null) {
result = Utils.getDiffEntries(repository, walk, GitClassFactoryImpl.getInstance());
} else {
result = new ArrayList<GitFileInfo>();
while (walk.next()) {
result.add(new GitFileInfo(new File(repository.getWorkTree(), walk.getPathString()), walk.getPathString(), GitFileInfo.Status.ADDED, null, null));
}
}
this.modifiedFiles = result.toArray(new GitFileInfo[result.size()]);
} catch (IOException ex) {
throw new GitException(ex);
} finally {
revWalk.release();
walk.release();
}
}
示例8: markBranchFlags
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
private void markBranchFlags (Map<String, GitBranch> allBranches, RevWalk walk, Map<RevFlag, List<GitBranch>> branchFlags) {
int i = 1;
Set<String> usedFlags = new HashSet<>();
Repository repository = getRepository();
for (Map.Entry<String, GitBranch> e : allBranches.entrySet()) {
if (e.getKey() != GitBranch.NO_BRANCH) {
String flagId = e.getValue().getId();
if (usedFlags.contains(flagId)) {
for (Map.Entry<RevFlag, List<GitBranch>> e2 : branchFlags.entrySet()) {
if (e2.getKey().toString().equals(flagId)) {
e2.getValue().add(e.getValue());
}
}
} else {
usedFlags.add(flagId);
if (i < 25) {
i = i + 1;
RevFlag flag = walk.newFlag(flagId);
List<GitBranch> branches = new ArrayList<>(allBranches.size());
branches.add(e.getValue());
branchFlags.put(flag, branches);
try {
RevCommit branchHeadCommit = walk.parseCommit(repository.resolve(e.getValue().getId()));
branchHeadCommit.add(flag);
branchHeadCommit.carry(flag);
walk.markStart(branchHeadCommit);
} catch (IOException ex) {
LOG.log(Level.INFO, null, ex);
}
} else {
LOG.log(Level.WARNING, "Out of available flags for branches: {0}", allBranches.size()); //NOI18N
break;
}
}
}
}
walk.carry(branchFlags.keySet());
}
示例9: getSrcCommit
import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
public RevCommit getSrcCommit() {
try {
RevWalk revWalk = new RevWalk(git.getRepository());
AnyObjectId headId = git.getRepository().resolve(Constants.HEAD);
RevCommit root = revWalk.parseCommit(headId);
revWalk.sort(RevSort.REVERSE);
revWalk.markStart(root);
return revWalk.next();
} catch (Exception e) {
throw new RuntimeException(e);
}
}