OSDN Git Service

Fix GitBlame window PropertiesWnd parent info wrong
authorFrank Li <lznuaa@gmail.com>
Mon, 18 Jan 2010 10:13:36 +0000 (18:13 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 18 Jan 2010 10:13:36 +0000 (18:13 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/GitHash.h
src/TortoiseGitBlame/PropertiesWnd.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.h
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/GitLogListBase.h
src/TortoiseProc/LogDataVector.cpp

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