summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.iplog
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-05-28 14:58:42 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-05-28 14:58:42 -0700
commit92e739413d8814918d9bb037da2b457554c86f9c (patch)
treedabe9cf255f08d2df1c95029c4c4992491451f01 /org.eclipse.jgit.iplog
parent735467365ccb301fa5b379f321224a6fed3afdd7 (diff)
downloadjgit-92e739413d8814918d9bb037da2b457554c86f9c.tar.gz
jgit-92e739413d8814918d9bb037da2b457554c86f9c.zip
eclipse-iplog: Add new consumes element to IP log
This element documents other Eclipse projects that are consumed by this project. JGit doesn't consume any projects, but its sister project EGit does. Change-Id: Ie922d27c580f6742e2acb051815a381af48df7ca Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.iplog')
-rw-r--r--org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java29
-rw-r--r--org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java42
2 files changed, 59 insertions, 12 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 a9fdb81581..8ddb6bdd1e 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
@@ -116,6 +116,9 @@ public class IpLogGenerator {
/** Projects indexed by their ID string, e.g. {@code technology.jgit}. */
private final Map<String, Project> projects = new TreeMap<String, Project>();
+ /** Projects indexed by their ID string, e.g. {@code technology.jgit}. */
+ private final Map<String, Project> consumedProjects = new TreeMap<String, Project>();
+
/** Known committers, indexed by their foundation ID. */
private final Map<String, Committer> committersById = new HashMap<String, Committer>();
@@ -223,6 +226,9 @@ public class IpLogGenerator {
p.setVersion(version);
projects.put(p.getName(), p);
}
+ for (Project p : meta.getConsumedProjects()) {
+ consumedProjects.put(p.getName(), p);
+ }
cqs.addAll(meta.getCQs());
}
@@ -480,8 +486,19 @@ public class IpLogGenerator {
root.appendChild(createProject(project));
licenses.addAll(project.getLicenses());
}
+
+ if (!consumedProjects.isEmpty())
+ appendBlankLine(root);
+ for (Project project : sort(consumedProjects, Project.COMPARATOR)) {
+ root.appendChild(createConsumes(project));
+ licenses.addAll(project.getLicenses());
+ }
+
for (RevCommit c : sort(commits))
root.appendChild(createCommitMeta(c));
+
+ if (licenses.size() > 1)
+ appendBlankLine(root);
for (String name : sort(licenses))
root.appendChild(createLicense(name));
@@ -509,11 +526,21 @@ public class IpLogGenerator {
private Element createProject(Project p) {
Element project = createElement("project");
+ populateProjectType(p, project);
+ return project;
+ }
+
+ private Element createConsumes(Project p) {
+ Element project = createElement("consumes");
+ populateProjectType(p, project);
+ return project;
+ }
+
+ private void populateProjectType(Project p, Element project) {
required(project, "id", p.getID());
required(project, "name", p.getName());
optional(project, "comments", p.getComments());
optional(project, "version", p.getVersion());
- return project;
}
private Element createCommitMeta(RevCommit c) {
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 8d73b02fd5..16a1593523 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
@@ -73,8 +73,12 @@ public class IpLogMeta {
private static final String S_CQ = "CQ";
+ private static final String S_CONSUMES = "consumes";
+
private static final String K_NAME = "name";
+ private static final String K_VERSION = "version";
+
private static final String K_COMMENTS = "comments";
private static final String K_SKIP_COMMIT = "skipCommit";
@@ -89,31 +93,29 @@ public class IpLogMeta {
private List<Project> projects = new ArrayList<Project>();
+ private List<Project> consumedProjects = new ArrayList<Project>();
+
private Set<CQ> cqs = new HashSet<CQ>();
List<Project> getProjects() {
return projects;
}
+ List<Project> getConsumedProjects() {
+ return consumedProjects;
+ }
+
Set<CQ> getCQs() {
return cqs;
}
void loadFrom(Config cfg) {
projects.clear();
+ consumedProjects.clear();
cqs.clear();
- for (String id : cfg.getSubsections(S_PROJECT)) {
- String name = cfg.getString(S_PROJECT, id, K_NAME);
- 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);
- }
+ projects.addAll(parseProjects(cfg, S_PROJECT));
+ consumedProjects.addAll(parseProjects(cfg, S_CONSUMES));
for (String id : cfg.getSubsections(S_CQ)) {
CQ cq = new CQ(Long.parseLong(id));
@@ -126,6 +128,24 @@ public class IpLogMeta {
}
}
+ private List<Project> parseProjects(final Config cfg,
+ final String sectionName) {
+ final List<Project> dst = new ArrayList<Project>();
+ for (String id : cfg.getSubsections(sectionName)) {
+ String name = cfg.getString(sectionName, id, K_NAME);
+ Project project = new Project(id, name);
+ project.setVersion(cfg.getString(sectionName, id, K_VERSION));
+ project.setComments(cfg.getString(sectionName, id, K_COMMENTS));
+
+ for (String c : cfg.getStringList(sectionName, id, K_SKIP_COMMIT))
+ project.addSkipCommit(ObjectId.fromString(c));
+ for (String license : cfg.getStringList(sectionName, id, K_LICENSE))
+ project.addLicense(license);
+ dst.add(project);
+ }
+ return dst;
+ }
+
/**
* Query the Eclipse Foundation's IPzilla database for CQ records.
* <p>