本文整理汇总了C++中CCachedDirectory::UpdateCurrentStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ CCachedDirectory::UpdateCurrentStatus方法的具体用法?C++ CCachedDirectory::UpdateCurrentStatus怎么用?C++ CCachedDirectory::UpdateCurrentStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCachedDirectory
的用法示例。
在下文中一共展示了CCachedDirectory::UpdateCurrentStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStatusFromGit
CStatusCacheEntry CCachedDirectory::GetStatusFromGit(const CTGitPath &path, CString sProjectRoot)
{
CString subpaths = path.GetGitPathString();
if(subpaths.GetLength() >= sProjectRoot.GetLength())
{
if(subpaths[sProjectRoot.GetLength()] == _T('/'))
subpaths=subpaths.Right(subpaths.GetLength() - sProjectRoot.GetLength()-1);
else
subpaths=subpaths.Right(subpaths.GetLength() - sProjectRoot.GetLength());
}
GitStatus *pGitStatus = &CGitStatusCache::Instance().m_GitStatus;
UNREFERENCED_PARAMETER(pGitStatus);
bool isVersion =true;
pGitStatus->IsUnderVersionControl(sProjectRoot, subpaths, path.IsDirectory(), &isVersion);
if(!isVersion)
{ //untracked file
bool isDir = path.IsDirectory();
bool isIgnoreFileChanged = pGitStatus->HasIgnoreFilesChanged(sProjectRoot, subpaths, isDir);
if( isIgnoreFileChanged)
{
pGitStatus->LoadIgnoreFile(sProjectRoot, subpaths, isDir);
}
if (isDir)
{
CCachedDirectory * dirEntry = CGitStatusCache::Instance().GetDirectoryCacheEntry(path,
false); /* we needn't watch untracked directory*/
if(dirEntry)
{
AutoLocker lock(dirEntry->m_critSec);
git_wc_status_kind dirstatus = dirEntry->GetCurrentFullStatus() ;
if (CGitStatusCache::Instance().IsUnversionedAsModified() || dirstatus == git_wc_status_none || dirstatus >= git_wc_status_normal || isIgnoreFileChanged)
{/* status have not initialized*/
bool isignore = false;
pGitStatus->IsIgnore(sProjectRoot, subpaths, &isignore, isDir);
if (!isignore && CGitStatusCache::Instance().IsUnversionedAsModified())
{
dirEntry->EnumFiles(path, TRUE);
dirEntry->UpdateCurrentStatus();
return CStatusCacheEntry(dirEntry->GetCurrentFullStatus());
}
git_wc_status2_t status2;
status2.text_status = status2.prop_status =
(isignore? git_wc_status_ignored:git_wc_status_unversioned);
// we do not know anything about files here, all we know is that there are not versioned files in this dir
dirEntry->m_mostImportantFileStatus = git_wc_status_none;
dirEntry->m_ownStatus.SetKind(git_node_dir);
dirEntry->m_ownStatus.SetStatus(&status2);
dirEntry->m_currentFullStatus = status2.text_status;
}
return dirEntry->m_ownStatus;
}
}
else /* path is file */
{
AutoLocker lock(m_critSec);
CString strCacheKey = GetCacheKey(path);
if (strCacheKey.IsEmpty())
return CStatusCacheEntry();
CacheEntryMap::iterator itMap = m_entryCache.find(strCacheKey);
if(itMap == m_entryCache.end() || isIgnoreFileChanged)
{
git_wc_status2_t status2;
bool isignore = false;
pGitStatus->IsIgnore(sProjectRoot, subpaths, &isignore, isDir);
status2.text_status = status2.prop_status =
(isignore? git_wc_status_ignored:git_wc_status_unversioned);
AddEntry(path, &status2);
return m_entryCache[strCacheKey];
}
else
{
return itMap->second;
}
}
return CStatusCacheEntry();
}
else
{
EnumFiles(path, TRUE);
UpdateCurrentStatus();
if (!path.IsDirectory())
return GetCacheStatusForMember(path);
return CStatusCacheEntry(m_ownStatus);
}
}