From 96389b4cd3dfa2632619fee5e1a16ca872f55973 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Thu, 2 Feb 2023 22:23:50 +0100 Subject: Kate: add support for hg and fossil Both VCS are supported by kate nowadays. --- Help/variable/CMAKE_KATE_FILES_MODE.rst | 10 +++++----- Source/cmExtraKateGenerator.cxx | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Help/variable/CMAKE_KATE_FILES_MODE.rst b/Help/variable/CMAKE_KATE_FILES_MODE.rst index e568e00..195c15d 100644 --- a/Help/variable/CMAKE_KATE_FILES_MODE.rst +++ b/Help/variable/CMAKE_KATE_FILES_MODE.rst @@ -7,14 +7,14 @@ This cache variable is used by the Kate project generator and controls to what mode the ``files`` entry in the project file will be set. See :manual:`cmake-generators(7)`. -Possible values are ``AUTO``, ``SVN``, ``GIT`` and ``LIST``. +Possible values are ``AUTO``, ``SVN``, ``GIT``, ``HG``, ``FOSSIL`` and ``LIST``. When set to ``LIST``, CMake will put the list of source files known to CMake in the project file. -When set to ``SVN``, CMake will put ``svn`` into the project file so that Kate -will use svn to retrieve the list of files in the project. -When set to ``GIT``, CMake will put ``git`` into the project file so that Kate -will use git to retrieve the list of files in the project. +When set to ``SVN``, ``GIT``, ``HG`` or ``FOSSIL``, CMake will set +the generated project accordingly to Subversion, git, Mercurial +or Fossil, and Kate will then use the respective command line tool to +retrieve the list of files in the project. When unset or set to ``AUTO``, CMake will try to detect whether the source directory is part of a git or svn checkout or not, and put the respective entry into the project file. diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 5418fd3..5be8f26 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -225,6 +225,8 @@ std::string cmExtraKateGenerator::GenerateFilesString( cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE")); static const std::string gitString = "\"git\": 1 "; static const std::string svnString = "\"svn\": 1 "; + static const std::string hgString = "\"hg\": 1 "; + static const std::string fossilString = "\"fossil\": 1 "; if (mode == "SVN") { return svnString; @@ -232,6 +234,12 @@ std::string cmExtraKateGenerator::GenerateFilesString( if (mode == "GIT") { return gitString; } + if (mode == "HG") { + return hgString; + } + if (mode == "FOSSIL") { + return fossilString; + } std::string s; @@ -246,6 +254,14 @@ std::string cmExtraKateGenerator::GenerateFilesString( if (cmSystemTools::FileExists(s)) { return svnString; } + s = cmStrCat(lg.GetSourceDirectory(), "/.hg"); + if (cmSystemTools::FileExists(s)) { + return hgString; + } + s = cmStrCat(lg.GetSourceDirectory(), "/.fslckout"); + if (cmSystemTools::FileExists(s)) { + return fossilString; + } } s = cmStrCat(lg.GetSourceDirectory(), '/'); -- cgit v0.12