OSDN Git Service

Build TortoisProc is okay
authorFrank Li <lznuaa@gmail.com>
Mon, 4 Jan 2010 04:33:52 +0000 (12:33 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 4 Jan 2010 04:33:52 +0000 (12:33 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
15 files changed:
src/Git/Git.cpp
src/Git/Git.h
src/Git/GitHash.h
src/TortoiseProc/Commands/PrevDiffCommand.cpp
src/TortoiseProc/FileDiffDlg.cpp
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/LogDataVector.cpp
src/TortoiseProc/LogDlg.cpp
src/TortoiseProc/LogDlgHelper.h
src/TortoiseProc/RebaseDlg.cpp
src/TortoiseProc/RefLogDlg.cpp
src/TortoiseProc/TortoiseProc.vcproj
src/TortoiseProc/lanes.cpp
src/TortoiseProc/lanes.h
src/TortoiseProc/refloglist.cpp

index 5e0810b..80f53b8 100644 (file)
@@ -472,10 +472,8 @@ int CGit::GetLog(BYTE_VECTOR& logOut, CString &hash,  CTGitPath *path ,int count
        return GetLog(&gitCall,hash,path,count,mask,from,to);\r
 }\r
 \r
-//int CGit::GetLog(CGitCall* pgitCall, CString &hash,  CTGitPath *path ,int count,int mask)\r
-int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path, int count, int mask,CString *from,CString *to)\r
+CString CGit::GetLogCmd( CString &hash, CTGitPath *path, int count, int mask,CString *from,CString *to)\r
 {\r
-\r
        CString cmd;\r
        CString log;\r
        CString num;\r
@@ -542,32 +540,17 @@ int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path, int count,
        cmd += log;\r
        cmd += CString(_T("\"  "))+hash+file;\r
 \r
-       pgitCall->SetCmd(cmd);\r
+       return cmd;\r
+}\r
+//int CGit::GetLog(CGitCall* pgitCall, CString &hash,  CTGitPath *path ,int count,int mask)\r
+int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path, int count, int mask,CString *from,CString *to)\r
+{\r
+       pgitCall->SetCmd( GetLogCmd(hash,path,count,mask,from,to) );\r
 \r
        return Run(pgitCall);\r
 //     return Run(cmd,&logOut);\r
 }\r
 \r
-#if 0\r
-int CGit::GetShortLog(CString &logOut,CTGitPath * path, int count)\r
-{\r
-       CString cmd;\r
-       CString log;\r
-       int n;\r
-       if(count<0)\r
-               n=100;\r
-       else\r
-               n=count;\r
-       cmd.Format(_T("git.exe log --left-right --boundary --topo-order -n%d --pretty=format:\""),n);\r
-       BuildOutputFormat(log,false);\r
-       cmd += log+_T("\"");\r
-       if (path)\r
-               cmd+= _T("  -- \"")+path->GetGitPathString()+_T("\"");\r
-       //cmd += CString(_T("\" HEAD~40..HEAD"));\r
-       return Run(cmd,&logOut);\r
-}\r
-#endif\r
-\r
 #define BUFSIZE 512\r
 void GetTempPath(CString &path)\r
 {\r
index 342d5d4..8afb2fa 100644 (file)
@@ -109,6 +109,9 @@ public:
        int GetLog(BYTE_VECTOR& logOut,CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_FULL_DIFF|LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME|LOG_INFO_SHOW_MERGEDFILE,\r
                                                                CString *from=NULL,CString *to=NULL);\r
 \r
+       CString GetLogCmd(CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_FULL_DIFF|LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME|LOG_INFO_SHOW_MERGEDFILE,\r
+                                                               CString *from=NULL,CString *to=NULL);\r
+\r
        BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData);\r
 \r
        git_revnum_t GetHash(const CString &friendname);\r
index 6b12c47..900aa16 100644 (file)
@@ -15,7 +15,13 @@ public:
        CGitHash(char *p)\r
        {\r
                memcpy(m_hash,p,GIT_HASH_SIZE);\r
-       }       \r
+       }\r
+       CGitHash & operator = (CString &str)\r
+       {\r
+               CGitHash hash(str);\r
+               *this = hash;\r
+               return *this;\r
+       }\r
        CGitHash(CString &str)\r
        {\r
                for(int i=0;i<GIT_HASH_SIZE;i++)\r
@@ -67,7 +73,7 @@ public:
                return ToString(); \r
        } \r
 \r
-       bool operator == (CGitHash &hash)\r
+       bool operator == (const CGitHash &hash)\r
        {\r
                return memcmp(m_hash,hash.m_hash,GIT_HASH_SIZE) == 0;\r
        }\r
index 4a35ea4..6927c48 100644 (file)
@@ -60,13 +60,13 @@ bool PrevDiffCommand::Execute()
                        if( revs.size() == 1 )\r
                        {\r
                                CGitDiff diff;\r
-                               bRet = (diff.DiffNull(&cmdLinePath,revs[0].m_CommitHash) != 0);\r
+                               bRet = (diff.DiffNull(&cmdLinePath,revs.GetGitRevAt(0).m_CommitHash.ToString()) != 0);\r
                        }\r
 \r
                        if( revs.size() == 2 )\r
                        {\r
                                CGitDiff diff;\r
-                               bRet = diff.Diff(&cmdLinePath,&cmdLinePath, revs[0].m_CommitHash, revs[1].m_CommitHash, false);\r
+                               bRet = diff.Diff(&cmdLinePath,&cmdLinePath, revs.GetGitRevAt(0).m_CommitHash.ToString(), revs.GetGitRevAt(1).m_CommitHash.ToString(), false);\r
                        }\r
                }\r
                else\r
index fee87b5..24634b0 100644 (file)
@@ -109,7 +109,7 @@ void CFileDiffDlg::SetDiff(CTGitPath * path, CString &hash1, CString &hash2)
 \r
        if(hash1 == GIT_REV_ZERO)\r
        {\r
-               m_rev1.m_CommitHash=GIT_REV_ZERO;\r
+               m_rev1.m_CommitHash.Empty();\r
                m_rev1.m_Subject=_T("Working Copy");\r
        }else\r
        {\r
@@ -121,7 +121,7 @@ void CFileDiffDlg::SetDiff(CTGitPath * path, CString &hash1, CString &hash2)
 \r
        if(hash2 == GIT_REV_ZERO)\r
        {\r
-               m_rev2.m_CommitHash = GIT_REV_ZERO;\r
+               m_rev2.m_CommitHash.Empty();\r
                m_rev2.m_Subject=_T("Working Copy");\r
        }else\r
        {\r
@@ -137,7 +137,7 @@ void CFileDiffDlg::SetDiff(CTGitPath * path, GitRev rev1)
                m_path2 = *path;\r
        }\r
        m_rev1 = rev1;\r
-       m_rev2.m_CommitHash = _T("");\r
+       m_rev2.m_CommitHash.Empty();\r
        m_rev2.m_Subject = _T("Previou Version");\r
 \r
        //this->GetDlgItem()->EnableWindow(FALSE);\r
@@ -267,7 +267,7 @@ UINT CFileDiffDlg::DiffThread()
 //     }\r
 #endif\r
 \r
-       g_Git.GetCommitDiffList(m_rev1.m_CommitHash,m_rev2.m_CommitHash,m_arFileList);\r
+       g_Git.GetCommitDiffList(m_rev1.m_CommitHash.ToString(),m_rev2.m_CommitHash.ToString(),m_arFileList);\r
                \r
        CString sFilterText;\r
        m_cFilter.GetWindowText(sFilterText);\r
@@ -325,7 +325,7 @@ void CFileDiffDlg::DoDiff(int selIndex, bool blame)
 \r
        CGitDiff diff;\r
        CTGitPath* fd = m_arFilteredList[selIndex];\r
-       diff.Diff(fd, fd,this->m_rev1.m_CommitHash, this->m_rev2.m_CommitHash, blame, FALSE);\r
+       diff.Diff(fd, fd,this->m_rev1.m_CommitHash.ToString(), this->m_rev2.m_CommitHash.ToString(), blame, FALSE);\r
 \r
 #if 0\r
        CFileDiffDlg::CTGitPath* fd = m_arFilteredList[selIndex];\r
@@ -883,8 +883,8 @@ void CFileDiffDlg::OnBnClickedSwitchleftright()
 void CFileDiffDlg::SetURLLabels()\r
 {\r
 \r
-       m_cRev1Btn.SetWindowText(m_rev1.m_CommitHash.Left(6));\r
-       m_cRev2Btn.SetWindowText(m_rev2.m_CommitHash.Left(6));\r
+       m_cRev1Btn.SetWindowText(m_rev1.m_CommitHash.ToString().Left(6));\r
+       m_cRev2Btn.SetWindowText(m_rev2.m_CommitHash.ToString().Left(6));\r
 \r
        SetDlgItemText(IDC_FIRSTURL, m_rev1.m_Subject+CString(_T("\r\n"))+m_rev1.m_CommitHash);\r
        SetDlgItemText(IDC_SECONDURL,m_rev2.m_Subject+CString(_T("\r\n"))+m_rev2.m_CommitHash);\r
index bc888ec..be3f139 100644 (file)
@@ -824,7 +824,7 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)
 \r
 \r
        if (data->m_Lanes.size() == 0)\r
-               m_logEntries.setLane(data->m_CommitHash.ToString());\r
+               m_logEntries.setLane(data->m_CommitHash);\r
 \r
        std::vector<int>& lanes=data->m_Lanes;\r
        UINT laneNum = lanes.size();\r
@@ -943,7 +943,7 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
                                                *pResult = CDRF_NOTIFYSUBITEMDRAW | CDRF_NEWFONT;\r
                                        }\r
 \r
-                                       if(data->m_CommitHash == m_HeadHash)\r
+                                       if(data->m_CommitHash.ToString() == m_HeadHash)\r
                                        {\r
                                                SelectObject(pLVCD->nmcd.hdc, m_boldFont);\r
                                                *pResult = CDRF_NOTIFYSUBITEMDRAW | CDRF_NEWFONT;\r
@@ -1407,7 +1407,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                                                CString hash=g_Git.GetHash(head);\r
                                                hash=hash.Left(40);\r
                                                GitRev* pLastEntry = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
-                                               if(pLastEntry->m_CommitHash == hash)\r
+                                               if(pLastEntry->m_CommitHash.ToString() == hash)\r
                                                        popup.AppendMenuIcon(ID_COMBINE_COMMIT,IDS_COMBINE_TO_ONE,IDI_COMBINE);\r
                                        }\r
                                }\r
@@ -2083,7 +2083,7 @@ UINT CGitLogListBase::LogThread()
                        m_logEntries.GetGitRevAt(i).m_Files.Clear();\r
                        m_logEntries.GetGitRevAt(i).m_ParentHash.clear();\r
                        m_logEntries.GetGitRevAt(i).m_ParentHash.push_back(m_HeadHash);\r
-                       g_Git.GetCommitDiffList(m_logEntries.GetGitRevAt(i).m_CommitHash,this->m_HeadHash,m_logEntries.GetGitRevAt(i).m_Files);\r
+                       g_Git.GetCommitDiffList(m_logEntries.GetGitRevAt(i).m_CommitHash.ToString(),this->m_HeadHash,m_logEntries.GetGitRevAt(i).m_Files);\r
                        m_logEntries.GetGitRevAt(i).m_Action =0;\r
                        for(int j=0;j< m_logEntries.GetGitRevAt(i).m_Files.GetCount();j++)\r
                                m_logEntries.GetGitRevAt(i).m_Action |= m_logEntries.GetGitRevAt(i).m_Files[j].m_Action;\r
@@ -2094,13 +2094,13 @@ UINT CGitLogListBase::LogThread()
                }\r
 \r
                start=this->m_logEntries.GetGitRevAt(i).ParserFromLog(m_logEntries.m_RawlogData,start);\r
-               m_logEntries.m_HashMap[m_logEntries[i].m_CommitHash]=i;\r
+               m_logEntries.m_HashMap[m_logEntries.GetGitRevAt(i).m_CommitHash.ToString()]=i;\r
 \r
                if(m_LogCache.GetCacheData(m_logEntries.GetGitRevAt(i)))\r
                {\r
                        if(firstcommit.IsEmpty())\r
-                               firstcommit=m_logEntries[i].m_CommitHash;\r
-                       lastcommit=m_logEntries[i].m_CommitHash;\r
+                               firstcommit=m_logEntries.GetGitRevAt(i).m_CommitHash.ToString();\r
+                       lastcommit=m_logEntries.GetGitRevAt(i).m_CommitHash.ToString();\r
 \r
                }else\r
                {\r
@@ -2247,17 +2247,17 @@ void CGitLogListBase::RecalculateShownList(CPtrArray * pShownlist)
 #endif\r
                        if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_MESSAGES))\r
                        {\r
-                               ATLTRACE(_T("messge = \"%s\"\n"),m_logEntries[i].m_Subject);\r
-                               if (regex_search(wstring((LPCTSTR)m_logEntries[i].m_Subject), pat, flags)&&IsEntryInDateRange(i))\r
+                               ATLTRACE(_T("messge = \"%s\"\n"),m_logEntries.GetGitRevAt(i).m_Subject);\r
+                               if (regex_search(wstring((LPCTSTR)m_logEntries.GetGitRevAt(i).m_Subject), pat, flags)&&IsEntryInDateRange(i))\r
                                {\r
                                        pShownlist->Add(&m_logEntries[i]);\r
                                        continue;\r
                                }\r
 \r
-                               ATLTRACE(_T("messge = \"%s\"\n"),m_logEntries[i].m_Body);\r
-                               if (regex_search(wstring((LPCTSTR)m_logEntries[i].m_Body), pat, flags)&&IsEntryInDateRange(i))\r
+                               ATLTRACE(_T("messge = \"%s\"\n"),m_logEntries.GetGitRevAt(i).m_Body);\r
+                               if (regex_search(wstring((LPCTSTR)m_logEntries.GetGitRevAt(i).m_Body), pat, flags)&&IsEntryInDateRange(i))\r
                                {\r
-                                       pShownlist->Add(&m_logEntries[i]);\r
+                                       pShownlist->Add(&m_logEntries.GetGitRevAt(i));\r
                                        continue;\r
                                }\r
                        }\r
@@ -2295,18 +2295,18 @@ void CGitLogListBase::RecalculateShownList(CPtrArray * pShownlist)
 #endif\r
                        if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_AUTHORS))\r
                        {\r
-                               if (regex_search(wstring((LPCTSTR)m_logEntries[i].m_AuthorName), pat, flags)&&IsEntryInDateRange(i))\r
+                               if (regex_search(wstring((LPCTSTR)m_logEntries.GetGitRevAt(i).m_AuthorName), pat, flags)&&IsEntryInDateRange(i))\r
                                {\r
-                                       pShownlist->Add(&m_logEntries[i]);\r
+                                       pShownlist->Add(&m_logEntries.GetGitRevAt(i));\r
                                        continue;\r
                                }\r
                        }\r
                        if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_REVS))\r
                        {\r
-                               sRev.Format(_T("%s"), m_logEntries[i].m_CommitHash);\r
+                               sRev.Format(_T("%s"), m_logEntries.GetGitRevAt(i).m_CommitHash);\r
                                if (regex_search(wstring((LPCTSTR)sRev), pat, flags)&&IsEntryInDateRange(i))\r
                                {\r
-                                       pShownlist->Add(&m_logEntries[i]);\r
+                                       pShownlist->Add(&m_logEntries.GetGitRevAt(i));\r
                                        continue;\r
                                }\r
                        }\r
@@ -2330,15 +2330,15 @@ void CGitLogListBase::RecalculateShownList(CPtrArray * pShownlist)
 #endif\r
                        if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_MESSAGES))\r
                        {\r
-                               CString msg = m_logEntries[i].m_Subject;\r
+                               CString msg = m_logEntries.GetGitRevAt(i).m_Subject;\r
 \r
                                msg = msg.MakeLower();\r
                                if ((msg.Find(find) >= 0)&&(IsEntryInDateRange(i)))\r
                                {\r
-                                       pShownlist->Add(&m_logEntries[i]);\r
+                                       pShownlist->Add(&m_logEntries.GetGitRevAt(i));\r
                                        continue;\r
                                }\r
-                               msg = m_logEntries[i].m_Body;\r
+                               msg = m_logEntries.GetGitRevAt(i).m_Body;\r
 \r
                                msg = msg.MakeLower();\r
                                if ((msg.Find(find) >= 0)&&(IsEntryInDateRange(i)))\r
@@ -2385,20 +2385,20 @@ void CGitLogListBase::RecalculateShownList(CPtrArray * pShownlist)
 #endif\r
                        if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_AUTHORS))\r
                        {\r
-                               CString msg = m_logEntries[i].m_AuthorName;\r
+                               CString msg = m_logEntries.GetGitRevAt(i).m_AuthorName;\r
                                msg = msg.MakeLower();\r
                                if ((msg.Find(find) >= 0)&&(IsEntryInDateRange(i)))\r
                                {\r
-                                       pShownlist->Add(&m_logEntries[i]);\r
+                                       pShownlist->Add(&m_logEntries.GetGitRevAt(i));\r
                                        continue;\r
                                }\r
                        }\r
                        if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_REVS))\r
                        {\r
-                               sRev.Format(_T("%s"), m_logEntries[i].m_CommitHash);\r
+                               sRev.Format(_T("%s"), m_logEntries.GetGitRevAt(i).m_CommitHash);\r
                                if ((sRev.Find(find) >= 0)&&(IsEntryInDateRange(i)))\r
                                {\r
-                                       pShownlist->Add(&m_logEntries[i]);\r
+                                       pShownlist->Add(&m_logEntries.GetGitRevAt(i));\r
                                        continue;\r
                                }\r
                        }\r
@@ -2409,7 +2409,7 @@ void CGitLogListBase::RecalculateShownList(CPtrArray * pShownlist)
 \r
 BOOL CGitLogListBase::IsEntryInDateRange(int i)\r
 {\r
-       __time64_t time = m_logEntries[i].m_AuthorDate.GetTime();\r
+       __time64_t time = m_logEntries.GetGitRevAt(i).m_AuthorDate.GetTime();\r
        if ((time >= m_From.GetTime())&&(time <= m_To.GetTime()))\r
                return TRUE;\r
 \r
@@ -2545,7 +2545,7 @@ int CGitLogListBase::GetHeadIndex()
                GitRev *pRev = (GitRev*)m_arShownList[i];\r
                if(pRev)\r
                {\r
-                       if(pRev->m_CommitHash == m_HeadHash )\r
+                       if(pRev->m_CommitHash.ToString() == m_HeadHash )\r
                                return i;\r
                }\r
        }\r
index 8e9214d..bea1486 100644 (file)
@@ -105,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
@@ -162,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
@@ -184,7 +192,14 @@ 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
+                               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
 \r
@@ -209,7 +224,7 @@ int CLogDataVector::ParserFromRefLog(CString ref)
 \r
                rev.Clear();\r
 \r
-               rev.m_CommitHash=one.Left(ref);\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
@@ -222,12 +237,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
@@ -238,8 +260,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
@@ -272,7 +294,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
@@ -302,7 +324,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
index 6d6fd3d..7bd38c3 100644 (file)
@@ -519,7 +519,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/)
                }else\r
                {\r
                        // set the log message text\r
-                       pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash+_T("\r\n\r\n"));\r
+                       pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash.ToString()+_T("\r\n\r\n"));\r
                        // turn bug ID's into links if the bugtraq: properties have been set\r
                        // and we can find a match of those in the log message\r
                        \r
@@ -1340,14 +1340,14 @@ void CLogDlg::DoDiffFromLog(INT_PTR selIndex, GitRev* rev1, GitRev* rev2, bool b
        file1.Format(_T("%s%s_%s%s"),\r
                                temppath,                                               \r
                                (*m_currentChangedArray)[selIndex].GetBaseFilename(),\r
-                               rev1->m_CommitHash.Left(6),\r
+                               rev1->m_CommitHash.ToString().Left(6),\r
                                (*m_currentChangedArray)[selIndex].GetFileExtension());\r
 \r
        CString file2;\r
        file2.Format(_T("%s\\%s_%s%s"),\r
                                temppath,                                               \r
                                (*m_currentChangedArray)[selIndex].GetBaseFilename(),\r
-                               rev2->m_CommitHash.Left(6),\r
+                               rev2->m_CommitHash.ToString().Left(6),\r
                                (*m_currentChangedArray)[selIndex].GetFileExtension());\r
 \r
        CString cmd;\r
index ce2db33..d31d9e6 100644 (file)
@@ -32,7 +32,7 @@ class CLogDlg;
  * Instances of CStoreSelection save the selection of the CLogDlg. When the instance\r
  * is deleted the destructor restores the selection.\r
  */\r
-typedef std::map<CString, int> MAP_HASH_REV;\r
+typedef std::map<CGitHash, int> MAP_HASH_REV;\r
 \r
 class CStoreSelection\r
 {\r
@@ -60,6 +60,15 @@ public:
                m_pLogCache=pLogCache;\r
                m_FirstFreeLane=0;\r
        }\r
+       CLogDataVector()\r
+       {\r
+               m_pLogCache=NULL;\r
+               m_FirstFreeLane=0;\r
+       }\r
+       void SetLogCache(CLogCache *pLogCache)\r
+       {\r
+               m_pLogCache = pLogCache;\r
+       }\r
        GitRev & GetGitRevAt(int i)\r
        {\r
                ASSERT(i<size());\r
@@ -80,8 +89,8 @@ public:
        Lanes m_Lns;\r
        int      m_FirstFreeLane;\r
        MAP_HASH_REV m_HashMap;\r
-       void updateLanes(GitRev& c, Lanes& lns, CString &sha) ;\r
-       void setLane(CString& sha) ;\r
+       void updateLanes(GitRev& c, Lanes& lns, CGitHash &sha) ;\r
+       void setLane(CGitHash& sha) ;\r
 \r
        BYTE_VECTOR              m_RawlogData;\r
        std::vector<int> m_RawLogStart;\r
index ac4b1ac..d3551b0 100644 (file)
@@ -274,7 +274,7 @@ void CRebaseDlg::SetAllRebaseAction(int action)
 {\r
        for(int i=0;i<this->m_CommitList.m_logEntries.size();i++)\r
        {\r
-               m_CommitList.m_logEntries[i].m_Action=action;\r
+               m_CommitList.m_logEntries.GetGitRevAt(i).m_Action=action;\r
        }\r
        m_CommitList.Invalidate();\r
 }\r
@@ -517,7 +517,7 @@ void CRebaseDlg::FetchLogList()
        \r
        for(int i=0;i<m_CommitList.m_logEntries.size();i++)\r
        {\r
-               m_CommitList.m_logEntries[i].m_Action = CTGitPath::LOGACTIONS_REBASE_PICK;\r
+               m_CommitList.m_logEntries.GetGitRevAt(i).m_Action = CTGitPath::LOGACTIONS_REBASE_PICK;\r
        }\r
 \r
        m_CommitList.Invalidate();\r
index 12f7b05..ab0a31f 100644 (file)
@@ -104,6 +104,7 @@ void CRefLogDlg::OnCbnSelchangeRef()
 \r
        CLogDataVector *plog;\r
        plog = &m_RefList.m_RefMap[ref];\r
+       plog->SetLogCache(&this->m_RefList.m_LogCache);\r
 \r
        m_RefList.SetItemCountEx(plog->size());\r
 \r
@@ -111,7 +112,7 @@ void CRefLogDlg::OnCbnSelchangeRef()
 \r
        for(unsigned int i=0;i<m_RefList.m_RefMap[ref].size();i++)\r
        {\r
-               plog->at(i).m_IsFull=TRUE;\r
+               plog->GetGitRevAt(i).m_IsFull=TRUE;\r
                this->m_RefList.m_arShownList.Add(&(plog->at(i)));\r
                \r
        }\r
index b2c9177..e29bd60 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\copy.ico"\r
+                               RelativePath=".\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\copy.ico"\r
+                               RelativePath="..\Resources\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\refresh.ico"\r
+                               RelativePath=".\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\refresh.ico"\r
+                               RelativePath="..\Resources\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
index 43e561a..05542fb 100644 (file)
@@ -12,7 +12,7 @@
 #define IS_NODE(x) (x == NODE || x == NODE_R || x == NODE_L)\r
 \r
 \r
-void Lanes::init(const QString& expectedSha) {\r
+void Lanes::init(const CGitHash& expectedSha) {\r
 \r
        clear();\r
        activeLane = 0;\r
@@ -38,7 +38,7 @@ void Lanes::setBoundary(bool b) {
                typeVec[activeLane] = BOUNDARY;\r
 }\r
 \r
-bool Lanes::isFork(const QString& sha, bool& isDiscontinuity) {\r
+bool Lanes::isFork(const CGitHash& sha, bool& isDiscontinuity) {\r
 \r
        int pos = findNextSha(sha, 0);\r
        isDiscontinuity = (activeLane != pos);\r
@@ -58,7 +58,7 @@ bool Lanes::isFork(const QString& sha, bool& isDiscontinuity) {
 */\r
 }\r
 \r
-void Lanes::setFork(const QString& sha) {\r
+void Lanes::setFork(const CGitHash& sha) {\r
 \r
        int rangeStart, rangeEnd, idx;\r
        rangeStart = rangeEnd = idx = findNextSha(sha, 0);\r
@@ -97,7 +97,7 @@ void Lanes::setFork(const QString& sha) {
        }\r
 }\r
 \r
-void Lanes::setMerge(const QStringList& parents) {\r
+void Lanes::setMerge(const CGitHashList& parents) {\r
 // setFork() must be called before setMerge()\r
 \r
        if (boundary)\r
@@ -112,7 +112,7 @@ void Lanes::setMerge(const QStringList& parents) {
        t = NODE;\r
 \r
        int rangeStart = activeLane, rangeEnd = activeLane;\r
-       QStringList::const_iterator it(parents.begin());\r
+       CGitHashList::const_iterator it(parents.begin());\r
        for (++it; it != parents.end(); ++it) { // skip first parent\r
 \r
                int idx = findNextSha(*it, 0);\r
@@ -183,7 +183,7 @@ void Lanes::setApplied() {
        typeVec[activeLane] = APPLIED; // TODO test with boundaries\r
 }\r
 \r
-void Lanes::changeActiveLane(const QString& sha) {\r
+void Lanes::changeActiveLane(const CGitHash& sha) {\r
 \r
        int& t = typeVec[activeLane];\r
        if (t == INITIAL || isBoundary(t))\r
@@ -256,12 +256,15 @@ void Lanes::afterApplied() {
        typeVec[activeLane] = ACTIVE; // TODO test with boundaries\r
 }\r
 \r
-void Lanes::nextParent(const QString& sha) {\r
+void Lanes::nextParent(const CGitHash& sha) {\r
 \r
-       nextShaVec[activeLane] = (boundary ? QString(_T("")) : sha);\r
+       if(boundary)\r
+               nextShaVec[activeLane].Empty();\r
+       else\r
+               nextShaVec[activeLane] = sha;\r
 }\r
 \r
-int Lanes::findNextSha(const QString& next, int pos) {\r
+int Lanes::findNextSha(const CGitHash& next, int pos) {\r
 \r
        for (unsigned int i = pos; i < nextShaVec.size(); i++)\r
                if (nextShaVec[i] == next)\r
@@ -277,7 +280,7 @@ int Lanes::findType(int type, int pos) {
        return -1;\r
 }\r
 \r
-int Lanes::add(int type, const QString& next, int pos) {\r
+int Lanes::add(int type, const CGitHash& next, int pos) {\r
 \r
        // first check empty lanes starting from pos\r
        if (pos < (int)typeVec.size()) {\r
index 6626aeb..883131d 100644 (file)
@@ -7,14 +7,14 @@
 #ifndef LANES_H
 #define LANES_H
 
-//#include <QString>
+//#include <CGitHash>
 //#include <QVector>
+#include "githash.h"
 
-#define QString CString
 #define QVector vector
 using namespace std;
 
-typedef vector<CString> QStringList ;
+typedef vector<CGitHash> CGitHashList ;
 
 class Lanes {
 public:
@@ -64,31 +64,31 @@ public:
 
        Lanes() {} // init() will setup us later, when data is available
        bool isEmpty() { return typeVec.empty(); }
-       void init(const QString& expectedSha);
+       void init(const CGitHash& expectedSha);
        void clear();
-       bool isFork(const QString& sha, bool& isDiscontinuity);
+       bool isFork(const CGitHash& sha, bool& isDiscontinuity);
        void setBoundary(bool isBoundary);
-       void setFork(const QString& sha);
-       void setMerge(const QStringList& parents);
+       void setFork(const CGitHash& sha);
+       void setMerge(const CGitHashList& parents);
        void setInitial();
        void setApplied();
-       void changeActiveLane(const QString& sha);
+       void changeActiveLane(const CGitHash& sha);
        void afterMerge();
        void afterFork();
        bool isBranch();
        void afterBranch();
        void afterApplied();
-       void nextParent(const QString& sha);
+       void nextParent(const CGitHash& sha);
        void getLanes(QVector<int> &ln) { ln = typeVec; } // O(1) vector is implicitly shared
 
 private:
-       int findNextSha(const QString& next, int pos);
+       int findNextSha(const CGitHash& next, int pos);
        int findType(int type, int pos);
-       int add(int type, const QString& next, int pos);
+       int add(int type, const CGitHash& next, int pos);
 
        int activeLane;
        QVector<int> typeVec;
-       QVector<QString> nextShaVec;
+       QVector<CGitHash> nextShaVec;
        bool boundary;
        int NODE, NODE_L, NODE_R;
 };
index 60236e0..fd5afa5 100644 (file)
@@ -73,7 +73,7 @@ void CRefLogList::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult)
        case this->REFLOG_HASH: //Graphic\r
                if (pLogEntry)\r
                {\r
-                       lstrcpyn(pItem->pszText,pLogEntry->m_CommitHash, pItem->cchTextMax);\r
+                       lstrcpyn(pItem->pszText,pLogEntry->m_CommitHash.ToString(), pItem->cchTextMax);\r
                }\r
                break;\r
        case REFLOG_REF: //action -- no text in the column\r