-UINT CLogDlg::LogThread()\r
-{\r
-\r
- InterlockedExchange(&m_bThreadRunning, TRUE);\r
-\r
- //does the user force the cache to refresh (shift or control key down)?\r
- bool refresh = (GetKeyState (VK_CONTROL) < 0) \r
- || (GetKeyState (VK_SHIFT) < 0);\r
-\r
- //disable the "Get All" button while we're receiving\r
- //log messages.\r
- DialogEnableWindow(IDC_GETALL, FALSE);\r
- DialogEnableWindow(IDC_NEXTHUNDRED, FALSE);\r
- DialogEnableWindow(IDC_CHECK_STOPONCOPY, FALSE);\r
- DialogEnableWindow(IDC_INCLUDEMERGE, FALSE);\r
- DialogEnableWindow(IDC_STATBUTTON, FALSE);\r
- DialogEnableWindow(IDC_REFRESH, FALSE);\r
- \r
- CString temp;\r
- temp.LoadString(IDS_PROGRESSWAIT);\r
- m_LogList.ShowText(temp, true);\r
- // change the text of the close button to "Cancel" since now the thread\r
- // is running, and simply closing the dialog doesn't work.\r
- if (!GetDlgItem(IDOK)->IsWindowVisible())\r
- {\r
- temp.LoadString(IDS_MSGBOX_CANCEL);\r
- SetDlgItemText(IDCANCEL, temp);\r
- }\r
- // We use a progress bar while getting the logs\r
- m_LogProgress.SetRange32(0, 100);\r
- m_LogProgress.SetPos(0);\r
- GetDlgItem(IDC_PROGRESS)->ShowWindow(TRUE);\r
-// git_revnum_t r = -1;\r
- \r
- // get the repository root url, because the changed-files-list has the\r
- // paths shown there relative to the repository root.\r
-// CTGitPath rootpath;\r
-// BOOL succeeded = GetRootAndHead(m_path, rootpath, r);\r
-\r
-// m_sRepositoryRoot = rootpath.GetGitPathString();\r
-// m_sURL = m_path.GetGitPathString();\r
-\r
- // we need the UUID to unambigously identify the log cache\r
-// if (logCachePool.IsEnabled())\r
-// m_sUUID = logCachePool.GetRepositoryInfo().GetRepositoryUUID (rootpath);\r
-\r
- // if the log dialog is started from a working copy, we need to turn that\r
- // local path into an url here\r
-// if (succeeded)\r
-// {\r
-// if (!m_path.IsUrl())\r
-// {\r
-// m_sURL = GetURLFromPath(m_path);\r
-\r
- // The URL is escaped because Git::logReceiver\r
- // returns the path in a native format\r
-// m_sURL = CPathUtils::PathUnescape(m_sURL);\r
- // }\r
-// m_sRelativeRoot = m_sURL.Mid(CPathUtils::PathUnescape(m_sRepositoryRoot).GetLength());\r
-// m_sSelfRelativeURL = m_sRelativeRoot;\r
- // }\r
-#if 0\r
- if (succeeded && !m_mergePath.IsEmpty() && m_mergedRevs.empty())\r
- {\r
- // in case we got a merge path set, retrieve the merge info\r
- // of that path and check whether one of the merge URLs\r
- // match the URL we show the log for.\r
- GitPool localpool(pool);\r
- git_error_clear(Err);\r
- apr_hash_t * mergeinfo = NULL;\r
- if (git_client_mergeinfo_get_merged (&mergeinfo, m_mergePath.GetGitApiPath(localpool), GitRev(GitRev::REV_WC), m_pctx, localpool) == NULL)\r
- {\r
- // now check the relative paths\r
- apr_hash_index_t *hi;\r
- const void *key;\r
- void *val;\r
-\r
- if (mergeinfo)\r
- {\r
- for (hi = apr_hash_first(localpool, mergeinfo); hi; hi = apr_hash_next(hi))\r
- {\r
- apr_hash_this(hi, &key, NULL, &val);\r
- if (m_sURL.Compare(CUnicodeUtils::GetUnicode((char*)key)) == 0)\r
- {\r
- apr_array_header_t * arr = (apr_array_header_t*)val;\r
- if (val)\r
- {\r
- for (long i=0; i<arr->nelts; ++i)\r
- {\r
- git_merge_range_t * pRange = APR_ARRAY_IDX(arr, i, git_merge_range_t*);\r
- if (pRange)\r
- {\r
- for (git_revnum_t r=pRange->start+1; r<=pRange->end; ++r)\r
- {\r
- m_mergedRevs.insert(r);\r
- }\r
- }\r
- }\r
- }\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- m_LogProgress.SetPos(1);\r
- if (m_startrev == GitRev::REV_HEAD)\r
- {\r
- m_startrev = r;\r
- }\r
- if (m_endrev == GitRev::REV_HEAD)\r
- {\r
- m_endrev = r;\r
- }\r
-\r
- if (m_limit != 0)\r
- {\r
- m_limitcounter = m_limit;\r
- m_LogProgress.SetRange32(0, m_limit);\r
- }\r
- else\r
- m_LogProgress.SetRange32(m_endrev, m_startrev);\r
- \r
- if (!m_pegrev.IsValid())\r
- m_pegrev = m_startrev;\r
- size_t startcount = m_logEntries.size();\r
- m_lowestRev = -1;\r
- m_bStrictStopped = false;\r
-\r
- if (succeeded)\r
- {\r
- succeeded = ReceiveLog (CTGitPathList(m_path), m_pegrev, m_startrev, m_endrev, m_limit, m_bStrict, m_bIncludeMerges, refresh);\r
- if ((!succeeded)&&(!m_path.IsUrl()))\r
- {\r
- // try again with REV_WC as the start revision, just in case the path doesn't\r
- // exist anymore in HEAD\r
- succeeded = ReceiveLog(CTGitPathList(m_path), GitRev(), GitRev::REV_WC, m_endrev, m_limit, m_bStrict, m_bIncludeMerges, refresh);\r
- }\r
- }\r
- m_LogList.ClearText();\r
- if (!succeeded)\r
- {\r
- m_LogList.ShowText(GetLastErrorMessage(), true);\r
- }\r
- else\r
- {\r
- if (!m_wcRev.IsValid())\r
- {\r
- // fetch the revision the wc path is on so we can mark it\r
- CTGitPath revWCPath = m_ProjectProperties.GetPropsPath();\r
- if (!m_path.IsUrl())\r
- revWCPath = m_path;\r
- if (DWORD(CRegDWORD(_T("Software\\TortoiseGit\\RecursiveLogRev"), FALSE)))\r
- {\r
- git_revnum_t minrev, maxrev;\r
- bool switched, modified, sparse;\r
- GetWCRevisionStatus(revWCPath, true, minrev, maxrev, switched, modified, sparse);\r
- if (maxrev)\r
- m_wcRev = maxrev;\r
- }\r
- else\r
- {\r
- CTGitPath dummypath;\r
- GitStatus status;\r
- git_wc_status2_t * stat = status.GetFirstFileStatus(revWCPath, dummypath, false, git_depth_empty);\r
- if (stat && stat->entry && stat->entry->cmt_rev)\r
- m_wcRev = stat->entry->cmt_rev;\r
- if (stat && stat->entry && (stat->entry->kind == git_node_dir))\r
- m_wcRev = stat->entry->revision;\r
- }\r
- }\r
- }\r
- if (m_bStrict && (m_lowestRev>1) && ((m_limit>0) ? ((startcount + m_limit)>m_logEntries.size()) : (m_endrev<m_lowestRev)))\r
- m_bStrictStopped = true;\r
- m_LogList.SetItemCountEx(ShownCountWithStopped());\r
-\r
- m_timFrom = (__time64_t(m_tFrom));\r
- m_timTo = (__time64_t(m_tTo));\r
- m_DateFrom.SetRange(&m_timFrom, &m_timTo);\r
- m_DateTo.SetRange(&m_timFrom, &m_timTo);\r
- m_DateFrom.SetTime(&m_timFrom);\r
- m_DateTo.SetTime(&m_timTo);\r
-#endif\r
- DialogEnableWindow(IDC_GETALL, TRUE);\r
- m_LogList.ClearText();\r