本文整理汇总了Java中org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter类的典型用法代码示例。如果您正苦于以下问题:Java CommitTimeRevFilter类的具体用法?Java CommitTimeRevFilter怎么用?Java CommitTimeRevFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommitTimeRevFilter类属于org.eclipse.jgit.revwalk.filter包,在下文中一共展示了CommitTimeRevFilter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyCriteria
import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter; //导入依赖的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
示例2: getRevLog
import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter; //导入依赖的package包/类
/**
* Returns a list of commits since the minimum date starting from the specified object id.
*
* @param repository
* @param objectId
* if unspecified, HEAD is assumed.
* @param minimumDate
* @return list of commits
*/
public static List<RevCommit> getRevLog(Repository repository, String objectId, Date minimumDate) {
List<RevCommit> list = new ArrayList<RevCommit>();
if (!hasCommits(repository)) {
return list;
}
try {
// resolve branch
ObjectId branchObject;
if (StringUtils.isEmpty(objectId)) {
branchObject = getDefaultBranch(repository);
} else {
branchObject = repository.resolve(objectId);
}
RevWalk rw = new RevWalk(repository);
rw.markStart(rw.parseCommit(branchObject));
rw.setRevFilter(CommitTimeRevFilter.after(minimumDate));
Iterable<RevCommit> revlog = rw;
for (RevCommit rev : revlog) {
list.add(rev);
}
rw.close();
rw.dispose();
} catch (Throwable t) {
error(t, repository, "{0} failed to get {1} revlog for minimum date {2}", objectId, minimumDate);
}
return list;
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:38,代码来源:JGitUtils.java
示例3: getRevLog
import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter; //导入依赖的package包/类
/**
* Returns a list of commits since the minimum date starting from the
* specified object id.
*
* @param repository
* @param objectId
* if unspecified, HEAD is assumed.
* @param minimumDate
* @return list of commits
*/
public static List<RevCommit> getRevLog(Repository repository, String objectId, Date minimumDate) {
List<RevCommit> list = new ArrayList<RevCommit>();
if (!hasCommits(repository)) {
return list;
}
try {
// resolve branch
ObjectId branchObject;
if (StringUtils.isEmpty(objectId)) {
branchObject = getDefaultBranch(repository);
} else {
branchObject = repository.resolve(objectId);
}
RevWalk rw = new RevWalk(repository);
rw.markStart(rw.parseCommit(branchObject));
rw.setRevFilter(CommitTimeRevFilter.after(minimumDate));
Iterable<RevCommit> revlog = rw;
for (RevCommit rev : revlog) {
list.add(rev);
}
rw.dispose();
} catch (Throwable t) {
error(t, repository, "{0} failed to get {1} revlog for minimum date {2}", objectId,
minimumDate);
}
return list;
}
开发者ID:warpfork,项目名称:gitblit,代码行数:39,代码来源:JGitUtils.java
注:本文中的org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论