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


Java RevWalk.setRevFilter方法代码示例

本文整理汇总了Java中org.eclipse.jgit.revwalk.RevWalk.setRevFilter方法的典型用法代码示例。如果您正苦于以下问题:Java RevWalk.setRevFilter方法的具体用法?Java RevWalk.setRevFilter怎么用?Java RevWalk.setRevFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.revwalk.RevWalk的用法示例。


在下文中一共展示了RevWalk.setRevFilter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:GetCommonAncestorCommand.java

示例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;
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:30,代码来源:GitAccess.java

示例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;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:24,代码来源:GitHelper.java

示例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;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:19,代码来源:GitHelper.java

示例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;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:24,代码来源:GitServiceImpl.java

示例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;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:19,代码来源:GitServiceImpl.java

示例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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:GitRevisionInfo.java

示例8: applyCriteria

import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
private void applyCriteria (RevWalk walk, SearchCriteria criteria,
        final RevFlag partOfResultFlag, DiffConfig diffConfig) {
    File[] files = criteria.getFiles();
    if (files.length > 0) {
        Collection<PathFilter> pathFilters = Utils.getPathFilters(getRepository().getWorkTree(), files);
        if (!pathFilters.isEmpty()) {
            if (criteria.isFollow() && pathFilters.size() == 1) {
                walk.setTreeFilter(FollowFilter.create(pathFilters.iterator().next().getPath(), diffConfig));
            } else {
                walk.setTreeFilter(AndTreeFilter.create(TreeFilter.ANY_DIFF, PathFilterGroup.create(pathFilters)));
            }
        }
    }
    RevFilter filter;
    if (criteria.isIncludeMerges()) {
        filter = RevFilter.ALL;
    } else {
        filter = RevFilter.NO_MERGES;
    }
    filter = AndRevFilter.create(filter, new CancelRevFilter(monitor));
    filter = AndRevFilter.create(filter, new RevFilter() {

        @Override
        public boolean include (RevWalk walker, RevCommit cmit) {
            return cmit.has(partOfResultFlag);
        }

        @Override
        public RevFilter clone () {
            return this;
        }

        @Override
        public boolean requiresCommitBody () {
            return false;
        }            
        
    });
    
    String username = criteria.getUsername();
    if (username != null && !(username = username.trim()).isEmpty()) {
        filter = AndRevFilter.create(filter, OrRevFilter.create(CommitterRevFilter.create(username), AuthorRevFilter.create(username)));
    }
    String message = criteria.getMessage();
    if (message != null && !(message = message.trim()).isEmpty()) {
        filter = AndRevFilter.create(filter, MessageRevFilter.create(message));
    }
    Date from  = criteria.getFrom();
    Date to  = criteria.getTo();
    if (from != null && to != null) {
        filter = AndRevFilter.create(filter, CommitTimeRevFilter.between(from, to));
    } else if (from != null) {
        filter = AndRevFilter.create(filter, CommitTimeRevFilter.after(from));
    } else if (to != null) {
        filter = AndRevFilter.create(filter, CommitTimeRevFilter.before(to));
    }
    // this must be at the end, limit filter must apply as the last
    if (criteria.getLimit() != -1) {
        filter = AndRevFilter.create(filter, MaxCountRevFilter.create(criteria.getLimit()));
    }
    walk.setRevFilter(filter);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:63,代码来源:LogCommand.java

示例9: countCommits

import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
public int countCommits(Repository repository, String branch) throws Exception {
	RevWalk walk = new RevWalk(repository);
	try {
		Ref ref = repository.findRef(REMOTE_REFS_PREFIX + branch);
		ObjectId objectId = ref.getObjectId();
		RevCommit start = walk.parseCommit(objectId);
		walk.setRevFilter(RevFilter.NO_MERGES);
		return RevWalkUtils.count(walk, start, null);
	} finally {
		walk.dispose();
	}
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:13,代码来源:GitHelper.java

示例10: countCommits

import org.eclipse.jgit.revwalk.RevWalk; //导入方法依赖的package包/类
@Override
public int countCommits(Repository repository, String branch) throws Exception {
	RevWalk walk = new RevWalk(repository);
	try {
		Ref ref = repository.findRef(REMOTE_REFS_PREFIX + branch);
		ObjectId objectId = ref.getObjectId();
		RevCommit start = walk.parseCommit(objectId);
		walk.setRevFilter(RevFilter.NO_MERGES);
		return RevWalkUtils.count(walk, start, null);
	} finally {
		walk.dispose();
	}
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:14,代码来源:GitServiceImpl.java


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