void CRevisionGraphDlg::UpdateFullHistory()
{
    m_Graph.SetDlgTitle (false);

    SVN svn;
    LogCache::CRepositoryInfo& cachedProperties
        = svn.GetLogCachePool()->GetRepositoryInfo();
    CString root = m_Graph.m_state.GetRepositoryRoot();
    CString uuid = m_Graph.m_state.GetRepositoryUUID();

    cachedProperties.ResetHeadRevision (uuid, root);

    m_bFetchLogs = true;
    StartWorkerThread();
}
void CSettingsLogCaches::OnBnClickedExport()
{
    TRepo repo = GetSelectedRepo();
    if (!repo.first.IsEmpty())
    {
        CString path;
        if (CAppUtils::FileOpenSave(path, NULL, IDS_SETTINGS_LOGCACHE_EXPORT, IDS_LOGCACHE_EXPORTFILTER, false, CString(), GetSafeHwnd()))
        {
            SVN svn;
            CCachedLogInfo* cache
                = svn.GetLogCachePool()->GetCache (repo.second, repo.first);
            CCSVWriter writer;
            writer.Write(*cache, (LPCTSTR)path);
        }
    }
}
void CSettingsLogCaches::FillRepositoryList()
{
    int count = m_cRepositoryList.GetItemCount();
    while (count > 0)
        m_cRepositoryList.DeleteItem (--count);

    SVN svn;
    CLogCachePool* caches = svn.GetLogCachePool();
    repos = caches->GetRepositoryURLs();

    for (IT iter = repos.begin(), end = repos.end(); iter != end; ++iter, ++count)
    {
        CString url = iter->first;

        m_cRepositoryList.InsertItem (count, url);
        size_t fileSize = caches->FileSize (iter->second, url) / 1024;

        CString sizeText;
        sizeText.Format(L"%Iu", fileSize);
        m_cRepositoryList.SetItemText (count, 1, sizeText);
    }
}
UINT CSettingsLogCaches::WorkerThread(LPVOID pVoid)
{
    CCrashReportThread crashthread;
    CSettingsLogCaches* dialog = (CSettingsLogCaches*)pVoid;
    InterlockedExchange(&dialog->m_bThreadRunning, TRUE);

    CoInitialize (NULL);

    dialog->DialogEnableWindow(IDC_CACHEUPDATE, false);

    dialog->progress = new CProgressDlg();
    dialog->progress->SetTitle(IDS_SETTINGS_LOGCACHE_UPDATETITLE);
    dialog->progress->SetCancelMsg(IDS_REVGRAPH_PROGCANCEL);
    dialog->progress->SetTime();
    dialog->progress->ShowModeless(dialog->m_hWnd);

    // we have to get the log from the repository root

    SVN svn;
    svn.SetPromptParentWindow(dialog->GetSafeHwnd());
    CLogCachePool* caches = svn.GetLogCachePool();
    CRepositoryInfo& info = caches->GetRepositoryInfo();

    TRepo repo = dialog->GetSelectedRepo();
    CTSVNPath urlpath;
    urlpath.SetFromSVN (repo.first);

    dialog->headRevision = info.GetHeadRevision (repo.second, urlpath);
    dialog->progress->SetProgress (0, dialog->headRevision);

    apr_pool_t *pool = svn_pool_create(NULL);

    try
    {
        CSVNLogQuery svnQuery (svn.GetSVNClientContext(), pool);
        CCacheLogQuery query (caches, &svnQuery);

        query.Log ( CTSVNPathList (urlpath)
                  , dialog->headRevision
                  , dialog->headRevision
                  , SVNRev(0)
                  , 0
                  , false       // strictNodeHistory
                  , dialog
                  , true        // includeChanges
                  , false       // includeMerges
                  , true        // includeStandardRevProps
                  , true        // includeUserRevProps
                  , TRevPropNames());
    }
    catch (SVNError&)
    {
    }

    caches->Flush();
    svn_pool_destroy (pool);

    if (dialog->progress)
    {
        dialog->progress->Stop();
        delete dialog->progress;
        dialog->progress = NULL;
    }

    CoUninitialize();

    dialog->PostMessage (WM_REFRESH_REPOSITORYLIST);

    dialog->DialogEnableWindow(IDC_CACHEUPDATE, true);

    InterlockedExchange(&dialog->m_bThreadRunning, FALSE);
    return 0;
}