private String constructAmendedMessage() { Set<VirtualFile> selectedRoots = getVcsRoots(getSelectedFilePaths()); // get only selected files LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet(); if (myMessagesForRoots != null) { for (VirtualFile root : selectedRoots) { String message = myMessagesForRoots.get(root); if (message != null) { messages.add(message); } } } return DvcsUtil.joinMessagesOrNull(messages); }
@Nullable public String getDefaultMessageFor(FilePath[] filesToCheckin) { LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet(); for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) { VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG); VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG); try { if (mergeMsg == null && squashMsg == null) { continue; } String encoding = GitConfigUtil.getCommitEncoding(myProject, root); if (mergeMsg != null) { messages.add(loadMessage(mergeMsg, encoding)); } else { messages.add(loadMessage(squashMsg, encoding)); } } catch (IOException e) { if (log.isDebugEnabled()) { log.debug("Unable to load merge message", e); } } } return DvcsUtil.joinMessagesOrNull(messages); }