OSDN Git Service

Fix git blame log dialog show nothing
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / LogDataVector.cpp
index 4f49363..3de4393 100644 (file)
@@ -62,6 +62,8 @@
 //#include "RepositoryInfo.h"\r
 //#include "EditPropertiesDlg.h"\r
 #include "FileDiffDlg.h"\r
+#include "GitHash.h"\r
+CGitHashMap a;\r
 \r
 void CLogDataVector::ClearAll()\r
 {\r
@@ -103,7 +105,15 @@ int CLogDataVector::ParserShortLog(CTGitPath *path ,CString &hash,int count ,int
                next=rev.ParserFromLog(log,next);\r
 \r
                rev.m_Subject=_T("Load .................................");\r
-               this->push_back(rev);\r
+               this->push_back(rev.m_CommitHash);\r
+\r
+               if(this->m_pLogCache->m_HashMap.IsExist(rev.m_CommitHash))\r
+               {\r
+                       if(!this->m_pLogCache->m_HashMap[rev.m_CommitHash].m_IsFull)\r
+                               this->m_pLogCache->m_HashMap[rev.m_CommitHash].CopyFrom(rev);\r
+               }else\r
+                       this->m_pLogCache->m_HashMap[rev.m_CommitHash].CopyFrom(rev);\r
+\r
                m_HashMap[rev.m_CommitHash]=size()-1;\r
 \r
                //next=log.find(0,next);\r
@@ -112,7 +122,7 @@ int CLogDataVector::ParserShortLog(CTGitPath *path ,CString &hash,int count ,int
        return 0;\r
 \r
 }\r
-int CLogDataVector::FetchShortLog(CTGitPath *path ,CString &hash,int count ,int mask )\r
+int CLogDataVector::FetchShortLog(CTGitPath *path ,CString &hash,int count ,int mask, int ShowWC )\r
 {\r
        //BYTE_VECTOR log;\r
        m_RawlogData.clear();\r
@@ -152,7 +162,7 @@ int CLogDataVector::FetchShortLog(CTGitPath *path ,CString &hash,int count ,int
                //next=log.find(0,next);\r
        }\r
 \r
-       resize(m_RawLogStart.size());\r
+       resize(m_RawLogStart.size() + ShowWC);\r
 \r
        t2=GetTickCount();\r
 \r
@@ -160,7 +170,7 @@ int CLogDataVector::FetchShortLog(CTGitPath *path ,CString &hash,int count ,int
 }\r
 int CLogDataVector::FetchFullInfo(int i)\r
 {\r
-       return at(i).SafeFetchFullInfo(&g_Git);\r
+       return GetGitRevAt(i).SafeFetchFullInfo(&g_Git);\r
 }\r
 //CLogDataVector Class\r
 int CLogDataVector::ParserFromLog(CTGitPath *path ,int count ,int infomask,CString *from,CString *to)\r
@@ -182,7 +192,20 @@ int CLogDataVector::ParserFromLog(CTGitPath *path ,int count ,int infomask,CStri
        while( next>=0 )\r
        {\r
                next=rev.ParserFromLog(log,next);\r
-               this->push_back(rev);\r
+\r
+               if(this->m_pLogCache->m_HashMap.IsExist(rev.m_CommitHash))\r
+               {\r
+                       if(!this->m_pLogCache->m_HashMap[rev.m_CommitHash].m_IsFull)\r
+                       {\r
+                               this->m_pLogCache->m_HashMap[rev.m_CommitHash].CopyFrom(rev);\r
+                       }\r
+               }else\r
+                       this->m_pLogCache->m_HashMap[rev.m_CommitHash].CopyFrom(rev);\r
+\r
+               this->m_pLogCache->m_HashMap[rev.m_CommitHash].m_IsFull=true;\r
+\r
+               this->push_back(rev.m_CommitHash);\r
+\r
                m_HashMap[rev.m_CommitHash]=size()-1;           \r
        }\r
 \r
@@ -205,7 +228,9 @@ int CLogDataVector::ParserFromRefLog(CString ref)
                if(ref<0)\r
                        continue;\r
 \r
-               rev.m_CommitHash=one.Left(ref);\r
+               rev.Clear();\r
+\r
+               rev.m_CommitHash=g_Git.GetHash(one.Left(ref));\r
                int action=one.Find(_T(' '),ref+1);\r
                int message;\r
                if(action>0)\r
@@ -218,12 +243,19 @@ int CLogDataVector::ParserFromRefLog(CString ref)
                                rev.m_Subject=one.Right(one.GetLength()-message-1);\r
                        }\r
                }\r
-               this->push_back(rev);\r
+\r
+               if(this->m_pLogCache->m_HashMap.IsExist(rev.m_CommitHash))\r
+               {\r
+                       if(!this->m_pLogCache->m_HashMap[rev.m_CommitHash].m_IsFull)\r
+                               this->m_pLogCache->m_HashMap[rev.m_CommitHash].CopyFrom(rev);\r
+               }else\r
+                       this->m_pLogCache->m_HashMap[rev.m_CommitHash].CopyFrom(rev);\r
+\r
        }\r
        return 0;\r
 }\r
 \r
-void CLogDataVector::setLane(CString& sha) \r
+void CLogDataVector::setLane(CGitHash& sha) \r
 {\r
        Lanes* l = &(this->m_Lns);\r
        int i = m_FirstFreeLane;\r
@@ -234,8 +266,8 @@ void CLogDataVector::setLane(CString& sha)
 \r
        for (int cnt = size(); i < cnt; ++i) {\r
 \r
-               GitRev* r = &(*this)[i]\r
-               CString &curSha=r->m_CommitHash;\r
+               GitRev* r = & this->GetGitRevAt(i)\r
+               CGitHash curSha=r->m_CommitHash;\r
 \r
                if (r->m_Lanes.size() == 0)\r
                        updateLanes(*r, *l, curSha);\r
@@ -268,7 +300,7 @@ void CLogDataVector::setLane(CString& sha)
 }\r
 \r
 \r
-void CLogDataVector::updateLanes(GitRev& c, Lanes& lns, CString &sha) \r
+void CLogDataVector::updateLanes(GitRev& c, Lanes& lns, CGitHash &sha) \r
 {\r
 // we could get third argument from c.sha(), but we are in fast path here\r
 // and c.sha() involves a deep copy, so we accept a little redundancy\r
@@ -285,7 +317,7 @@ void CLogDataVector::updateLanes(GitRev& c, Lanes& lns, CString &sha)
                lns.changeActiveLane(sha); // uses previous isBoundary state\r
 \r
        lns.setBoundary(c.IsBoundary() == TRUE); // update must be here\r
-       TRACE(_T("%s %d"),c.m_CommitHash,c.IsBoundary());\r
+       TRACE(_T("%s %d"),c.m_CommitHash.ToString(),c.IsBoundary());\r
 \r
        if (isFork)\r
                lns.setFork(sha);\r
@@ -298,7 +330,9 @@ void CLogDataVector::updateLanes(GitRev& c, Lanes& lns, CString &sha)
 \r
        lns.getLanes(c.m_Lanes); // here lanes are snapshotted\r
 \r
-       CString nextSha = (isInitial) ? CString(_T("")) : QString(c.m_ParentHash[0]);\r
+       CGitHash nextSha;\r
+       if( !isInitial) \r
+               nextSha = c.m_ParentHash[0];\r
 \r
        lns.nextParent(nextSha);\r
 \r