Skip to content
Snippets Groups Projects
Commit 1489bd15 authored by Shawn Pearce's avatar Shawn Pearce
Browse files

eclipse-iplog: Use contribution rather than bug element


Wayne changed the schema to no longer be dependent upon the Bugzilla
notion of a contribution, but instead be more generic and better
support systems like Gerrit Code Review.  Update our output to
use the <contribution> element and include a link to the change
in Gerrit.

Change-Id: Ibc8a436918bd8e7597dc17743824201a74bce09b
Signed-off-by: default avatarShawn O. Pearce <spearce@spearce.org>
parent 92e73941
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
skipCommit = 1a6964c8274c50f0253db75f010d78ef0e739343 skipCommit = 1a6964c8274c50f0253db75f010d78ef0e739343
[review]
url = http://egit.eclipse.org/r/r/
[CQ "3454"] [CQ "3454"]
description = args4j Version: 2.0.12 description = args4j Version: 2.0.12
license = BSD License license = BSD License
......
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -88,7 +87,6 @@ ...@@ -88,7 +87,6 @@
import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.WindowCursor; import org.eclipse.jgit.lib.WindowCursor;
import org.eclipse.jgit.revwalk.FooterKey;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree; import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.revwalk.RevWalk;
...@@ -111,8 +109,6 @@ public class IpLogGenerator { ...@@ -111,8 +109,6 @@ public class IpLogGenerator {
private static final String INDENT = "{http://xml.apache.org/xslt}indent-amount"; private static final String INDENT = "{http://xml.apache.org/xslt}indent-amount";
private static final FooterKey BUG = new FooterKey("Bug");
/** Projects indexed by their ID string, e.g. {@code technology.jgit}. */ /** Projects indexed by their ID string, e.g. {@code technology.jgit}. */
private final Map<String, Project> projects = new TreeMap<String, Project>(); private final Map<String, Project> projects = new TreeMap<String, Project>();
...@@ -137,6 +133,9 @@ public class IpLogGenerator { ...@@ -137,6 +133,9 @@ public class IpLogGenerator {
/** The meta file we loaded to bootstrap our definitions. */ /** The meta file we loaded to bootstrap our definitions. */
private IpLogMeta meta; private IpLogMeta meta;
/** URL to obtain review information about a specific contribution. */
private String reviewUrl;
private String characterEncoding = "UTF-8"; private String characterEncoding = "UTF-8";
private Repository db; private Repository db;
...@@ -230,6 +229,7 @@ private void loadEclipseIpLog(String version, RevCommit commit) ...@@ -230,6 +229,7 @@ private void loadEclipseIpLog(String version, RevCommit commit)
consumedProjects.put(p.getName(), p); consumedProjects.put(p.getName(), p);
} }
cqs.addAll(meta.getCQs()); cqs.addAll(meta.getCQs());
reviewUrl = meta.getReviewUrl();
} }
private void loadCommitters(Repository repo) throws IOException { private void loadCommitters(Repository repo) throws IOException {
...@@ -358,20 +358,6 @@ private void scanProjectCommits(Project proj, RevCommit start) ...@@ -358,20 +358,6 @@ private void scanProjectCommits(Project proj, RevCommit start)
String subj = commit.getShortMessage(); String subj = commit.getShortMessage();
SingleContribution item = new SingleContribution(id, when, subj); SingleContribution item = new SingleContribution(id, when, subj);
List<String> bugs = commit.getFooterLines(BUG);
if (1 == bugs.size()) {
item.setBugID(bugs.get(0));
} else if (2 <= bugs.size()) {
StringBuilder tmp = new StringBuilder();
for (String bug : bugs) {
if (tmp.length() > 0)
tmp.append(",");
tmp.append(bug);
}
item.setBugID(tmp.toString());
}
if (2 <= cnt) { if (2 <= cnt) {
item.setSize("(merge)"); item.setSize("(merge)");
contributor.add(item); contributor.add(item);
...@@ -594,20 +580,15 @@ private Element createContributor(Contributor c) { ...@@ -594,20 +580,15 @@ private Element createContributor(Contributor c) {
} }
private Element createContribution(SingleContribution s) { private Element createContribution(SingleContribution s) {
Element r = createElement("bug"); Element r = createElement("contribution");
required(r, "id", s.getID()); required(r, "id", s.getID());
optional(r, "bug-id", s.getBugID()); required(r, "description", s.getSummary());
required(r, "size", s.getSize()); required(r, "size", s.getSize());
required(r, "type", "A"); // assume attachment type if (reviewUrl != null)
required(r, "created", format(s.getCreated())); optional(r, "url", reviewUrl + s.getID());
required(r, "summary", s.getSummary());
return r; return r;
} }
private String format(Date created) {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(created);
}
private Element createElement(String name) { private Element createElement(String name) {
return doc.createElementNS(IPLOG_NS, IPLOG_PFX + name); return doc.createElementNS(IPLOG_NS, IPLOG_PFX + name);
} }
......
...@@ -75,6 +75,10 @@ public class IpLogMeta { ...@@ -75,6 +75,10 @@ public class IpLogMeta {
private static final String S_CONSUMES = "consumes"; private static final String S_CONSUMES = "consumes";
private static final String S_REVIEW = "review";
private static final String K_URL = "url";
private static final String K_NAME = "name"; private static final String K_NAME = "name";
private static final String K_VERSION = "version"; private static final String K_VERSION = "version";
...@@ -97,6 +101,8 @@ public class IpLogMeta { ...@@ -97,6 +101,8 @@ public class IpLogMeta {
private Set<CQ> cqs = new HashSet<CQ>(); private Set<CQ> cqs = new HashSet<CQ>();
private String reviewUrl;
List<Project> getProjects() { List<Project> getProjects() {
return projects; return projects;
} }
...@@ -109,6 +115,10 @@ Set<CQ> getCQs() { ...@@ -109,6 +115,10 @@ Set<CQ> getCQs() {
return cqs; return cqs;
} }
String getReviewUrl() {
return reviewUrl;
}
void loadFrom(Config cfg) { void loadFrom(Config cfg) {
projects.clear(); projects.clear();
consumedProjects.clear(); consumedProjects.clear();
...@@ -126,6 +136,8 @@ void loadFrom(Config cfg) { ...@@ -126,6 +136,8 @@ void loadFrom(Config cfg) {
cq.setComments(cfg.getString(S_CQ, id, K_COMMENTS)); cq.setComments(cfg.getString(S_CQ, id, K_COMMENTS));
cqs.add(cq); cqs.add(cq);
} }
reviewUrl = cfg.getString(S_REVIEW, null, K_URL);
} }
private List<Project> parseProjects(final Config cfg, private List<Project> parseProjects(final Config cfg,
......
...@@ -61,8 +61,6 @@ public int compare(SingleContribution a, SingleContribution b) { ...@@ -61,8 +61,6 @@ public int compare(SingleContribution a, SingleContribution b) {
private Date created; private Date created;
private String bugId;
private String size; private String size;
/** /**
...@@ -91,17 +89,6 @@ String getSummary() { ...@@ -91,17 +89,6 @@ String getSummary() {
return summary; return summary;
} }
/** @return Bugzilla bug id */
String getBugID() {
return bugId;
}
void setBugID(String id) {
if (id.startsWith("https://bugs.eclipse.org/"))
id = id.substring("https://bugs.eclipse.org/".length());
bugId = id;
}
String getSize() { String getSize() {
return size; return size;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment