| 232 | } |
| 233 | |
| 234 | std::string cmExtraKateGenerator::GenerateFilesString( |
| 235 | cmLocalGenerator const& lg) const |
| 236 | { |
| 237 | cmMakefile const* mf = lg.GetMakefile(); |
| 238 | std::string mode = |
| 239 | cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE")); |
| 240 | static std::string const gitString = "\"git\": 1 "; |
| 241 | static std::string const svnString = "\"svn\": 1 "; |
| 242 | static std::string const hgString = "\"hg\": 1 "; |
| 243 | static std::string const fossilString = "\"fossil\": 1 "; |
| 244 | |
| 245 | if (mode == "SVN") { |
| 246 | return svnString; |
| 247 | } |
| 248 | if (mode == "GIT") { |
| 249 | return gitString; |
| 250 | } |
| 251 | if (mode == "HG") { |
| 252 | return hgString; |
| 253 | } |
| 254 | if (mode == "FOSSIL") { |
| 255 | return fossilString; |
| 256 | } |
| 257 | |
| 258 | // check for the VCS files except when "forced" to "FILES" mode: |
| 259 | if (mode != "LIST") { |
| 260 | cmCMakePath startDir(lg.GetSourceDirectory(), cmCMakePath::auto_format); |
| 261 | // move the directories up to the root directory to see whether we are in |
| 262 | // a subdir of a svn, git, hg or fossil checkout |
| 263 | for (;;) { |
| 264 | std::string s = startDir.String() + "/.git"; |
| 265 | if (cmSystemTools::FileExists(s)) { |
| 266 | return gitString; |
| 267 | } |
| 268 | |
| 269 | s = startDir.String() + "/.svn"; |
| 270 | if (cmSystemTools::FileExists(s)) { |
| 271 | return svnString; |
| 272 | } |
| 273 | |
| 274 | s = startDir.String() + "/.hg"; |
| 275 | if (cmSystemTools::FileExists(s)) { |
| 276 | return hgString; |
| 277 | } |
| 278 | s = startDir.String() + "/.fslckout"; |
| 279 | if (cmSystemTools::FileExists(s)) { |
| 280 | return fossilString; |
| 281 | } |
| 282 | |
| 283 | if (!startDir.HasRelativePath()) { // have we reached the root dir ? |
| 284 | break; |
| 285 | } |
| 286 | startDir = startDir.GetParentPath(); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | std::set<std::string> files; |
| 291 | std::string tmp; |
no test coverage detected