Page MenuHomeSoftware Heritage
Paste P1279

DumpProperties.java
ActivePublic

Authored by seirl on Feb 7 2022, 5:56 PM.
public class DumpProperties {
public static void main(String[] args) throws IOException {
String graphPath = args[0];
SwhBidirectionalGraph graph = SwhBidirectionalGraph.load(graphPath);
graph.properties.loadContentLength();
graph.properties.loadContentIsSkipped();
graph.properties.loadPersonIds();
graph.properties.loadAuthorTimestamps();
graph.properties.loadCommitterTimestamps();
graph.properties.loadMessages();
graph.properties.loadTagNames();
NodeIterator it = graph.nodeIterator();
while (it.hasNext()) {
long node = it.nextLong();
System.out.format("%s: %s\n", node, graph.getSWHID(node));
var s = it.successors();
long succ;
System.out.print(" successors:");
while ((succ = s.nextLong()) >= 0) {
System.out.format(" %s", succ);
}
System.out.println();
switch(graph.getNodeType(node)) {
case CNT:
System.out.format(" length: %s\n", graph.properties.getContentLength(node));
System.out.format(" is_skipped: %s\n", graph.properties.isContentSkipped(node));
break;
case REV:
System.out.format(" author: %s\n", graph.properties.getAuthorId(node));
System.out.format(" committer: %s\n", graph.properties.getCommitterId(node));
System.out.format(" date: %s (offset: %s)\n", graph.properties.getAuthorTimestamp(node), graph.properties.getAuthorTimestampOffset(node));
System.out.format(" committer_date: %s (offset: %s)\n", graph.properties.getCommitterTimestamp(node), graph.properties.getCommitterTimestampOffset(node));
System.out.format(" message: %s\n", (new String(graph.properties.getMessage(node))).replace("\n", "\\n"));
break;
case REL:
System.out.format(" author: %s\n", graph.properties.getAuthorId(node));
System.out.format(" date: %s (offset: %s)\n", graph.properties.getTimestamp(node), graph.properties.getTimestampOffset(node));
System.out.format(" message: %s\n", (new String(graph.properties.getMessage(node))).replace("\n", "\\n"));
System.out.format(" tag name: %s\n", new String(graph.properties.getTagName(node)));
break;
}
System.out.println();
}
}
}

Event Timeline