本文整理汇总了Java中org.eclipse.jgit.revplot.PlotLane类的典型用法代码示例。如果您正苦于以下问题:Java PlotLane类的具体用法?Java PlotLane怎么用?Java PlotLane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlotLane类属于org.eclipse.jgit.revplot包,在下文中一共展示了PlotLane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNewCommits
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
/**
* Helper method that returns commits between the given old branch heads and new branch heads
*
* @param oldBranches previous locations of branch heads
* @param newBranches current locations of branch heads
* @return a list of all commits found between oldBranches and newBranches
* @throws GitAPIException
* @throws IOException
*/
private List<CommitHelper> getNewCommits(Map<String, BranchHelper> oldBranches, List<? extends BranchHelper> newBranches) throws GitAPIException, IOException {
List<ObjectId> startPoints = new ArrayList<>();
List<ObjectId> stopPoints = new ArrayList<>();
for (BranchHelper newBranch : newBranches) {
if (oldBranches.containsKey(newBranch.getRefName())) {
ObjectId newBranchHeadID = newBranch.getHeadId();
ObjectId oldBranchHeadID = oldBranches.get(newBranch.getRefName()).getHeadId();
if (!newBranchHeadID.equals(oldBranchHeadID)) {
startPoints.add(newBranchHeadID);
}
stopPoints.add(oldBranchHeadID);
} else {
startPoints.add(newBranch.getHeadId());
}
}
PlotCommitList<PlotLane> newCommits = this.parseRawCommits(startPoints, stopPoints);
return wrapRawCommits(newCommits);
}
示例2: parseAllRawLocalCommits
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
/**
* Utilizes JGit to walk through the repo and create raw commit objects - more
* specifically, JGit objects of (super)type RevCommit. This is an expensive
* operation and should only be called when necessary
*
* @return a list of raw local commits
* @throws IOException
*/
private PlotCommitList<PlotLane> parseAllRawLocalCommits() throws IOException, GitAPIException {
ObjectId headId = repo.resolve("HEAD");
if (headId == null) return new PlotCommitList<>();
List<ObjectId> examinedCommitIDs = new ArrayList<>();
PlotCommitList<PlotLane> rawLocalCommits = parseRawCommits(headId, examinedCommitIDs);
examinedCommitIDs.add(headId);
List<LocalBranchHelper> branches = this.branchModel.getLocalBranchesTyped();
for (BranchHelper branch : branches) {
ObjectId branchId = branch.getHeadId();
PlotCommitList<PlotLane> toAdd = parseRawCommits(branchId, examinedCommitIDs);
if (toAdd.size() > 0) {
rawLocalCommits.addAll(toAdd);
examinedCommitIDs.add(toAdd.get(0).getId());
}
}
return rawLocalCommits;
}
示例3: parseRawCommits
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
/**
* Utilizes JGit to walk through the repo and create raw commit objects - more
* specifically, JGit objects of (super)type RevCommit. This is an expensive
* operation and should only be called when necessary
*
* @param startPoints the starting ids to parse from
* @param stopPoints the ids at which parsing should stop
* @return a list of raw commits starting from each id in startPoints, excluding those beyond each id in stopPoints
* @throws IOException
*/
private PlotCommitList<PlotLane> parseRawCommits(List<ObjectId> startPoints, List<ObjectId> stopPoints) throws IOException {
PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<>();
PlotWalk w = new PlotWalk(repo);
for (ObjectId stopId : stopPoints) {
w.markUninteresting(w.parseCommit(stopId));
}
for (ObjectId startId : startPoints) {
w.markStart(w.parseCommit(startId));
PlotCommitList<PlotLane> temp = new PlotCommitList<>();
temp.source(w);
temp.fillTo(Integer.MAX_VALUE);
plotCommitList.addAll(temp);
}
w.dispose();
return plotCommitList;
}
示例4: addButtonsFor
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
private void addButtonsFor(PlotCommit<PlotLane> commit, final Relation relation) {
ViewGroup buttonGroup = buttonGroups.get(relation);
buttonGroup.removeAllViews();
View.OnClickListener clickListener = new View.OnClickListener() {
@SuppressWarnings("unchecked")
public void onClick(View v) {
commitSelectedListener.onCommitSelected(relation, (PlotCommit<PlotLane>) v.getTag());
}
};
for (PlotCommit<PlotLane> relatedCommit : relation.relationsOf(commit)) {
Button button = (Button) layoutInflater.inflate(R.layout.related_commit_button, buttonGroup, false);
button.setTag(relatedCommit);
String abbrId = relatedCommit.getName().substring(0, 4);
String buttonText = (relation == PARENT) ? ("« " + abbrId) : (abbrId + " »");
button.setText(buttonText);
button.setOnClickListener(clickListener);
buttonGroup.addView(button);
}
}
示例5: main
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
try (PlotWalk revWalk = new PlotWalk(repository)) {
ObjectId rootId = repository.resolve("refs/heads/master");
RevCommit root = revWalk.parseCommit(rootId);
revWalk.markStart(root);
PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<>();
plotCommitList.source(revWalk);
plotCommitList.fillTo(Integer.MAX_VALUE);
System.out.println("Printing children of commit " + root);
for (RevCommit com : revWalk) {
System.out.println("Child: " + com);
}
System.out.println("Printing with next()");
System.out.println("next: " + revWalk.next());
}
}
}
示例6: getCommitsByTree
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
public PlotCommitList<PlotLane> getCommitsByTree(final String treeName) throws Exception {
try (PlotWalk revWalk = new PlotWalk(repository)) {
final ObjectId rootId = repository.resolve(treeName);
final RevCommit root = revWalk.parseCommit(rootId);
revWalk.markStart(root);
final PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<>();
plotCommitList.source(revWalk);
plotCommitList.fillTo(Integer.MAX_VALUE);
revWalk.dispose();
return plotCommitList;
}
}
示例7: laneColor
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
@Override
protected Object laneColor(PlotLane myLane) {
if (plotLaneColorHashMap.get(myLane) == null) {
plotLaneColorHashMap.put(
myLane,
colors[ (1 + plotLaneColorHashMap.size()) % colors.length ]
);
}
return plotLaneColorHashMap.get(myLane);
}
示例8: parseAllRawRemoteCommits
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
/**
* Utilizes JGit to walk through the repo and create raw commit objects - more
* specifically, JGit objects of (super)type RevCommit. This is an expensive
* operation and should only be called when necessary
*
* @return a list of raw remote commits
* @throws IOException
*/
private PlotCommitList<PlotLane> parseAllRawRemoteCommits() throws IOException, GitAPIException {
List<ObjectId> examinedCommitIDs = new ArrayList<>();
PlotCommitList<PlotLane> rawRemoteCommits = new PlotCommitList<>();
for (BranchHelper branch : this.branchModel.getRemoteBranchesTyped()) {
ObjectId branchId = branch.getHeadId();
PlotCommitList<PlotLane> toAdd = parseRawCommits(branchId, examinedCommitIDs);
if (toAdd.size() > 0) {
rawRemoteCommits.addAll(toAdd);
examinedCommitIDs.add(toAdd.get(0).getId());
}
}
return rawRemoteCommits;
}
示例9: setCommit
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
public void setCommit(final PlotCommit<PlotLane> c) throws IOException {
this.commit = c;
CommitViewerActivity commitViewerActivity = (CommitViewerActivity) getContext();
pager.setAdapter(new CommitPagerAdapter(commitViewerActivity.getSupportFragmentManager(), repository, c));
tabPageIndicator.setViewPager(pager);
tabPageIndicator.notifyDataSetChanged();
Log.d(TAG, "setCommit : " + commit);
}
示例10: onCreateView
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
try {
Repository repository = FileRepositoryBuilder.create(gitDirFrom(getArguments()));
ObjectId commitId = revisionIdFrom(repository, getArguments(), REVISION);
Log.d(TAG, "onCreateView with "+commitId);
View v=inflater.inflate(R.layout.commit_detail_view, container, false);
CommitNavigationView commitNavigationView = (CommitNavigationView) v.findViewById(R.id.commit_navigation);
commitNavigationView.setCommitSelectedListener(commitSelectedListener);
PlotCommit<PlotLane> commit = commitSelectedListener.plotCommitFor(commitId);
commitNavigationView.setCommit(commit);
((ObjectIdView) v.findViewById(R.id.commit_id)).setObjectId(commit);
ViewGroup vg = (ViewGroup) v.findViewById(R.id.commit_people_group);
PersonIdent author = commit.getAuthorIdent(), committer = commit.getCommitterIdent();
if (author.equals(committer)) {
addPerson("Author & Committer", author, vg);
} else {
addPerson("Author", author, vg);
addPerson("Committer", committer, vg);
}
TextView textView = (TextView) v.findViewById(R.id.commit_message_text);
textView.setText(commit.getFullMessage());
return v;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例11: moveToCommit
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
public void moveToCommit(PlotCommit<PlotLane> newCommit, Relation relation) {
setCurrentCommit(newCommit);
try {
nextCommitView.setCommit(newCommit);
} catch (Exception e) {
throw new RuntimeException(e);
}
relationAnimations.get(relation).animateViews();
swapCommitViewVars();
setCurrentCommitViewVisible();
}
示例12: generatePlotWalk
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
private PlotWalk generatePlotWalk() throws IOException {
Stopwatch stopwatch = new Stopwatch().start();
PlotWalk revWalk = new PlotWalk(repo());
logStartProvider.markStartsOn(revWalk);
PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>();
plotCommitList.source(revWalk);
plotCommitList.fillTo(Integer.MAX_VALUE);
Log.d(TAG, "generatePlotWalk duration" + stopwatch.stop());
return revWalk;
}
示例13: GitPlotRenderer
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
public GitPlotRenderer(PlotCommitList<PlotLane> commitList) {
// Plot to create
plot = new GPlot();
// List of commit IDs
commits = new ArrayList<>();
// Loops over the commits
rowIndex = 0;
for (PlotCommit<PlotLane> commit : commitList) {
commits.add(commit);
currentCommit = commit;
paintCommit(commit, rowHeight);
rowIndex++;
}
}
示例14: laneColor
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
@Override
protected GColor laneColor(PlotLane myLane) {
if (myLane == null) {
return new GColor(0);
} else {
return new GColor(myLane.getPosition());
}
}
示例15: graph
import org.eclipse.jgit.revplot.PlotLane; //导入依赖的package包/类
@Override
public GitLog graph(String from, String to) {
try {
GitRange range = range(from, to, false);
PlotWalk walk = new PlotWalk(git.getRepository());
// Log
walk.markStart(walk.lookupCommit(range.getFrom().getId()));
walk.markUninteresting(walk.lookupCommit(range.getTo().getId()));
PlotCommitList<PlotLane> commitList = new PlotCommitList<>();
commitList.source(walk);
commitList.fillTo(Integer.MAX_VALUE);
// Rendering
GitPlotRenderer renderer = new GitPlotRenderer(commitList);
GPlot plot = renderer.getPlot();
// Gets the commits
List<GitCommit> commits = Lists.transform(
renderer.getCommits(),
this::toCommit
);
// OK
return new GitLog(
plot,
commits
);
} catch (IOException e) {
throw new GitRepositoryIOException(repository.getRemote(), e);
}
}