svn_error_t * CCachedDirectory::GetStatusCallback(void *baton, const char *path, const svn_client_status_t *status, apr_pool_t * pool) { CCachedDirectory* pThis = (CCachedDirectory*)baton; if (path == NULL) return SVN_NO_ERROR; CTSVNPath svnPath; bool forceNormal = false; bool needsLock = false; const svn_wc_status_kind nodeStatus = status->node_status; if(status->versioned) { if ((nodeStatus != svn_wc_status_none)&&(nodeStatus != svn_wc_status_ignored)) svnPath.SetFromSVN(path, (status->kind == svn_node_dir)); else svnPath.SetFromSVN(path); if(svnPath.IsDirectory()) { if(!svnPath.IsEquivalentToWithoutCase(pThis->m_directoryPath)) { // Make sure we know about this child directory // This initial status value is likely to be overwritten from below at some point svn_wc_status_kind s = nodeStatus; if (status->conflicted) s = SVNStatus::GetMoreImportant(s, svn_wc_status_conflicted); CCachedDirectory * cdir = CSVNStatusCache::Instance().GetDirectoryCacheEntryNoCreate(svnPath); if (cdir) { // This child directory is already in our cache! // So ask this dir about its recursive status svn_wc_status_kind st = SVNStatus::GetMoreImportant(s, cdir->GetCurrentFullStatus()); pThis->SetChildStatus(svnPath, st); } else { // the child directory is not in the cache. Create a new entry for it in the cache which is // initially 'unversioned'. But we added that directory to the crawling list above, which // means the cache will be updated soon. CSVNStatusCache::Instance().GetDirectoryCacheEntry(svnPath); pThis->SetChildStatus(svnPath, s); } } } else { // only fetch the svn:needs-lock property if the status of this file is 'normal', because // if the status is something else, the needs-lock overlay won't show up anyway if ((pThis->m_pCtx)&&(nodeStatus == svn_wc_status_normal)) { const svn_string_t * value = NULL; svn_error_t * err = svn_wc_prop_get2(&value, pThis->m_pCtx->wc_ctx, path, "svn:needs-lock", pool, pool); if ((err==NULL) && value) needsLock = true; if (err) svn_error_clear(err); } } } else { if ((status->kind != svn_node_unknown)&&(status->kind != svn_node_none)) svnPath.SetFromSVN(path, status->kind == svn_node_dir); else svnPath.SetFromSVN(path); // Subversion returns no 'entry' field for versioned folders if they're // part of another working copy (nested layouts). // So we have to make sure that such an 'unversioned' folder really // is unversioned. if (((nodeStatus == svn_wc_status_unversioned)||(nodeStatus == svn_wc_status_ignored))&&(!svnPath.IsEquivalentToWithoutCase(pThis->m_directoryPath))&&(svnPath.IsDirectory())) { if (svnPath.IsWCRoot()) { CSVNStatusCache::Instance().AddFolderForCrawling(svnPath); // Mark the directory as 'versioned' (status 'normal' for now). // This initial value will be overwritten from below some time later pThis->SetChildStatus(svnPath, svn_wc_status_normal); // Make sure the entry is also in the cache CSVNStatusCache::Instance().GetDirectoryCacheEntry(svnPath); // also mark the status in the status object as normal forceNormal = true; } else { pThis->SetChildStatus(svnPath, nodeStatus); } } else if (nodeStatus == svn_wc_status_external) { if ((status->kind == svn_node_dir) || (svnPath.IsDirectory())) { CSVNStatusCache::Instance().AddFolderForCrawling(svnPath); // Mark the directory as 'versioned' (status 'normal' for now). // This initial value will be overwritten from below some time later pThis->SetChildStatus(svnPath, svn_wc_status_normal); // we have added a directory to the child-directory list of this // directory. We now must make sure that this directory also has // an entry in the cache. CSVNStatusCache::Instance().GetDirectoryCacheEntry(svnPath); // also mark the status in the status object as normal forceNormal = true; } } else { if (svnPath.IsDirectory()) { svn_wc_status_kind s = nodeStatus; if (status->conflicted) s = SVNStatus::GetMoreImportant(s, svn_wc_status_conflicted); pThis->SetChildStatus(svnPath, s); } } } pThis->AddEntry(svnPath, status, needsLock, forceNormal); return SVN_NO_ERROR; }
BOOL CCachedDirectory::GetStatusCallback(const CString & path, git_wc_status_kind status,bool isDir, void *, bool assumeValid, bool skipWorktree) { git_wc_status2_t _status; git_wc_status2_t *status2 = &_status; status2->prop_status = status2->text_status = status; status2->assumeValid = assumeValid; status2->skipWorktree = skipWorktree; CTGitPath gitPath(path); CCachedDirectory *pThis = CGitStatusCache::Instance().GetDirectoryCacheEntry(gitPath.GetContainingDirectory()); if(pThis == NULL) return FALSE; // if(status->entry) { if (isDir) { /*gitpath is directory*/ //if ( !gitPath.IsEquivalentToWithoutCase(pThis->m_directoryPath) ) { if (!gitPath.Exists()) { CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": Miss dir %s \n"), gitPath.GetWinPath()); pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, git_wc_status_deleted); } if ( status < git_wc_status_normal) { if( ::PathFileExists(path+_T("\\.git"))) { // this is submodule CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": skip submodule %s\n"), path); return FALSE; } } if (pThis->m_bRecursive) { // Add any versioned directory, which is not our 'self' entry, to the list for having its status updated //OutputDebugStringA("AddFolderCrawl: ");OutputDebugStringW(svnPath.GetWinPathString());OutputDebugStringA("\r\n"); if (status >= git_wc_status_normal || (CGitStatusCache::Instance().IsUnversionedAsModified() && status == git_wc_status_unversioned)) CGitStatusCache::Instance().AddFolderForCrawling(gitPath); } // Make sure we know about this child directory // This initial status value is likely to be overwritten from below at some point git_wc_status_kind s = GitStatus::GetMoreImportant(status2->text_status, status2->prop_status); // folders must not be displayed as added or deleted only as modified if (s == git_wc_status_deleted || s == git_wc_status_added) s = git_wc_status_modified; CCachedDirectory * cdir = CGitStatusCache::Instance().GetDirectoryCacheEntryNoCreate(gitPath); if (cdir) { // This child directory is already in our cache! // So ask this dir about its recursive status git_wc_status_kind st = GitStatus::GetMoreImportant(s, cdir->GetCurrentFullStatus()); AutoLocker lock(pThis->m_critSec); pThis->m_childDirectories[gitPath] = st; CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": call 1 Update dir %s %d\n"), gitPath.GetWinPath(), st); } else { AutoLocker lock(pThis->m_critSec); // the child directory is not in the cache. Create a new entry for it in the cache which is // initially 'unversioned'. But we added that directory to the crawling list above, which // means the cache will be updated soon. CGitStatusCache::Instance().GetDirectoryCacheEntry(gitPath); pThis->m_childDirectories[gitPath] = s; CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": call 2 Update dir %s %d\n"), gitPath.GetWinPath(), s); } } } else /* gitpath is file*/ { // Keep track of the most important status of all the files in this directory // Don't include subdirectories in this figure, because they need to provide their // own 'most important' value pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, status2->text_status); pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, status2->prop_status); if ((status2->text_status == git_wc_status_unversioned) && (CGitStatusCache::Instance().IsUnversionedAsModified())) { // treat unversioned files as modified if (pThis->m_mostImportantFileStatus != git_wc_status_added) pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, git_wc_status_modified); } } } pThis->AddEntry(gitPath, status2); return FALSE; }
git_error_t * CCachedDirectory::GetStatusCallback(void *baton, const char *path, git_wc_status2_t *status) { CCachedDirectory* pThis = (CCachedDirectory*)baton; if (path == NULL) return 0; CTGitPath svnPath; if(status->entry) { if ((status->text_status != git_wc_status_none)&&(status->text_status != git_wc_status_missing)) svnPath.SetFromSVN(path, (status->entry->kind == svn_node_dir)); else svnPath.SetFromSVN(path); if(svnPath.IsDirectory()) { if(!svnPath.IsEquivalentToWithoutCase(pThis->m_directoryPath)) { if (pThis->m_bRecursive) { // Add any versioned directory, which is not our 'self' entry, to the list for having its status updated CGitStatusCache::Instance().AddFolderForCrawling(svnPath); } // Make sure we know about this child directory // This initial status value is likely to be overwritten from below at some point git_wc_status_kind s = GitStatus::GetMoreImportant(status->text_status, status->prop_status); CCachedDirectory * cdir = CGitStatusCache::Instance().GetDirectoryCacheEntryNoCreate(svnPath); if (cdir) { // This child directory is already in our cache! // So ask this dir about its recursive status git_wc_status_kind st = GitStatus::GetMoreImportant(s, cdir->GetCurrentFullStatus()); AutoLocker lock(pThis->m_critSec); pThis->m_childDirectories[svnPath] = st; } else { // the child directory is not in the cache. Create a new entry for it in the cache which is // initially 'unversioned'. But we added that directory to the crawling list above, which // means the cache will be updated soon. CGitStatusCache::Instance().GetDirectoryCacheEntry(svnPath); AutoLocker lock(pThis->m_critSec); pThis->m_childDirectories[svnPath] = s; } } } else { // Keep track of the most important status of all the files in this directory // Don't include subdirectories in this figure, because they need to provide their // own 'most important' value pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, status->text_status); pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, status->prop_status); if (((status->text_status == git_wc_status_unversioned)||(status->text_status == git_wc_status_none)) &&(CGitStatusCache::Instance().IsUnversionedAsModified())) { // treat unversioned files as modified if (pThis->m_mostImportantFileStatus != git_wc_status_added) pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, git_wc_status_modified); } } } else { svnPath.SetFromSVN(path); // Subversion returns no 'entry' field for versioned folders if they're // part of another working copy (nested layouts). // So we have to make sure that such an 'unversioned' folder really // is unversioned. if (((status->text_status == git_wc_status_unversioned)||(status->text_status == git_wc_status_missing))&&(!svnPath.IsEquivalentToWithoutCase(pThis->m_directoryPath))&&(svnPath.IsDirectory())) { if (svnPath.HasAdminDir()) { CGitStatusCache::Instance().AddFolderForCrawling(svnPath); // Mark the directory as 'versioned' (status 'normal' for now). // This initial value will be overwritten from below some time later { AutoLocker lock(pThis->m_critSec); pThis->m_childDirectories[svnPath] = git_wc_status_normal; } // Make sure the entry is also in the cache CGitStatusCache::Instance().GetDirectoryCacheEntry(svnPath); // also mark the status in the status object as normal status->text_status = git_wc_status_normal; } } else if (status->text_status == git_wc_status_external) { CGitStatusCache::Instance().AddFolderForCrawling(svnPath); // Mark the directory as 'versioned' (status 'normal' for now). // This initial value will be overwritten from below some time later { AutoLocker lock(pThis->m_critSec); pThis->m_childDirectories[svnPath] = git_wc_status_normal; } // we have added a directory to the child-directory list of this // directory. We now must make sure that this directory also has // an entry in the cache. CGitStatusCache::Instance().GetDirectoryCacheEntry(svnPath); // also mark the status in the status object as normal status->text_status = git_wc_status_normal; } else { if (svnPath.IsDirectory()) { AutoLocker lock(pThis->m_critSec); pThis->m_childDirectories[svnPath] = GitStatus::GetMoreImportant(status->text_status, status->prop_status); } else if ((CGitStatusCache::Instance().IsUnversionedAsModified())&&(status->text_status != git_wc_status_missing)) { // make this unversioned item change the most important status of this // folder to modified if it doesn't already have another status if (pThis->m_mostImportantFileStatus != git_wc_status_added) pThis->m_mostImportantFileStatus = GitStatus::GetMoreImportant(pThis->m_mostImportantFileStatus, git_wc_status_modified); } } } pThis->AddEntry(svnPath, status); return 0; }