\r
#include "StdAfx.h"\r
#include ".\foldercrawler.h"\r
-#include "SVNStatusCache.h"\r
+#include "GitStatusCache.h"\r
#include "registry.h"\r
#include "TSVNCache.h"\r
#include "shlobj.h"\r
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);\r
}\r
\r
-void CFolderCrawler::AddDirectoryForUpdate(const CTSVNPath& path)\r
+void CFolderCrawler::AddDirectoryForUpdate(const CTGitPath& path)\r
{\r
- if (!CSVNStatusCache::Instance().IsPathGood(path))\r
+ if (!CGitStatusCache::Instance().IsPathGood(path))\r
return;\r
{\r
AutoLocker lock(m_critSec);\r
SetEvent(m_hWakeEvent);\r
}\r
\r
-void CFolderCrawler::AddPathForUpdate(const CTSVNPath& path)\r
+void CFolderCrawler::AddPathForUpdate(const CTGitPath& path)\r
{\r
- if (!CSVNStatusCache::Instance().IsPathGood(path))\r
+ if (!CGitStatusCache::Instance().IsPathGood(path))\r
return;\r
{\r
AutoLocker lock(m_critSec);\r
HANDLE hWaitHandles[2];\r
hWaitHandles[0] = m_hTerminationEvent; \r
hWaitHandles[1] = m_hWakeEvent;\r
- CTSVNPath workingPath;\r
+ CTGitPath workingPath;\r
bool bFirstRunAfterWakeup = false;\r
DWORD currentTicks = 0;\r
\r
if (!m_bRun)\r
break;\r
// Any locks today?\r
- if (CSVNStatusCache::Instance().m_bClearMemory)\r
+ if (CGitStatusCache::Instance().m_bClearMemory)\r
{\r
- CSVNStatusCache::Instance().WaitToWrite();\r
- CSVNStatusCache::Instance().ClearCache();\r
- CSVNStatusCache::Instance().Done();\r
- CSVNStatusCache::Instance().m_bClearMemory = false;\r
+ CGitStatusCache::Instance().WaitToWrite();\r
+ CGitStatusCache::Instance().ClearCache();\r
+ CGitStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().m_bClearMemory = false;\r
}\r
if(m_lCrawlInhibitSet > 0)\r
{\r
{\r
// The queue has changed - it's worth sorting and de-duping\r
std::sort(m_pathsToUpdate.begin(), m_pathsToUpdate.end());\r
- m_pathsToUpdate.erase(std::unique(m_pathsToUpdate.begin(), m_pathsToUpdate.end(), &CTSVNPath::PredLeftSameWCPathAsRight), m_pathsToUpdate.end());\r
+ m_pathsToUpdate.erase(std::unique(m_pathsToUpdate.begin(), m_pathsToUpdate.end(), &CTGitPath::PredLeftSameWCPathAsRight), m_pathsToUpdate.end());\r
m_bPathsAddedSinceLastCrawl = false;\r
}\r
workingPath = m_pathsToUpdate.front();\r
// to crawl. That way, we still reduce the size of the list.\r
if (m_pathsToUpdate.size() > 10)\r
ATLTRACE("attention: the list of paths to update is now %ld big!\n", m_pathsToUpdate.size());\r
- for (std::deque<CTSVNPath>::iterator it = m_pathsToUpdate.begin(); it != m_pathsToUpdate.end(); ++it)\r
+ for (std::deque<CTGitPath>::iterator it = m_pathsToUpdate.begin(); it != m_pathsToUpdate.end(); ++it)\r
{\r
workingPath = *it;\r
if ((DWORD(workingPath.GetCustomData()) < currentTicks)||(DWORD(workingPath.GetCustomData()) > (currentTicks + 200000)))\r
if ((!m_blockedPath.IsEmpty())&&(m_blockedPath.IsAncestorOf(workingPath)))\r
continue;\r
// don't crawl paths that are excluded\r
- if (!CSVNStatusCache::Instance().IsPathAllowed(workingPath))\r
+ if (!CGitStatusCache::Instance().IsPathAllowed(workingPath))\r
continue;\r
// check if the changed path is inside an .svn folder\r
if ((workingPath.HasAdminDir()&&workingPath.IsDirectory())||workingPath.IsAdminDir())\r
}\r
else if (!workingPath.Exists())\r
{\r
- CSVNStatusCache::Instance().WaitToWrite();\r
- CSVNStatusCache::Instance().RemoveCacheForPath(workingPath);\r
- CSVNStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().WaitToWrite();\r
+ CGitStatusCache::Instance().RemoveCacheForPath(workingPath);\r
+ CGitStatusCache::Instance().Done();\r
continue;\r
}\r
\r
nCurrentCrawledpathIndex = 0;\r
}\r
InvalidateRect(hWnd, NULL, FALSE);\r
- CSVNStatusCache::Instance().WaitToRead();\r
+ CGitStatusCache::Instance().WaitToRead();\r
// Invalidate the cache of this folder, to make sure its status is fetched again.\r
- CCachedDirectory * pCachedDir = CSVNStatusCache::Instance().GetDirectoryCacheEntry(workingPath);\r
+ CCachedDirectory * pCachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath);\r
if (pCachedDir)\r
{\r
- svn_wc_status_kind status = pCachedDir->GetCurrentFullStatus();\r
+ git_wc_status_kind status = pCachedDir->GetCurrentFullStatus();\r
pCachedDir->Invalidate();\r
if (workingPath.Exists())\r
{\r
// We do this here because GetCurrentFullStatus() doesn't send\r
// notifications for 'normal' status - if it would, we'd get tons\r
// of notifications when crawling a working copy not yet in the cache.\r
- if ((status != svn_wc_status_normal)&&(pCachedDir->GetCurrentFullStatus() != status))\r
+ if ((status != git_wc_status_normal)&&(pCachedDir->GetCurrentFullStatus() != status))\r
{\r
- CSVNStatusCache::Instance().UpdateShell(workingPath);\r
+ CGitStatusCache::Instance().UpdateShell(workingPath);\r
ATLTRACE(_T("shell update in crawler for %s\n"), workingPath.GetWinPath());\r
}\r
}\r
else\r
{\r
- CSVNStatusCache::Instance().Done();\r
- CSVNStatusCache::Instance().WaitToWrite();\r
- CSVNStatusCache::Instance().RemoveCacheForPath(workingPath);\r
+ CGitStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().WaitToWrite();\r
+ CGitStatusCache::Instance().RemoveCacheForPath(workingPath);\r
}\r
}\r
- CSVNStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().Done();\r
//In case that svn_client_stat() modified a file and we got\r
//a notification about that in the directory watcher,\r
//remove that here again - this is to prevent an endless loop\r
{\r
if (!workingPath.Exists())\r
{\r
- CSVNStatusCache::Instance().WaitToWrite();\r
- CSVNStatusCache::Instance().RemoveCacheForPath(workingPath);\r
- CSVNStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().WaitToWrite();\r
+ CGitStatusCache::Instance().RemoveCacheForPath(workingPath);\r
+ CGitStatusCache::Instance().Done();\r
continue;\r
}\r
if (!workingPath.Exists())\r
DWORD flags = TSVNCACHE_FLAGS_FOLDERISKNOWN;\r
flags |= (workingPath.IsDirectory() ? TSVNCACHE_FLAGS_ISFOLDER : 0);\r
flags |= (bRecursive ? TSVNCACHE_FLAGS_RECUSIVE_STATUS : 0);\r
- CSVNStatusCache::Instance().WaitToRead();\r
+ CGitStatusCache::Instance().WaitToRead();\r
// Invalidate the cache of folders manually. The cache of files is invalidated\r
// automatically if the status is asked for it and the file times don't match\r
// anymore, so we don't need to manually invalidate those.\r
if (workingPath.IsDirectory())\r
{\r
- CCachedDirectory * cachedDir = CSVNStatusCache::Instance().GetDirectoryCacheEntry(workingPath);\r
+ CCachedDirectory * cachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath);\r
if (cachedDir)\r
cachedDir->Invalidate();\r
}\r
- CStatusCacheEntry ce = CSVNStatusCache::Instance().GetStatusForPath(workingPath, flags);\r
- if (ce.GetEffectiveStatus() > svn_wc_status_unversioned)\r
+ CStatusCacheEntry ce = CGitStatusCache::Instance().GetStatusForPath(workingPath, flags);\r
+ if (ce.GetEffectiveStatus() > git_wc_status_unversioned)\r
{\r
- CSVNStatusCache::Instance().UpdateShell(workingPath);\r
+ CGitStatusCache::Instance().UpdateShell(workingPath);\r
ATLTRACE(_T("shell update in folder crawler for %s\n"), workingPath.GetWinPath());\r
}\r
- CSVNStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().Done();\r
AutoLocker lock(m_critSec);\r
m_pathsToUpdate.erase(std::remove(m_pathsToUpdate.begin(), m_pathsToUpdate.end(), workingPath), m_pathsToUpdate.end());\r
}\r
{\r
if (!workingPath.Exists())\r
{\r
- CSVNStatusCache::Instance().WaitToWrite();\r
- CSVNStatusCache::Instance().RemoveCacheForPath(workingPath);\r
- CSVNStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().WaitToWrite();\r
+ CGitStatusCache::Instance().RemoveCacheForPath(workingPath);\r
+ CGitStatusCache::Instance().Done();\r
}\r
}\r
}\r
{\r
// The queue has changed - it's worth sorting and de-duping\r
std::sort(m_foldersToUpdate.begin(), m_foldersToUpdate.end());\r
- m_foldersToUpdate.erase(std::unique(m_foldersToUpdate.begin(), m_foldersToUpdate.end(), &CTSVNPath::PredLeftEquivalentToRight), m_foldersToUpdate.end());\r
+ m_foldersToUpdate.erase(std::unique(m_foldersToUpdate.begin(), m_foldersToUpdate.end(), &CTGitPath::PredLeftEquivalentToRight), m_foldersToUpdate.end());\r
m_bItemsAddedSinceLastCrawl = false;\r
}\r
- // create a new CTSVNPath object to make sure the cached flags are requested again.\r
+ // create a new CTGitPath object to make sure the cached flags are requested again.\r
// without this, a missing file/folder is still treated as missing even if it is available\r
// now when crawling.\r
- workingPath = CTSVNPath(m_foldersToUpdate.front().GetWinPath());\r
+ workingPath = CTGitPath(m_foldersToUpdate.front().GetWinPath());\r
workingPath.SetCustomData(m_foldersToUpdate.front().GetCustomData());\r
if ((DWORD(workingPath.GetCustomData()) < currentTicks)||(DWORD(workingPath.GetCustomData()) > (currentTicks + 200000)))\r
m_foldersToUpdate.pop_front();\r
// to crawl. That way, we still reduce the size of the list.\r
if (m_foldersToUpdate.size() > 10)\r
ATLTRACE("attention: the list of folders to update is now %ld big!\n", m_foldersToUpdate.size());\r
- for (std::deque<CTSVNPath>::iterator it = m_foldersToUpdate.begin(); it != m_foldersToUpdate.end(); ++it)\r
+ for (std::deque<CTGitPath>::iterator it = m_foldersToUpdate.begin(); it != m_foldersToUpdate.end(); ++it)\r
{\r
workingPath = *it;\r
if ((DWORD(workingPath.GetCustomData()) < currentTicks)||(DWORD(workingPath.GetCustomData()) > (currentTicks + 200000)))\r
}\r
if ((!m_blockedPath.IsEmpty())&&(m_blockedPath.IsAncestorOf(workingPath)))\r
continue;\r
- if (!CSVNStatusCache::Instance().IsPathAllowed(workingPath))\r
+ if (!CGitStatusCache::Instance().IsPathAllowed(workingPath))\r
continue;\r
\r
ATLTRACE(_T("Crawling folder: %s\n"), workingPath.GetWinPath());\r
nCurrentCrawledpathIndex = 0;\r
}\r
InvalidateRect(hWnd, NULL, FALSE);\r
- CSVNStatusCache::Instance().WaitToRead();\r
+ CGitStatusCache::Instance().WaitToRead();\r
// Now, we need to visit this folder, to make sure that we know its 'most important' status\r
- CCachedDirectory * cachedDir = CSVNStatusCache::Instance().GetDirectoryCacheEntry(workingPath.GetDirectory());\r
+ CCachedDirectory * cachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath.GetDirectory());\r
// check if the path is monitored by the watcher. If it isn't, then we have to invalidate the cache\r
// for that path and add it to the watcher.\r
- if (!CSVNStatusCache::Instance().IsPathWatched(workingPath))\r
+ if (!CGitStatusCache::Instance().IsPathWatched(workingPath))\r
{\r
if (workingPath.HasAdminDir())\r
- CSVNStatusCache::Instance().AddPathToWatch(workingPath);\r
+ CGitStatusCache::Instance().AddPathToWatch(workingPath);\r
if (cachedDir)\r
cachedDir->Invalidate();\r
else\r
{\r
- CSVNStatusCache::Instance().Done();\r
- CSVNStatusCache::Instance().WaitToWrite();\r
- CSVNStatusCache::Instance().RemoveCacheForPath(workingPath);\r
+ CGitStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().WaitToWrite();\r
+ CGitStatusCache::Instance().RemoveCacheForPath(workingPath);\r
}\r
}\r
if (cachedDir)\r
m_bItemsAddedSinceLastCrawl = false;\r
}\r
}\r
- CSVNStatusCache::Instance().Done();\r
+ CGitStatusCache::Instance().Done();\r
}\r
}\r
}\r
return ret;\r
}\r
\r
-void CFolderCrawler::BlockPath(const CTSVNPath& path, DWORD ticks)\r
+void CFolderCrawler::BlockPath(const CTGitPath& path, DWORD ticks)\r
{\r
ATLTRACE(_T("block path %s from being crawled\n"), path.GetWinPath());\r
m_blockedPath = path;\r