mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 07:28:51 -06:00
Kate: improve the way the VCS-specific files are searched
Before, CMake only checked for the .svn etc. directory only in
${CMAKE_SOURCE_DIR}, now it also goes the directories up to check
whether those VCS directories exist in one of the parent directories.
This commit is contained in:
committed by
Brad King
parent
96389b4cd3
commit
e7f7bff4f5
@@ -8,6 +8,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "cmCMakePath.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
@@ -241,31 +242,38 @@ std::string cmExtraKateGenerator::GenerateFilesString(
|
||||
return fossilString;
|
||||
}
|
||||
|
||||
std::string s;
|
||||
|
||||
// check for the VCS files except when "forced" to "FILES" mode:
|
||||
if (mode != "LIST") {
|
||||
s = cmStrCat(lg.GetSourceDirectory(), "/.git");
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return gitString;
|
||||
}
|
||||
cmCMakePath startDir(lg.GetSourceDirectory(), cmCMakePath::auto_format);
|
||||
// move the directories up to the root directory to see whether we are in
|
||||
// a subdir of a svn, git, hg or fossil checkout
|
||||
for (;;) {
|
||||
std::string s = startDir.String() + "/.git";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return gitString;
|
||||
}
|
||||
|
||||
s = cmStrCat(lg.GetSourceDirectory(), "/.svn");
|
||||
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 = startDir.String() + "/.svn";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return svnString;
|
||||
}
|
||||
|
||||
s = startDir.String() + "/.hg";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return hgString;
|
||||
}
|
||||
s = startDir.String() + "/.fslckout";
|
||||
if (cmSystemTools::FileExists(s)) {
|
||||
return fossilString;
|
||||
}
|
||||
|
||||
if (!startDir.HasRelativePath()) { // have we reached the root dir ?
|
||||
break;
|
||||
}
|
||||
startDir = startDir.GetParentPath();
|
||||
}
|
||||
}
|
||||
|
||||
s = cmStrCat(lg.GetSourceDirectory(), '/');
|
||||
|
||||
std::set<std::string> files;
|
||||
std::string tmp;
|
||||
const auto& lgs = this->GlobalGenerator->GetLocalGenerators();
|
||||
|
||||
Reference in New Issue
Block a user