From efe3ec5f77c53ae534b14441a113ccc277c6bc1a Mon Sep 17 00:00:00 2001 From: codyhoag Date: Fri, 2 Aug 2019 15:18:50 -0400 Subject: [PATCH] LRDOCS-6295 Listing renamed files is not necessary; if header ID stays the same, the file name can change and KB only recognizes it as modified file --- .../util/CheckLatestCommitTask.java | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/code/liferay-doc-utils/src/com/liferay/documentation/util/CheckLatestCommitTask.java b/code/liferay-doc-utils/src/com/liferay/documentation/util/CheckLatestCommitTask.java index ab9d2fb680a..ad0bcfd1009 100644 --- a/code/liferay-doc-utils/src/com/liferay/documentation/util/CheckLatestCommitTask.java +++ b/code/liferay-doc-utils/src/com/liferay/documentation/util/CheckLatestCommitTask.java @@ -403,7 +403,7 @@ private static List getModifiedFiles(String commit, String docLocation, List modifiedFiles = new ArrayList (); List deletedFiles = new ArrayList (); - HashMap renamedFiles = new HashMap (); + //HashMap renamedFiles = new HashMap (); for (DiffEntry entry : entries) { @@ -425,13 +425,13 @@ private static List getModifiedFiles(String commit, String docLocation, entryPath = entryPath.replace("/images-dxp/", "/images/"); } - if (entry.getChangeType().toString().equals("RENAME")) { - renamedFiles.put(entry.getOldPath(), entryPath); - modifiedFiles.add(entryPath); - } - else { - modifiedFiles.add(entryPath); - } + //if (entry.getChangeType().toString().equals("RENAME")) { + // renamedFiles.put(entry.getOldPath(), entryPath); + // modifiedFiles.add(entryPath); + //} + //else { + modifiedFiles.add(entryPath); + //} } else if (entry.getOldPath().startsWith(docLocation) && entry.getChangeType().toString().equals("DELETE")) { @@ -444,8 +444,8 @@ else if (entry.getOldPath().startsWith(docLocation) && System.exit(0); } - if (!deletedFiles.isEmpty() || !renamedFiles.isEmpty()) { - writeDeletedTextFile(deletedFiles, renamedFiles, distDir); + if (!deletedFiles.isEmpty()) { + writeDeletedTextFile(deletedFiles, distDir); } repo.close(); @@ -645,19 +645,17 @@ private static void unzipFile(String docDir, String zipName) } /** - * Writes deleted and renamed files to a {@code .txt} file. This is useful - * to notify the publisher of the files that must be manually deleted from - * the Knowledge Base portlet, since the import of a Zip only adds files or - * modifies existing files, but cannot delete them. + * Writes deleted files to a {@code .txt} file. This is useful to notify the + * publisher of the files that must be manually deleted from the Knowledge + * Base portlet, since the import of a Zip only adds files or modifies + * existing files, but cannot delete them. * * @param deletedFiles the files that were deleted in the Git repo since * the last publication - * @param renamedFiles the files that were renamed in the Git repo since - * the last publication * @param distDir the folder where the Zip is generated (e.g., {@code dist}) * @throws IOException if an IO exception occurred */ - private static void writeDeletedTextFile(List deletedFiles, HashMap renamedFiles, String distDir) + private static void writeDeletedTextFile(List deletedFiles, String distDir) throws IOException { PrintWriter writer = new PrintWriter(distDir + "/delete-files.txt", "UTF-8"); @@ -667,12 +665,12 @@ private static void writeDeletedTextFile(List deletedFiles, HashMap entry : renamedFiles.entrySet()) { - writer.println("Old article to delete: " + entry.getKey() + " (renamed/moved to: " + entry.getValue() + ")"); - } + //for (Map.Entry entry : renamedFiles.entrySet()) { + // writer.println("Old article to delete: " + entry.getKey() + " (renamed/moved to: " + entry.getValue() + ")"); + //} writer.close(); }