()
| 27 | |
| 28 | |
| 29 | @Override |
| 30 | public String call() { |
| 31 | StringBuilder dotGraph = new StringBuilder("digraph commits {\n"); |
| 32 | |
| 33 | |
| 34 | Set<String> idsSet = new HashSet<>(); |
| 35 | final List<RefObject> refObjects = ZitContext.iteratorRefs(false); |
| 36 | for (RefObject refObject : refObjects) { |
| 37 | dotGraph.append(String.format("\"{%s}\" [shape=note]\n", refObject.getRefName())); |
| 38 | final RefValue refValue = refObject.getRefValue(); |
| 39 | dotGraph.append(String.format("\"{%s}\" -> \"{%s}\"\n", refObject.getRefName(), refValue.getValue())); |
| 40 | if (!refValue.getSymbolic()) { |
| 41 | idsSet.add(refObject.getRefValue().getValue()); |
| 42 | } |
| 43 | } |
| 44 | final List<String> refIds = ZitContext.iteratorCommitsAndParents(idsSet); |
| 45 | refIds.forEach(refId -> { |
| 46 | final CommitObject commit = Commit.getCommit(refId); |
| 47 | final String shapeBox = String.format("\"{%s}\" [shape=box style=filled label=\"{%s}\"]\n", refId, refId.substring(0, 11)); |
| 48 | dotGraph.append(shapeBox); |
| 49 | if (Objects.nonNull(commit.getParents()) && !commit.getParents().isEmpty()) { |
| 50 | commit.getParents().forEach(parent -> { |
| 51 | dotGraph.append(String.format("\"{%s}\" -> \"{%s}\"\n", refId, parent)); |
| 52 | }); |
| 53 | } |
| 54 | }); |
| 55 | dotGraph.append("}"); |
| 56 | log.info(dotGraph.toString()); |
| 57 | |
| 58 | //todo: output rendered image to the screen |
| 59 | return null; |
| 60 | } |
| 61 | } |
nothing calls this directly
no test coverage detected