From: Frank Li Date: Mon, 18 Jan 2010 10:13:36 +0000 (+0800) Subject: Fix GitBlame window PropertiesWnd parent info wrong X-Git-Url: http://git.osdn.net/view?p=tortoisegit%2FTortoiseGitJp.git;a=commitdiff_plain;h=a093c24d85d54de60a1951d5f35b09767ac21ab2 Fix GitBlame window PropertiesWnd parent info wrong Signed-off-by: Frank Li --- diff --git a/src/Git/GitHash.h b/src/Git/GitHash.h index f61e3a8..4d65ba7 100644 --- a/src/Git/GitHash.h +++ b/src/Git/GitHash.h @@ -91,6 +91,10 @@ public: return memcmp(left.m_hash, right.m_hash, GIT_HASH_SIZE) > 0; } + friend bool operator != (const CGitHash& left, const CGitHash& right) + { + return memcmp(left.m_hash, right.m_hash, GIT_HASH_SIZE) != 0; + } #if defined(_MFC_VER) friend CArchive& AFXAPI operator<<(CArchive& ar, CGitHash& hash) { diff --git a/src/TortoiseGitBlame/PropertiesWnd.cpp b/src/TortoiseGitBlame/PropertiesWnd.cpp index 36d9afc..edebff3 100644 --- a/src/TortoiseGitBlame/PropertiesWnd.cpp +++ b/src/TortoiseGitBlame/PropertiesWnd.cpp @@ -374,25 +374,27 @@ void CPropertiesWnd::UpdateProperties(GitRev *rev) CString parentsubject; int index; - if( pLogEntry->m_HashMap.find(rev->m_ParentHash[i]) == pLogEntry->m_HashMap.end() ) + GitRev *p =NULL; + + if( pLogEntry->m_pLogCache->m_HashMap.find(rev->m_ParentHash[i]) == pLogEntry->m_pLogCache->m_HashMap.end()) { - index = -1; + p=NULL; } else { - index=pLogEntry->m_HashMap[rev->m_ParentHash[i]]; + p= &pLogEntry->m_pLogCache->m_HashMap[rev->m_ParentHash[i]] ; } - if(index>=0) - parentsubject=pLogEntry->GetGitRevAt(index).m_Subject; + if(p) + parentsubject=p->m_Subject; str.Format(_T("%d - %s \n %s"),i,rev->m_ParentHash[i].ToString(),parentsubject); - CMFCPropertyGridProperty*p=new CMFCPropertyGridProperty( + CMFCPropertyGridProperty*pProtery=new CMFCPropertyGridProperty( rev->m_ParentHash[i].ToString().Left(8), parentsubject, str ); - m_ParentGroup->AddSubItem(p); + m_ParentGroup->AddSubItem(pProtery); m_ParentGroup->Expand(); } for(int i=0;iGetSubItemsCount();i++) diff --git a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp index 8ba2b5e..d686479 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp @@ -1086,11 +1086,11 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC) oldfont = (HFONT)::SelectObject(hDC, m_font); ::SetBkColor(hDC, m_windowcolor); ::SetTextColor(hDC, m_textcolor); - if (m_CommitHash[i].GetLength()>0) + if (!m_CommitHash[i].IsEmpty()) { //if (m_CommitHash[i].Compare(m_MouseHash)==0) // ::SetBkColor(hDC, m_mouseauthorcolor); - if (m_CommitHash[i].Compare(m_SelectedHash)==0) + if (m_CommitHash[i] == m_SelectedHash ) { ::SetBkColor(hDC, m_selectedauthorcolor); ::SetTextColor(hDC, m_texthighlightcolor); @@ -2591,7 +2591,7 @@ void CTortoiseGitBlameView::FocusOn(GitRev *pRev) int i; for(i=0;im_CommitHash.ToString() == m_CommitHash[i] ) + if( pRev->m_CommitHash == m_CommitHash[i] ) break; } this->GotoLine(i); @@ -2721,7 +2721,7 @@ void CTortoiseGitBlameView::OnViewPrev() FindNextLine(this->m_SelectedHash,true); } -int CTortoiseGitBlameView::FindNextLine(CString CommitHash,bool bUpOrDown) +int CTortoiseGitBlameView::FindNextLine(CGitHash CommitHash,bool bUpOrDown) { LONG_PTR line = SendEditor(SCI_GETFIRSTVISIBLELINE); LONG_PTR startline =line; diff --git a/src/TortoiseGitBlame/TortoiseGitBlameView.h b/src/TortoiseGitBlame/TortoiseGitBlameView.h index 48082fd..1e4cec4 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameView.h +++ b/src/TortoiseGitBlame/TortoiseGitBlameView.h @@ -110,8 +110,8 @@ protected: afx_msg void OnViewNext(); afx_msg void OnViewPrev(); - int FindNextLine(CString commithash, bool bUpOrDown=false); - int FindFirstLine(CString commithash, int line) + int FindNextLine(CGitHash commithash, bool bUpOrDown=false); + int FindFirstLine(CGitHash commithash, int line) { while(line>=0) { @@ -189,8 +189,8 @@ public: LONG m_MouseLine; LONG m_selectedrev; LONG m_selectedorigrev; - CString m_SelectedHash; - CString m_selecteddate; + CGitHash m_SelectedHash; + CGitHash m_selecteddate; static long m_gotoline; long m_lowestrev; long m_highestrev; @@ -202,7 +202,7 @@ public: // std::vector m_Origrevs; std::vector m_Dates; std::vector m_Authors; - std::vector m_CommitHash; + std::vector m_CommitHash; std::map m_NoListCommit; diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 294f30e..3314727 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -2074,7 +2074,7 @@ UINT CGitLogListBase::LogThread() pRev->m_Files.Clear(); pRev->m_ParentHash.clear(); pRev->m_ParentHash.push_back(m_HeadHash); - g_Git.GetCommitDiffList(pRev->m_CommitHash.ToString(),this->m_HeadHash, pRev->m_Files); + g_Git.GetCommitDiffList(pRev->m_CommitHash.ToString(),this->m_HeadHash.ToString(), pRev->m_Files); pRev->m_Action =0; for(int j=0;j< pRev->m_Files.GetCount();j++) diff --git a/src/TortoiseProc/GitLogListBase.h b/src/TortoiseProc/GitLogListBase.h index 76564fb..2aad727 100644 --- a/src/TortoiseProc/GitLogListBase.h +++ b/src/TortoiseProc/GitLogListBase.h @@ -268,7 +268,7 @@ protected: CColors m_Colors; CString m_CurrentBranch; - CString m_HeadHash; + CGitHash m_HeadHash; CString m_StartRef; //Ref of the top-commit diff --git a/src/TortoiseProc/LogDataVector.cpp b/src/TortoiseProc/LogDataVector.cpp index 3de4393..fad928d 100644 --- a/src/TortoiseProc/LogDataVector.cpp +++ b/src/TortoiseProc/LogDataVector.cpp @@ -178,6 +178,8 @@ int CLogDataVector::ParserFromLog(CTGitPath *path ,int count ,int infomask,CStri BYTE_VECTOR log; GitRev rev; CString emptyhash; + this->m_pLogCache->ClearAllParent(); + g_Git.GetLog(log,emptyhash,path,count,infomask,from,to); CString begin;