public static TM_Xml_Database_Git triggerGitCommit(this TM_Xml_Database_Git tmDatabase) { var tmFileStorage = TM_FileStorage.Current; if (tmFileStorage.tmServer().Git.LibraryData_Git_Enabled) { foreach (var nGit in tmDatabase.NGits) { if (nGit.status().valid()) { nGit.gitCommit_SeparateThread(); } } } return(tmDatabase); }
public static TM_Xml_Database setupGitSupport(this TM_Xml_Database_Git tmDatabaseGit) { var tmFileStorage = TM_FileStorage.Current; var tmDatabase = tmFileStorage.TMXmlDatabase; var gitConfig = tmFileStorage.tmServer().Git; if (gitConfig.LibraryData_Git_Enabled) { var online = WebUtils.online(); if (online) { "[TM_Xml_Database] [setupGitSupport] we are online, so git Pull and Pull will be attempted".info(); } else { "[TM_Xml_Database] [setupGitSupport] we are offline, so no git Pull and Pulls".info(); } foreach (var library in tmDatabase.tmLibraries()) { var libraryPath = tmFileStorage.xmlDB_Path_Library_XmlFile(library).parentFolder(); if (libraryPath.isGitRepository()) { var nGit = libraryPath.git_Open(); if (online) { nGit.git_Pull_Library(); nGit.git_Push_Library(); } tmDatabaseGit.NGits.Add(nGit); } else { "[TM_Xml_Database] [setupGitSupport] library {0} is currently not a git repo".info(libraryPath.folderName()); } } tmDatabaseGit.triggerGitCommit(); } return(tmDatabase); }