This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via f677a3d7defdb82d79bca2faf09da6d9338773b3 (commit) via c1922c9660298bb0e70204e66d596adb3d104ac0 (commit) via f4547578aa365164f1ef48c4f546828752cf4835 (commit) via a844c7248d7cfca9569ea8aa6a2147f564a5b2f1 (commit) via a5098cad94c152e397b258be69ae152eb1bda3df (commit) via e81fd5d5ba24e46a3a27c6a4e061932cf2022ef2 (commit) from 1593e16d881bf74fd8981e1290d20f28191f1f0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f677a3d7defdb82d79bca2faf09da6d9338773b3 commit f677a3d7defdb82d79bca2faf09da6d9338773b3 Merge: c1922c9 f454757 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jan 28 08:30:30 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jan 28 08:30:30 2019 -0500 Merge branch 'release-3.13' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1922c9660298bb0e70204e66d596adb3d104ac0 commit c1922c9660298bb0e70204e66d596adb3d104ac0 Merge: a844c72 e81fd5d Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jan 28 13:30:00 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Jan 28 08:30:07 2019 -0500 Merge topic 'doxygen-escaping' e81fd5d5ba FindDoxygen: Escape backslashes in default values Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Julien Schueller <schuel...@phimeca.com> Merge-request: !2867 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a844c7248d7cfca9569ea8aa6a2147f564a5b2f1 commit a844c7248d7cfca9569ea8aa6a2147f564a5b2f1 Merge: 1593e16 a5098ca Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Jan 28 13:26:45 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Mon Jan 28 08:27:03 2019 -0500 Merge topic 'cmake-E-compare_files-eol' a5098cad94 cmake: Add --ignore-eol option to `-E compare_files` command Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !2778 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5098cad94c152e397b258be69ae152eb1bda3df commit a5098cad94c152e397b258be69ae152eb1bda3df Author: Taylor Braun-Jones <tay...@braun-jones.org> AuthorDate: Wed Jan 9 13:02:47 2019 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Jan 28 08:24:50 2019 -0500 cmake: Add --ignore-eol option to `-E compare_files` command Fixes: #13007 diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 915e0d4..eaf57a0 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -373,9 +373,10 @@ Available commands are: ``chdir <dir> <cmd> [<arg>...]`` Change the current working directory and run a command. -``compare_files <file1> <file2>`` +``compare_files [--ignore-eol] <file1> <file2>`` Check if ``<file1>`` is same as ``<file2>``. If files are the same, - then returns 0, if not it returns 1. + then returns 0, if not it returns 1. The ``--ignore-eol`` option + implies line-wise comparison and ignores LF/CRLF differences. ``copy <file>... <destination>`` Copy files to ``<destination>`` (either file or directory). diff --git a/Help/release/dev/compare_files-ignore-eol.rst b/Help/release/dev/compare_files-ignore-eol.rst new file mode 100644 index 0000000..bc32921 --- /dev/null +++ b/Help/release/dev/compare_files-ignore-eol.rst @@ -0,0 +1,6 @@ +compare_files-ignore-eol +------------------------ + +* The :manual:`cmake(1)` ``-E compare_files`` command learned a new + ``--ignore-eol`` option to specify that end-of-line differences (e.g. LF vs + CRLF) should be ignored when comparing files. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ce3691d..0ad9b88 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -78,7 +78,8 @@ void CMakeCommandUsage(const char* program) << " capabilities - Report capabilities built into cmake " "in JSON format\n" << " chdir dir cmd [args...] - run command in a given directory\n" - << " compare_files file1 file2 - check if file1 is same as file2\n" + << " compare_files [--ignore-eol] file1 file2\n" + << " - check if file1 is same as file2\n" << " copy <file>... destination - copy files to destination " "(either file or directory)\n" << " copy_directory <dir>... destination - copy content of <dir>... " @@ -540,10 +541,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } // Compare files - if (args[1] == "compare_files" && args.size() == 4) { - if (cmSystemTools::FilesDiffer(args[2], args[3])) { - std::cerr << "Files \"" << args[2] << "\" to \"" << args[3] - << "\" are different.\n"; + if (args[1] == "compare_files" && (args.size() == 4 || args.size() == 5)) { + bool filesDiffer; + if (args.size() == 4) { + filesDiffer = cmSystemTools::FilesDiffer(args[2], args[3]); + } else if (args[2] == "--ignore-eol") { + filesDiffer = cmsys::SystemTools::TextFilesDiffer(args[3], args[4]); + } else { + ::CMakeCommandUsage(args[0].c_str()); + return 1; + } + + if (filesDiffer) { + std::cerr << "Files \"" << args[args.size() - 2] << "\" to \"" + << args[args.size() - 1] << "\" are different.\n"; return 1; } return 0; diff --git a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-result.txt b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt new file mode 100644 index 0000000..4729ccb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt @@ -0,0 +1 @@ +^Files ".*/compare_files/lf" to ".*/compare_files/crlf" are different.$ diff --git a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt new file mode 100644 index 0000000..8a9ca81 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt @@ -0,0 +1 @@ +^Files "nonexistent_a" to "nonexistent_b" are different.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index c1aaf0d..23fb9ef 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -18,6 +18,10 @@ run_cmake_command(Uno-src ${CMAKE_COMMAND} -B DummyBuildDir -UVAR) run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities) run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg) +run_cmake_command(E_compare_files-different-eol ${CMAKE_COMMAND} -E compare_files ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf) +run_cmake_command(E_compare_files-ignore-eol-same ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf) +run_cmake_command(E_compare_files-ignore-eol-empty ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/empty1 ${RunCMake_SOURCE_DIR}/compare_files/empty2) +run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E compare_files --ignore-eol nonexistent_a nonexistent_b) run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg) diff --git a/Tests/RunCMake/CommandLine/compare_files/.gitattributes b/Tests/RunCMake/CommandLine/compare_files/.gitattributes new file mode 100644 index 0000000..91d5c10 --- /dev/null +++ b/Tests/RunCMake/CommandLine/compare_files/.gitattributes @@ -0,0 +1,2 @@ +crlf eol=crlf +lf eol=lf diff --git a/Tests/RunCMake/CommandLine/compare_files/crlf b/Tests/RunCMake/CommandLine/compare_files/crlf new file mode 100644 index 0000000..a29bdeb --- /dev/null +++ b/Tests/RunCMake/CommandLine/compare_files/crlf @@ -0,0 +1 @@ +line1 diff --git a/Tests/RunCMake/CommandLine/compare_files/empty1 b/Tests/RunCMake/CommandLine/compare_files/empty1 new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/compare_files/empty2 b/Tests/RunCMake/CommandLine/compare_files/empty2 new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CommandLine/compare_files/lf b/Tests/RunCMake/CommandLine/compare_files/lf new file mode 100644 index 0000000..a29bdeb --- /dev/null +++ b/Tests/RunCMake/CommandLine/compare_files/lf @@ -0,0 +1 @@ +line1 ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake.1.rst | 5 +++-- Help/release/dev/compare_files-ignore-eol.rst | 6 ++++++ Modules/FindDoxygen.cmake | 4 +++- Source/cmcmd.cxx | 21 ++++++++++++++++----- .../E_compare_files-different-eol-result.txt} | 0 .../E_compare_files-different-eol-stderr.txt | 1 + ...compare_files-ignore-eol-nonexistent-result.txt} | 0 ..._compare_files-ignore-eol-nonexistent-stderr.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 4 ++++ .../CommandLine/compare_files/.gitattributes | 2 ++ Tests/RunCMake/CommandLine/compare_files/crlf | 1 + .../CommandLine/compare_files/empty1} | 0 .../CommandLine/compare_files/empty2} | 0 Tests/RunCMake/CommandLine/compare_files/lf | 1 + 14 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 Help/release/dev/compare_files-ignore-eol.rst copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/E_compare_files-different-eol-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_compare_files-different-eol-stderr.txt copy Tests/RunCMake/{while/MissingArgument-result.txt => CommandLine/E_compare_files-ignore-eol-nonexistent-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/E_compare_files-ignore-eol-nonexistent-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/compare_files/.gitattributes create mode 100644 Tests/RunCMake/CommandLine/compare_files/crlf copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/compare_files/empty1} (100%) copy Tests/{Wrapping/vtkIncluded.cxx => RunCMake/CommandLine/compare_files/empty2} (100%) create mode 100644 Tests/RunCMake/CommandLine/compare_files/lf hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits