mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[log] improve diagnostics
Add previous refs Add information about VCS Fix commit count (it is multiplied by 5 just before reporting error)
This commit is contained in:
@@ -243,8 +243,8 @@ public class VcsLogRefresherImpl implements VcsLogRefresher {
|
||||
}
|
||||
}
|
||||
// couldn't join => need to reload everything; if 5000 commits is still not enough, it's worth reporting:
|
||||
LOG.error("Couldn't join " + commitCount + " recent commits to the log (" + permanentGraph.getAllCommits().size() + " commits)",
|
||||
new Attachment("recent_commits", myLoadedInfo.toLogString(myHashMap.asIndexGetter())));
|
||||
LOG.error("Couldn't join " + commitCount / 5 + " recent commits to the log (" + permanentGraph.getAllCommits().size() + " commits)",
|
||||
new Attachment("recent_commits", myLoadedInfo.toLogString(myHashMap.asIndexGetter(), currentRefs, myProviders)));
|
||||
}
|
||||
|
||||
return loadFullLog();
|
||||
@@ -398,6 +398,7 @@ public class VcsLogRefresherImpl implements VcsLogRefresher {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
|
||||
private static class LogInfo {
|
||||
private final Map<VirtualFile, Set<VcsRef>> myRefs = ContainerUtil.newHashMap();
|
||||
private final Map<VirtualFile, List<GraphCommit<Integer>>> myCommits = ContainerUtil.newHashMap();
|
||||
@@ -428,13 +429,15 @@ public class VcsLogRefresherImpl implements VcsLogRefresher {
|
||||
return myRefs.get(root);
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
|
||||
@NotNull
|
||||
public String toLogString(@NotNull final NotNullFunction<Hash, Integer> indexGetter) {
|
||||
public String toLogString(@NotNull final NotNullFunction<Hash, Integer> indexGetter,
|
||||
@NotNull Map<VirtualFile, Set<VcsRef>> previousRefs,
|
||||
@NotNull Map<VirtualFile, VcsLogProvider> providers) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(" LOG:\n");
|
||||
sb.append("LOG:\n");
|
||||
for (Map.Entry<VirtualFile, List<GraphCommit<Integer>>> entry : myCommits.entrySet()) {
|
||||
sb.append(entry.getKey().getName() + "\n");
|
||||
VirtualFile root = entry.getKey();
|
||||
sb.append(String.format("%s (%s) \n", root.getName(), providers.get(root).getSupportedVcs().getName()));
|
||||
sb.append(StringUtil.join(entry.getValue(), new Function<GraphCommit<Integer>, String>() {
|
||||
@Override
|
||||
public String fun(@NotNull GraphCommit<Integer> commit) {
|
||||
@@ -442,8 +445,17 @@ public class VcsLogRefresherImpl implements VcsLogRefresher {
|
||||
}
|
||||
}, "\n"));
|
||||
}
|
||||
sb.append("\nREFS:\n");
|
||||
for (Map.Entry<VirtualFile, Set<VcsRef>> entry : myRefs.entrySet()) {
|
||||
sb.append("\nREFS:\n");
|
||||
printRefs(sb, indexGetter, myRefs);
|
||||
sb.append("\nPREVIOUS REFS:\n");
|
||||
printRefs(sb, indexGetter, previousRefs);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void printRefs(@NotNull StringBuilder sb,
|
||||
@NotNull final NotNullFunction<Hash, Integer> indexGetter,
|
||||
@NotNull Map<VirtualFile, Set<VcsRef>> refs) {
|
||||
for (Map.Entry<VirtualFile, Set<VcsRef>> entry : refs.entrySet()) {
|
||||
sb.append(entry.getKey().getName() + "\n");
|
||||
sb.append(StringUtil.join(entry.getValue(), new Function<VcsRef, String>() {
|
||||
@Override
|
||||
@@ -452,7 +464,6 @@ public class VcsLogRefresherImpl implements VcsLogRefresher {
|
||||
}
|
||||
}, ","));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user