MCPcopy Create free account
hub / github.com/ReZeroS/git / iteratorChangedFiles

Method iteratorChangedFiles

src/main/java/club/qqtim/diff/DiffUtil.java:31–46  ·  view source on GitHub ↗
(Map<String, String> fromTree, Map<String, String> toTree)

Source from the content-addressed store, hash-verified

29
30
31 public static List<SimplyChange> iteratorChangedFiles(Map<String, String> fromTree, Map<String, String> toTree) {
32 final Map<String, List<String>> pathObjectIds = compareTrees(fromTree, toTree);
33 return pathObjectIds.entrySet().stream().map(entry -> {
34 final String path = entry.getKey();
35 final List<String> objectIds = entry.getValue();
36 final String fromObject = objectIds.get(0);
37 final String toObject = objectIds.get(1);
38 if (!Objects.equals(fromObject, toObject)) {
39 final SimplyChange simplyChange = new SimplyChange();
40 simplyChange.setPath(path);
41 simplyChange.setAction(fromObject == null ? "new file" : toObject == null ? "delete file" : "modify file");
42 return simplyChange;
43 }
44 return null;
45 }).filter(Objects::nonNull).collect(Collectors.toList());
46 }
47
48 public static String diffTrees(Map<String, String> treeFrom, Map<String, String> treeTo) {
49 StringBuilder output = new StringBuilder();

Callers 1

runMethod · 0.95

Calls 1

compareTreesMethod · 0.95

Tested by

no test coverage detected