diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-03-11 12:02:27 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-03-11 15:15:03 -0800 |
commit | 4a73596ce4308a59813dd14b74bec2ce7a406b80 (patch) | |
tree | e2fe0e0417e85eebd3e7ff4b48774646dccde909 /org.eclipse.jgit.iplog | |
parent | 8e2c17ca2addd984f1ba239aca27f19698606ed9 (diff) | |
download | jgit-4a73596ce4308a59813dd14b74bec2ce7a406b80.tar.gz jgit-4a73596ce4308a59813dd14b74bec2ce7a406b80.zip |
eclipse-iplog: Skip the initial contribution
The initial contribution was handled through a CQ, and does not need
to be reported as an individual bug record in the project's IP log.
Its an odd corner case that the EMO IP team doesn't want to see,
even though its technically a contribution written by at least
some non-committers.
The project.skipCommit variable can now be used to mask out any
particular change from the IP log. Currently within JGit we want
to mask only the initial commit, but others could be masked if the
need arises.
Change-Id: I598e08137ddc5913284471ee2aa545f4df685023
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.iplog')
3 files changed, 30 insertions, 3 deletions
diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java index 417c506550..d8956afe12 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java @@ -130,6 +130,9 @@ public class IpLogGenerator { /** Root commits which were scanned to gather project data. */ private final Set<RevCommit> commits = new HashSet<RevCommit>(); + /** The meta file we loaded to bootstrap our definitions. */ + private IpLogMeta meta; + private String characterEncoding = "UTF-8"; private Repository db; @@ -185,7 +188,7 @@ public class IpLogGenerator { loadEclipseIpLog(version, c); loadCommitters(repo); - scanProjectCommits(c); + scanProjectCommits(meta.getProjects().get(0), c); commits.add(c); } finally { WindowCursor.release(curs); @@ -202,7 +205,7 @@ public class IpLogGenerator { if (log == null) return; - IpLogMeta meta = new IpLogMeta(); + meta = new IpLogMeta(); try { meta.loadFrom(new BlobBasedConfig(null, db, log.getObjectId(0))); } catch (ConfigInvalidException e) { @@ -277,12 +280,17 @@ public class IpLogGenerator { } } - private void scanProjectCommits(RevCommit start) throws IOException { + private void scanProjectCommits(Project proj, RevCommit start) + throws IOException { rw.reset(); rw.markStart(start); RevCommit commit; while ((commit = rw.next()) != null) { + if (proj.isSkippedCommit(commit)) { + continue; + } + final PersonIdent author = commit.getAuthorIdent(); final Date when = author.getWhen(); diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java index 38b7d417b1..d0a5279abb 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java @@ -59,6 +59,7 @@ import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileBasedConfig; import org.eclipse.jgit.lib.LockFile; +import org.eclipse.jgit.lib.ObjectId; /** * Manages the {@code .eclipse_iplog} file in a project. @@ -75,6 +76,8 @@ public class IpLogMeta { private static final String K_COMMENTS = "comments"; + private static final String K_SKIP_COMMIT = "skipCommit"; + private static final String K_LICENSE = "license"; private static final String K_DESCRIPTION = "description"; @@ -104,6 +107,8 @@ public class IpLogMeta { Project project = new Project(id, name); project.setComments(cfg.getString(S_PROJECT, id, K_COMMENTS)); + for (String c : cfg.getStringList(S_PROJECT, id, K_SKIP_COMMIT)) + project.addSkipCommit(ObjectId.fromString(c)); for (String license : cfg.getStringList(S_PROJECT, id, K_LICENSE)) project.addLicense(license); projects.add(project); diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Project.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Project.java index 6495d38ff5..15b79cede5 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Project.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/Project.java @@ -48,6 +48,10 @@ import java.util.Comparator; import java.util.Set; import java.util.TreeSet; +import org.eclipse.jgit.lib.AnyObjectId; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.ObjectIdSubclassMap; + /** Description of a project. */ class Project { /** Sorts projects by unique identities. */ @@ -65,6 +69,8 @@ class Project { private final Set<String> licenses = new TreeSet<String>(); + private final ObjectIdSubclassMap<ObjectId> skipCommits = new ObjectIdSubclassMap<ObjectId>(); + private String version; /** @@ -104,6 +110,14 @@ class Project { licenses.add(licenseName); } + void addSkipCommit(AnyObjectId commit) { + skipCommits.add(commit.copy()); + } + + boolean isSkippedCommit(AnyObjectId commit) { + return skipCommits.contains(commit); + } + String getVersion() { return version; } |