The Unified and Autonomous Development Platform
Last commits of children cache draft.
robin shine068226df52f4
diff --git a/commons.git/src/main/java/com/pmease/commons/git/LastCommitInfo.java b/commons.git/src/main/java/com/pmease/commons/git/LastCommitInfo.javadeleted file mode 100644index 0fd83811ea..0000000000--- a/commons.git/src/main/java/com/pmease/commons/git/LastCommitInfo.java+++ /dev/null@@ -1,36 +0,0 @@-package com.pmease.commons.git;--import java.io.Serializable;--import org.eclipse.jgit.lib.ObjectId;-import org.eclipse.jgit.revwalk.RevCommit;--public class LastCommitInfo implements Serializable {-- private static final long serialVersionUID = 1L;-- private final ObjectId id;-- private final String summary;-- private final long timestamp;-- public LastCommitInfo(RevCommit commit) {- this.id = commit.getId();- this.summary = commit.getShortMessage();- this.timestamp = commit.getCommitTime();- }-- public ObjectId getId() {- return id;- }-- public String getSummary() {- return summary;- }-- public long getTimestamp() {- return timestamp;- }--}\ No newline at end of filediff --git a/commons.git/src/main/java/com/pmease/commons/git/LastCommitsOfChildren.java b/commons.git/src/main/java/com/pmease/commons/git/LastCommitsOfChildren.javadeleted file mode 100644index 58a4e6b00c..0000000000--- a/commons.git/src/main/java/com/pmease/commons/git/LastCommitsOfChildren.java+++ /dev/null@@ -1,68 +0,0 @@-package com.pmease.commons.git;--import java.util.HashMap;-import java.util.HashSet;-import java.util.Set;--import javax.annotation.Nullable;--import org.eclipse.jgit.lib.AnyObjectId;-import org.eclipse.jgit.lib.Repository;-import org.eclipse.jgit.revwalk.AffectedChildrenAwareTreeRevFilter;-import org.eclipse.jgit.revwalk.RevCommit;-import org.eclipse.jgit.revwalk.RevWalk;-import org.eclipse.jgit.treewalk.TreeWalk;--import com.google.common.base.Throwables;--public final class LastCommitsOfChildren extends HashMap<String, LastCommitInfo> {-- private static final long serialVersionUID = 1L;-- public LastCommitsOfChildren(Repository repo, AnyObjectId until, @Nullable String treePath) {- try {- treePath = GitUtils.normalizePath(treePath);- if (treePath == null)- treePath = "";-- AffectedChildrenAwareTreeRevFilter revFilter = new AffectedChildrenAwareTreeRevFilter(treePath);-- Set<String> children = new HashSet<>();-- RevWalk revWalk = new RevWalk(repo);- RevCommit untilCommit = revWalk.parseCommit(until);-- if (treePath.length() != 0) {- TreeWalk treeWalk = TreeWalk.forPath(repo, treePath, untilCommit.getTree());- treeWalk.enterSubtree();- treeWalk.setRecursive(false);- while (treeWalk.next())- children.add(treeWalk.getPathString().substring(treePath.length()+1));- } else {- TreeWalk treeWalk = new TreeWalk(repo);- treeWalk.addTree(untilCommit.getTree());- treeWalk.setRecursive(false);- while (treeWalk.next())- children.add(treeWalk.getPathString().substring(treePath.length()));- }-- revWalk.markStart(untilCommit);- revWalk.setRewriteParents(false);-- revWalk.setRevFilter(revFilter);-- RevCommit next = revWalk.next();- while (size() < children.size() && next != null) {- Set<String> affectedChildren = revFilter.getAffectedChildren();- for (String each: affectedChildren) {- if (children.contains(each) && !containsKey(each))- put(each, new LastCommitInfo(next));- }- affectedChildren.clear();- next = revWalk.next();- }- } catch (Exception e) {- throw Throwables.propagate(e);- }- }-}diff --git a/commons.git/src/main/java/com/pmease/commons/git/command/IsAncestorCommand.java b/commons.git/src/main/java/com/pmease/commons/git/command/IsAncestorCommand.javaindex 29140e437d..b6117b0422 100644--- a/commons.git/src/main/java/com/pmease/commons/git/command/IsAncestorCommand.java+++ b/commons.git/src/main/java/com/pmease/commons/git/command/IsAncestorCommand.java@@ -45,7 +45,7 @@ public class IsAncestorCommand extends GitCommand<Boolean> {@Overridepublic void consume(String line) {- logger.info(line);+ //logger.info(line);}}, new LineConsumer() {diff --git a/commons.git/src/main/java/org/eclipse/jgit/revwalk/AffectedChildrenAwareTreeRevFilter.java b/commons.git/src/main/java/org/eclipse/jgit/revwalk/AffectedChildrenAwareTreeRevFilter.javadeleted file mode 100644index 7abfa4ebd0..0000000000--- a/commons.git/src/main/java/org/eclipse/jgit/revwalk/AffectedChildrenAwareTreeRevFilter.java+++ /dev/null@@ -1,159 +0,0 @@-package org.eclipse.jgit.revwalk;--import java.io.IOException;-import java.util.HashSet;-import java.util.Set;--import org.eclipse.jgit.errors.IncorrectObjectTypeException;-import org.eclipse.jgit.errors.MissingObjectException;-import org.eclipse.jgit.errors.StopWalkException;-import org.eclipse.jgit.lib.Constants;-import org.eclipse.jgit.lib.ObjectId;-import org.eclipse.jgit.revwalk.filter.RevFilter;-import org.eclipse.jgit.treewalk.TreeWalk;-import org.eclipse.jgit.treewalk.filter.TreeFilter;-import org.eclipse.jgit.util.RawParseUtils;--public class AffectedChildrenAwareTreeRevFilter extends RevFilter {-- private static final int PARSED = RevWalk.PARSED;-- private final byte[] treePathRaw;-- private final Set<String> affectedChildren = new HashSet<>();-- public AffectedChildrenAwareTreeRevFilter(String treePath) {- treePathRaw = Constants.encode(treePath);- }-- @Override- public boolean include(RevWalk revWalker, RevCommit commit)- throws StopWalkException, MissingObjectException,- IncorrectObjectTypeException, IOException {- RevCommit[] pList = commit.getParents();- int nParents = pList.length;- TreeWalk treeWalker = new TreeWalk(revWalker.reader);- treeWalker.setRecursive(true);- ObjectId[] trees = new ObjectId[nParents + 1];- for (int i = 0; i < nParents; i++) {- RevCommit p = commit.parents[i];- if ((p.flags & PARSED) == 0)- p.parseHeaders(revWalker);- trees[i] = p.getTree();- }- trees[nParents] = commit.getTree();- treeWalker.reset(trees);-- treeWalker.setFilter(new TreeFilter() {-- @Override- public boolean include(TreeWalk walker)- throws MissingObjectException,- IncorrectObjectTypeException, IOException {- if (treePathRaw.length == 0 || walker.isPathPrefix(treePathRaw, treePathRaw.length) == 0) {- int walkPathLen = walker.getPathLength();- if (walkPathLen <= treePathRaw.length) {- int n = walker.getTreeCount();- if (n == 1) {- walker.setRecursive(true);- return true;- } else {- final int m = walker.getRawMode(n-1);- for (int i = 0; i < n-1; i++) {- if (walker.getRawMode(i) != m || !walker.idEqual(i, n-1)) {- walker.setRecursive(true);- return true;- }- }- }- return false;- } else {- boolean modified = false;- boolean same = false;- int n = walker.getTreeCount();- if (n == 1) {- modified = true;- } else {- int m = walker.getRawMode(n-1);- for (int i = 0; i < n-1; i++) {- boolean modeEquals = walker.getRawMode(i) == m;- boolean idEquals = walker.idEqual(i, n-1);- if (!modeEquals || !idEquals)- modified = true;- if (modeEquals && idEquals)- same = true;- }- }- if (modified) {- if (!same) {- String child = RawParseUtils.decode(- Constants.CHARSET,- walker.getRawPath(),- treePathRaw.length!=0?treePathRaw.length+1:0,- walkPathLen);- affectedChildren.add(child);- }- walker.setRecursive(false);- return true;- } else {- return false;- }- }- } else {- return false;- }- }-- @Override- public boolean shouldBeRecursive() {- throw new UnsupportedOperationException();- }-- @Override- public TreeFilter clone() {- throw new UnsupportedOperationException();- }-- });-- if (nParents <= 1) {- boolean chged = false;- while (treeWalker.next())- chged = true;-- return chged;- }-- int[] chgs = new int[nParents];- while (treeWalker.next()) {- final int myMode = treeWalker.getRawMode(nParents);- for (int i = 0; i < nParents; i++) {- final int pMode = treeWalker.getRawMode(i);- if (myMode == pMode && treeWalker.idEqual(i, nParents))- continue;-- chgs[i]++;- }- }-- for (int i = 0; i < nParents; i++) {- if (chgs[i] == 0) {- RevCommit p = pList[i];- commit.parents = new RevCommit[]{p};- return false;- }- }-- return true;- }-- @Override- public RevFilter clone() {- throw new UnsupportedOperationException();- }-- public Set<String> getAffectedChildren() {- return affectedChildren;- }--}diff --git a/commons.git/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.java b/commons.git/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.javaindex 0802bfafde..2263bcccf2 100644--- a/commons.git/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.java+++ b/commons.git/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.java@@ -53,7 +53,7 @@ import org.eclipse.jgit.errors.MissingObjectException;public class DateRevQueue extends AbstractRevQueue {private static final int REBUILD_INDEX_COUNT = 1000;- private Entry head;+ Entry head;private Entry free;diff --git a/commons.git/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.java b/commons.git/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.javanew file mode 100644index 0000000000..e13d26a403--- /dev/null+++ b/commons.git/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.java@@ -0,0 +1,312 @@+package org.eclipse.jgit.revwalk;++import java.io.IOException;+import java.io.Serializable;+import java.util.HashMap;+import java.util.HashSet;+import java.util.Map;+import java.util.Set;+import java.util.concurrent.atomic.AtomicReference;++import javax.annotation.Nullable;++import org.eclipse.jgit.errors.IncorrectObjectTypeException;+import org.eclipse.jgit.errors.MissingObjectException;+import org.eclipse.jgit.errors.StopWalkException;+import org.eclipse.jgit.lib.AnyObjectId;+import org.eclipse.jgit.lib.Constants;+import org.eclipse.jgit.lib.ObjectId;+import org.eclipse.jgit.lib.Repository;+import org.eclipse.jgit.revwalk.LastCommitsOfChildren.Value;+import org.eclipse.jgit.revwalk.filter.RevFilter;+import org.eclipse.jgit.treewalk.TreeWalk;+import org.eclipse.jgit.treewalk.filter.TreeFilter;+import org.eclipse.jgit.util.RawParseUtils;++import com.google.common.base.Throwables;+import com.pmease.commons.git.GitUtils;++public final class LastCommitsOfChildren extends HashMap<String, Value> {++ private static final long serialVersionUID = 1L;++ private static final int PARSED = RevWalk.PARSED;++ public LastCommitsOfChildren(Repository repo, AnyObjectId until) {+ this(repo, until, null);+ }++ public LastCommitsOfChildren(Repository repo, AnyObjectId until, @Nullable String treePath) {+ this(repo, until, treePath, null);+ }++ public LastCommitsOfChildren(final Repository repo, AnyObjectId until,+ @Nullable String treePath, @Nullable final Cache cache) {+ try {+ treePath = GitUtils.normalizePath(treePath);+ if (treePath == null)+ treePath = "";++ final byte[] treePathRaw = Constants.encode(treePath);+ final Set<String> children = new HashSet<>();+ final Set<String> modifiedChildren = new HashSet<>();++ RevWalk revWalk = new RevWalk(repo);+ RevCommit untilCommit = revWalk.parseCommit(until);++ if (treePath.length() != 0) {+ TreeWalk treeWalk = TreeWalk.forPath(repo, treePath, untilCommit.getTree());+ treeWalk.enterSubtree();+ treeWalk.setRecursive(false);+ while (treeWalk.next())+ children.add(treeWalk.getPathString().substring(treePath.length()+1));+ } else {+ TreeWalk treeWalk = new TreeWalk(repo);+ treeWalk.addTree(untilCommit.getTree());+ treeWalk.setRecursive(false);+ while (treeWalk.next())+ children.add(treeWalk.getPathString().substring(treePath.length()));+ }++ revWalk.markStart(untilCommit);+ revWalk.setRewriteParents(false);++ final AtomicReference<Map<String, Value>> lastCommitsRef = new AtomicReference<>();+ final RevFlag visited = revWalk.newFlag("visited");+ final RevFlag cached = revWalk.newFlag("cached");++ revWalk.setRevFilter(new RevFilter() {++ @Override+ public boolean include(RevWalk revWalker, RevCommit commit)+ throws StopWalkException, MissingObjectException, IncorrectObjectTypeException, IOException {+ commit.add(visited);++ Map<String, Value> lastCommits = lastCommitsRef.get();+ if (lastCommits == null && cache != null) {+ lastCommits = cache.getLastCommitsOfChildren(commit.getId());+ if (lastCommits != null) {+ commit.add(cached);+ lastCommitsRef.set(lastCommits);+ }+ }++ if (commit.has(cached))+ cacheParents(commit.parents, cached, visited);++ DateRevQueue queue = (DateRevQueue) revWalker.queue;+ if (commit.has(cached) && queue.everbodyHasFlag(cached.mask)) {+ for (Map.Entry<String, Value> entry: lastCommits.entrySet()) {+ String child = entry.getKey();+ if (children.contains(child) && !containsKey(child))+ put(child, entry.getValue());+ }+ commit.parents = RevCommit.NO_PARENTS;+ return true;+ }++ TreeWalk treeWalker = new TreeWalk(revWalker.reader);+ treeWalker.setRecursive(true);++ RevCommit[] pList = commit.parents;+ int nParents = pList.length;++ ObjectId[] trees = new ObjectId[nParents + 1];+ for (int i = 0; i < nParents; i++) {+ RevCommit p = commit.parents[i];+ if ((p.flags & PARSED) == 0)+ p.parseHeaders(revWalker);+ trees[i] = p.getTree();+ }+ trees[nParents] = commit.getTree();+ treeWalker.reset(trees);++ final boolean[] changed = new boolean[nParents];+ final AtomicReference<String> childRef = new AtomicReference<>();++ treeWalker.setFilter(new TreeFilter() {++ @Override+ public boolean include(TreeWalk walker)+ throws MissingObjectException, IncorrectObjectTypeException, IOException {+ if (treePathRaw.length == 0 || walker.isPathPrefix(treePathRaw, treePathRaw.length) == 0) {+ int walkPathLen = walker.getPathLength();+ if (walkPathLen <= treePathRaw.length) {+ int n = walker.getTreeCount();+ if (n == 1) {+ walker.setRecursive(true);+ return true;+ } else {+ int m = walker.getRawMode(n-1);+ for (int i = 0; i < n-1; i++) {+ if (walker.getRawMode(i) != m || !walker.idEqual(i, n-1)) {+ walker.setRecursive(true);+ return true;+ }+ }+ }+ return false;+ } else {+ boolean modified = false;+ int n = walker.getTreeCount();+ if (n == 1) {+ modified = true;+ } else {+ int m = walker.getRawMode(n-1);+ for (int i = 0; i < n-1; i++) {+ if (walker.getRawMode(i) != m || !walker.idEqual(i, n-1)) {+ modified = true;+ changed[i] = true;+ } else {+ changed[i] = false;+ }+ }+ }+ if (modified) {+ childRef.set(RawParseUtils.decode(+ Constants.CHARSET,+ walker.getRawPath(),+ treePathRaw.length!=0?treePathRaw.length+1:0,+ walkPathLen));+ walker.setRecursive(false);+ return true;+ } else {+ return false;+ }+ }+ } else {+ return false;+ }+ }++ @Override+ public boolean shouldBeRecursive() {+ throw new UnsupportedOperationException();+ }++ @Override+ public TreeFilter clone() {+ throw new UnsupportedOperationException();+ }++ });++ if (nParents <= 1) {+ while (treeWalker.next()) {+ String child = childRef.get();+ if (children.contains(child) && !containsKey(child))+ modifiedChildren.add(child);+ }+ } else {+ int[] changes = new int[nParents];+ while (treeWalker.next()) {+ String child = childRef.get();+ if (children.contains(child) && !containsKey(child)) {+ boolean same = false;+ for (int i = 0; i < nParents; i++) {+ if (changed[i])+ changes[i] ++;+ else+ same = true;+ }+ if (!same)+ modifiedChildren.add(child);+ }+ }++ if (!commit.has(cached)) {+ for (int i = 0; i < nParents; i++) {+ if (changes[i] == 0) {+ RevCommit p = pList[i];+ commit.parents = new RevCommit[]{p};+ return false;+ }+ }+ }+ }+ return !modifiedChildren.isEmpty();+ }++ @Override+ public boolean requiresCommitBody() {+ return false;+ }++ @Override+ public RevFilter clone() {+ throw new UnsupportedOperationException();+ }++ });++ RevCommit next = revWalk.next();+ while (size() < children.size() && next != null) {+ Value value = new Value(next);+ for (String child: modifiedChildren)+ put(child, value);+ modifiedChildren.clear();+ next = revWalk.next();+ }+ } catch (Exception e) {+ throw Throwables.propagate(e);+ }+ }++ private void cacheParents(RevCommit[] parents, RevFlag cached, RevFlag visited) {+ for (RevCommit p: parents) {+ if (!p.has(cached)) {+ p.add(cached);+ if (p.has(visited))+ cacheParents(p.parents, cached, visited);+ }+ }+ }++ public static class Value implements Serializable {++ private static final long serialVersionUID = 1L;++ private final ObjectId id;++ private final String summary;++ private final long timestamp;++ public Value(RevCommit commit) {+ this.id = commit.copy();+ this.summary = commit.getShortMessage();+ this.timestamp = commit.getCommitTime();+ }++ public ObjectId getId() {+ return id;+ }++ public String getSummary() {+ return summary;+ }++ public long getTimestamp() {+ return timestamp;+ }++ @Override+ public boolean equals(Object obj) {+ if (obj instanceof Value) {+ Value value = (Value) obj;+ return id.equals(value.getId());+ } else {+ return false;+ }+ }++ }++ public static interface Cache {++ @Nullable+ Map<String, Value> getLastCommitsOfChildren(ObjectId commitId);++ }++}diff --git a/commons.util/src/main/java/com/pmease/commons/util/execution/Commandline.java b/commons.util/src/main/java/com/pmease/commons/util/execution/Commandline.javaindex 33a6120a46..5bd05d3d5a 100644--- a/commons.util/src/main/java/com/pmease/commons/util/execution/Commandline.java+++ b/commons.util/src/main/java/com/pmease/commons/util/execution/Commandline.java@@ -132,7 +132,7 @@ public class Commandline {processBuilder.environment().putAll(environment);if (logger.isDebugEnabled()) {- logger.debug("Executing command: " + this);+ //logger.debug("Executing command: " + this);logger.trace("Command working directory: " +processBuilder.directory().getAbsolutePath());StringBuffer buffer = new StringBuffer();diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/GitPlex.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/GitPlex.javaindex c4d5a19af2..30be5c1844 100644--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/GitPlex.java+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/GitPlex.java@@ -99,9 +99,8 @@ public class GitPlex extends AbstractPlugin {});checkGit();- /*- String gitDir = "w:\\linux";- String folder = "kernel";+ String gitDir = "w:\\mozilla";+ String folder = "build";Git git = new Git(new File(gitDir + "/.git"));long time = System.currentTimeMillis();int size = 0;@@ -110,10 +109,9 @@ public class GitPlex extends AbstractPlugin {size += git.log(null, "master", folder + "/" + file.getName(), 1, 0).size();elsesize += git.log(null, "master", file.getName(), 1, 0).size();-// System.out.println(size);+ System.out.println(size);}System.out.println(System.currentTimeMillis()-time);- */}public void checkGit() {diff --git a/gitplex.product/src/test/java/gitplex/product/Test.java b/gitplex.product/src/test/java/gitplex/product/Test.javaindex 90e22ff70c..323f2532b3 100644--- a/gitplex.product/src/test/java/gitplex/product/Test.java+++ b/gitplex.product/src/test/java/gitplex/product/Test.java@@ -2,27 +2,112 @@ package gitplex.product;import java.io.File;import java.io.IOException;+import java.util.HashMap;import java.util.Map;import org.eclipse.jgit.api.errors.GitAPIException;import org.eclipse.jgit.api.errors.NoHeadException;import org.eclipse.jgit.internal.storage.file.FileRepository;import org.eclipse.jgit.lib.AnyObjectId;+import org.eclipse.jgit.lib.ObjectId;import org.eclipse.jgit.lib.Repository;+import org.eclipse.jgit.revwalk.LastCommitsOfChildren;+import org.eclipse.jgit.revwalk.LastCommitsOfChildren.Cache;+import org.eclipse.jgit.revwalk.LastCommitsOfChildren.Value;-import com.pmease.commons.git.LastCommitInfo;-import com.pmease.commons.git.LastCommitsOfChildren;+import com.pmease.commons.git.AbstractGitTest;-public class Test {+public class Test extends AbstractGitTest {@org.junit.Testpublic void test() throws IOException, NoHeadException, GitAPIException {- Repository repo = new FileRepository(new File("w:\\linux\\.git"));- AnyObjectId id = repo.resolve("master");+ Repository repo = new FileRepository(new File("w:\\mozilla\\.git"));+ int start = 9200;+ AnyObjectId oldId = repo.resolve("master~" + start);String dir = "";- for (Map.Entry<String, LastCommitInfo> entry: new LastCommitsOfChildren(repo, id, dir).entrySet()) {+ LastCommitsOfChildren oldCommits = new LastCommitsOfChildren(repo, oldId, dir);++ final Map<AnyObjectId, Map<String, Value>> cache = new HashMap<>();+ cache.put(oldId, oldCommits);++ for (int i=start-1; i>0; i--) {+ System.out.println("Proessing master~" + i);+ AnyObjectId newId = repo.resolve("master~"+i);+ long time = System.currentTimeMillis();+ LastCommitsOfChildren newCommits = new LastCommitsOfChildren(repo, newId, dir, new Cache() {++ @Override+ public Map<String, Value> getLastCommitsOfChildren(ObjectId commitId) {+ return cache.get(commitId);+ }++ });+ long elapsed = System.currentTimeMillis()-time;+ System.out.println(elapsed);+ if (elapsed > 100)+ cache.put(newId, newCommits);+ if (elapsed > 4000) {+ System.out.println(i);+ System.exit(1);+ }}++ repo.close();+ }++ @org.junit.Test+ public void test1() throws IOException, NoHeadException, GitAPIException {+ Repository repo = new FileRepository(new File("w:\\mozilla\\.git"));+ String dir = "";+ ObjectId oldId = repo.resolve("test1~1");+ LastCommitsOfChildren oldCommits = new LastCommitsOfChildren(repo, oldId, dir);+ final Map<AnyObjectId, Map<String, Value>> cache = new HashMap<>();+ cache.put(oldId, oldCommits);++ long time = System.currentTimeMillis();+ new LastCommitsOfChildren(repo, repo.resolve("test1"), dir, new Cache() {++ @Override+ public Map<String, Value> getLastCommitsOfChildren(ObjectId commitId) {+ return cache.get(commitId);+ }++ });+ System.out.println(System.currentTimeMillis()-time);++ repo.close();+ }++ @org.junit.Test+ public void test2() throws IOException, NoHeadException, GitAPIException {+ Repository repo = new FileRepository(new File("w:\\mozilla\\.git"));+ String dir = "";+ ObjectId oldId = repo.resolve("test~1");+ LastCommitsOfChildren oldCommits = new LastCommitsOfChildren(repo, oldId, dir);+ final Map<AnyObjectId, Map<String, Value>> cache = new HashMap<>();+ cache.put(oldId, oldCommits);++ long time = System.currentTimeMillis();+ new LastCommitsOfChildren(repo, repo.resolve("test"), dir, new Cache() {++ @Override+ public Map<String, Value> getLastCommitsOfChildren(ObjectId commitId) {+ return cache.get(commitId);+ }++ });+ System.out.println(System.currentTimeMillis()-time);++ repo.close();+ }++ @org.junit.Test+ public void test3() throws IOException, NoHeadException, GitAPIException {+ Repository repo = new FileRepository(new File("w:\\mozilla\\.git"));+ String dir = "";+ String rev = "master";+ new LastCommitsOfChildren(repo, repo.resolve(rev), dir);repo.close();}