本文整理汇总了C++中CCachedDirectory::GetOwnStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ CCachedDirectory::GetOwnStatus方法的具体用法?C++ CCachedDirectory::GetOwnStatus怎么用?C++ CCachedDirectory::GetOwnStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCachedDirectory
的用法示例。
在下文中一共展示了CCachedDirectory::GetOwnStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStatusFromCache
CStatusCacheEntry CCachedDirectory::GetStatusFromCache(const CTGitPath& path, bool bRecursive)
{
if(path.IsDirectory())
{
// We don't have directory status in our cache
// Ask the directory if it knows its own status
CCachedDirectory * dirEntry = CGitStatusCache::Instance().GetDirectoryCacheEntry(path);
if( dirEntry)
{
if (dirEntry->IsOwnStatusValid())
return dirEntry->GetOwnStatus(bRecursive);
else
{
/* cache have outof date, need crawl again*/
/*AutoLocker lock(dirEntry->m_critSec);
ChildDirStatus::const_iterator it;
for(it = dirEntry->m_childDirectories.begin(); it != dirEntry->m_childDirectories.end(); ++it)
{
CGitStatusCache::Instance().AddFolderForCrawling(it->first);
}*/
CGitStatusCache::Instance().AddFolderForCrawling(path);
/*Return old status during crawling*/
return dirEntry->GetOwnStatus(bRecursive);
}
}
else
{
CGitStatusCache::Instance().AddFolderForCrawling(path);
}
return CStatusCacheEntry();
}
else
{
//All file ignored if under ignore directory
if (m_ownStatus.GetEffectiveStatus() == git_wc_status_ignored)
return CStatusCacheEntry(git_wc_status_ignored);
if (m_ownStatus.GetEffectiveStatus() == git_wc_status_unversioned)
return CStatusCacheEntry(git_wc_status_unversioned);
// Look up a file in our own cache
AutoLocker lock(m_critSec);
CString strCacheKey = GetCacheKey(path);
CacheEntryMap::iterator itMap = m_entryCache.find(strCacheKey);
if(itMap != m_entryCache.end())
{
// We've hit the cache - check for timeout
if(!itMap->second.HasExpired((long)GetTickCount()))
{
if(itMap->second.DoesFileTimeMatch(path.GetLastWriteTime()))
{
if ((itMap->second.GetEffectiveStatus()!=git_wc_status_missing)||(!PathFileExists(path.GetWinPath())))
{
// Note: the filetime matches after a modified has been committed too.
// So in that case, we would return a wrong status (e.g. 'modified' instead
// of 'normal') here.
return itMap->second;
}
}
}
}
CGitStatusCache::Instance().AddFolderForCrawling(path.GetContainingDirectory());
return CStatusCacheEntry();
}
}
示例2: 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))
//.........这里部分代码省略.........