本文整理汇总了C++中CCachedDirectory::GetStatusForMember方法的典型用法代码示例。如果您正苦于以下问题:C++ CCachedDirectory::GetStatusForMember方法的具体用法?C++ CCachedDirectory::GetStatusForMember怎么用?C++ CCachedDirectory::GetStatusForMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCachedDirectory
的用法示例。
在下文中一共展示了CCachedDirectory::GetStatusForMember方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStatusForPath
CStatusCacheEntry CSVNStatusCache::GetStatusForPath(const CTSVNPath& path, DWORD flags, bool bFetch /* = true */)
{
bool bRecursive = !!(flags & TSVNCACHE_FLAGS_RECUSIVE_STATUS);
// Check a very short-lived 'mini-cache' of the last thing we were asked for.
long now = (long)GetTickCount();
if(now-m_mostRecentExpiresAt < 0)
{
if(path.IsEquivalentToWithoutCase(m_mostRecentAskedPath))
{
return m_mostRecentStatus;
}
}
{
AutoLocker lock(m_critSec);
m_mostRecentAskedPath = path;
m_mostRecentExpiresAt = now+1000;
}
if (IsPathGood(path) && m_shellCache.IsPathAllowed(path.GetWinPath()))
{
// Stop the crawler starting on a new folder while we're doing this much more important task...
// Please note, that this may be a second "lock" used concurrently to the one in RemoveCacheForPath().
CCrawlInhibitor crawlInhibit(&m_folderCrawler);
CTSVNPath dirpath = path.GetContainingDirectory();
if (dirpath.IsEmpty())
dirpath = path.GetDirectory();
CCachedDirectory * cachedDir = GetDirectoryCacheEntry(dirpath);
if (cachedDir != NULL)
{
CStatusCacheEntry entry = cachedDir->GetStatusForMember(path, bRecursive, bFetch);
{
AutoLocker lock(m_critSec);
m_mostRecentStatus = entry;
return m_mostRecentStatus;
}
}
cachedDir = GetDirectoryCacheEntry(path.GetDirectory());
if (cachedDir != NULL)
{
CStatusCacheEntry entry = cachedDir->GetStatusForMember(path, bRecursive, bFetch);
{
AutoLocker lock(m_critSec);
m_mostRecentStatus = entry;
return m_mostRecentStatus;
}
}
}
AutoLocker lock(m_critSec);
m_mostRecentStatus = CStatusCacheEntry();
if (m_shellCache.ShowExcludedAsNormal() && path.IsDirectory() && m_shellCache.HasSVNAdminDir(path.GetWinPath(), true))
{
m_mostRecentStatus.ForceStatus(svn_wc_status_normal);
}
return m_mostRecentStatus;
}
示例2: GetStatusForPath
/* Fetch is false, means fetch status from cache */
CStatusCacheEntry CGitStatusCache::GetStatusForPath(const CTGitPath& path, DWORD flags, bool bFetch /* = true */)
{
bool bRecursive = !!(flags & TGITCACHE_FLAGS_RECUSIVE_STATUS);
// Check a very short-lived 'mini-cache' of the last thing we were asked for.
long now = (long)GetTickCount();
if(now-m_mostRecentExpiresAt < 0)
{
if(path.IsEquivalentToWithoutCase(m_mostRecentPath))
{
return m_mostRecentStatus;
}
}
{
AutoLocker lock(m_critSec);
m_mostRecentPath = path;
m_mostRecentExpiresAt = now + 1000;
}
if (IsPathGood(path))
{
// Stop the crawler starting on a new folder while we're doing this much more important task...
// Please note, that this may be a second "lock" used concurrently to the one in RemoveCacheForPath().
CCrawlInhibitor crawlInhibit(&m_folderCrawler);
CTGitPath dirpath = path.GetContainingDirectory();
if ((dirpath.IsEmpty()) || (!m_shellCache.IsPathAllowed(dirpath.GetWinPath())))
dirpath = path.GetDirectory();
CCachedDirectory * cachedDir = GetDirectoryCacheEntry(dirpath);
if (cachedDir != NULL)
{
//ATLTRACE(_T("GetStatusForMember %d\n"), bFetch);
CStatusCacheEntry entry = cachedDir->GetStatusForMember(path, bRecursive, bFetch);
{
AutoLocker lock(m_critSec);
m_mostRecentStatus = entry;
return m_mostRecentStatus;
}
}
}
else
{
// path is blocked for some reason: return the cached status if we have one
// we do here only a cache search, absolutely no disk access is allowed!
CCachedDirectory::ItDir itMap = m_directoryCache.find(path.GetDirectory());
if ((itMap != m_directoryCache.end())&&(itMap->second))
{
if (path.IsDirectory())
{
CStatusCacheEntry entry = itMap->second->GetOwnStatus(false);
AutoLocker lock(m_critSec);
m_mostRecentStatus = entry;
return m_mostRecentStatus;
}
else
{
// We've found this directory in the cache
CCachedDirectory * cachedDir = itMap->second;
CStatusCacheEntry entry = cachedDir->GetCacheStatusForMember(path);
{
AutoLocker lock(m_critSec);
m_mostRecentStatus = entry;
return m_mostRecentStatus;
}
}
}
}
AutoLocker lock(m_critSec);
ATLTRACE(_T("ignored no good path %s\n"), path.GetWinPath());
m_mostRecentStatus = CStatusCacheEntry();
if (m_shellCache.ShowExcludedAsNormal() && path.IsDirectory() && m_shellCache.HasGITAdminDir(path.GetWinPath(), true))
{
ATLTRACE(_T("force status %s\n"), path.GetWinPath());
m_mostRecentStatus.ForceStatus(git_wc_status_normal);
}
return m_mostRecentStatus;
}
示例3: GetStatusForMember
CStatusCacheEntry CCachedDirectory::GetStatusForMember(const CTSVNPath& path, bool bRecursive, bool bFetch /* = true */)
{
CStringA strCacheKey;
bool bThisDirectoryIsUnversioned = false;
bool bRequestForSelf = false;
if(path.IsEquivalentToWithoutCase(m_directoryPath))
{
bRequestForSelf = true;
}
// In all most circumstances, we ask for the status of a member of this directory.
ATLASSERT(m_directoryPath.IsEquivalentToWithoutCase(path.GetContainingDirectory()) || bRequestForSelf);
long long dbFileTime = CSVNStatusCache::Instance().WCRoots()->GetDBFileTime(m_directoryPath);
bool wcDbFileTimeChanged = (m_wcDbFileTime != dbFileTime);
if ( !wcDbFileTimeChanged )
{
if(m_wcDbFileTime == 0)
{
// We are a folder which is not in a working copy
bThisDirectoryIsUnversioned = true;
m_ownStatus.SetStatus(NULL, false, false);
// If a user removes the .svn directory, we get here with m_entryCache
// not being empty, but still us being unversioned
if (!m_entryCache.empty())
{
m_entryCache.clear();
}
ATLASSERT(m_entryCache.empty());
// However, a member *DIRECTORY* might be the top of WC
// so we need to ask them to get their own status
if(!path.IsDirectory())
{
if ((PathFileExists(path.GetWinPath()))||(bRequestForSelf))
return CStatusCacheEntry();
// the entry doesn't exist anymore!
// but we can't remove it from the cache here:
// the GetStatusForMember() method is called only with a read
// lock and not a write lock!
// So mark it for crawling, and let the crawler remove it
// later
CSVNStatusCache::Instance().AddFolderForCrawling(path.GetContainingDirectory());
return CStatusCacheEntry();
}
else
{
// If we're in the special case of a directory being asked for its own status
// and this directory is unversioned, then we should just return that here
if(bRequestForSelf)
{
return CStatusCacheEntry();
}
}
}
if (CSVNStatusCache::Instance().GetDirectoryCacheEntryNoCreate(path) != NULL)
{
// We don't have directory status in our cache
// Ask the directory if it knows its own status
CCachedDirectory * dirEntry = CSVNStatusCache::Instance().GetDirectoryCacheEntry(path);
if ((dirEntry)&&(dirEntry->IsOwnStatusValid()))
{
// To keep recursive status up to date, we'll request that children are all crawled again
// We have to do this because the directory watcher isn't very reliable (especially under heavy load)
// and also has problems with SUBSTed drives.
// If nothing has changed in those directories, this crawling is fast and only
// accesses two files for each directory.
if (bRecursive)
{
AutoLocker lock(dirEntry->m_critSec);
ChildDirStatus::const_iterator it;
for(it = dirEntry->m_childDirectories.begin(); it != dirEntry->m_childDirectories.end(); ++it)
{
CTSVNPath newpath;
CString winPath = CUnicodeUtils::GetUnicode (it->first);
newpath.SetFromWin(winPath, true);
CSVNStatusCache::Instance().AddFolderForCrawling(newpath);
}
}
return dirEntry->GetOwnStatus(bRecursive);
}
}
else
{
{
// if we currently are fetching the status of the directory
// we want the status for, we just return an empty entry here
// and don't wait for that fetching to finish.
// That's because fetching the status can take a *really* long
// time (e.g. if a commit is also in progress on that same
// directory), and we don't want to make the explorer appear
// to hang.
if ((!bFetch)&&(m_FetchingStatus))
{
if (m_directoryPath.IsAncestorOf(path))
//.........这里部分代码省略.........
示例4: WorkerThread
//.........这里部分代码省略.........
//a notification about that in the directory watcher,
//remove that here again - this is to prevent an endless loop
AutoLocker lock(m_critSec);
m_pathsToUpdate.erase(workingPath);
}
else if (workingPath.HasAdminDir())
{
if (!workingPath.Exists())
{
CAutoWriteLock writeLock(CGitStatusCache::Instance().GetGuard());
CGitStatusCache::Instance().RemoveCacheForPath(workingPath);
if (!workingPath.GetContainingDirectory().Exists())
continue;
else
workingPath = workingPath.GetContainingDirectory();
}
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": Updating path: %s\n", workingPath.GetWinPath());
{
AutoLocker print(critSec);
_sntprintf_s(szCurrentCrawledPath[nCurrentCrawledpathIndex], MAX_CRAWLEDPATHSLEN, _TRUNCATE, L"Updating path: %s", workingPath.GetWinPath());
++nCurrentCrawledpathIndex;
if (nCurrentCrawledpathIndex >= MAX_CRAWLEDPATHS)
nCurrentCrawledpathIndex = 0;
}
InvalidateRect(hWndHidden, nullptr, FALSE);
{
CAutoReadLock readLock(CGitStatusCache::Instance().GetGuard());
// Invalidate the cache of folders manually. The cache of files is invalidated
// automatically if the status is asked for it and the file times don't match
// anymore, so we don't need to manually invalidate those.
CCachedDirectory* cachedDir = CGitStatusCache::Instance().GetDirectoryCacheEntry(workingPath.GetDirectory());
if (cachedDir && workingPath.IsDirectory())
cachedDir->Invalidate();
if (cachedDir && cachedDir->GetStatusForMember(workingPath, bRecursive).GetEffectiveStatus() > git_wc_status_unversioned)
CGitStatusCache::Instance().UpdateShell(workingPath);
}
AutoLocker lock(m_critSec);
m_pathsToUpdate.erase(workingPath);
}
else
{
if (!workingPath.Exists())
{
CAutoWriteLock writeLock(CGitStatusCache::Instance().GetGuard());
CGitStatusCache::Instance().RemoveCacheForPath(workingPath);
}
}
}
if (!m_foldersToUpdate.empty())
{
{
AutoLocker lock(m_critSec);
m_bItemsAddedSinceLastCrawl = false;
// create a new CTGitPath object to make sure the cached flags are requested again.
// without this, a missing file/folder is still treated as missing even if it is available
// now when crawling.
workingPath = CTGitPath(m_foldersToUpdate.Pop().GetWinPath());
if ((!m_blockedPath.IsEmpty())&&(m_blockedPath.IsAncestorOf(workingPath)))
{
// move the path to the end of the list
m_foldersToUpdate.Push(workingPath);
if (m_foldersToUpdate.size() < 3)
Sleep(50);
continue;