OSDN Git Service

Fix loading last line of full log and set IsFull flag after fetching full logline...
authorJohan t Hart <johanthart@gmail.com>
Tue, 3 Feb 2009 21:49:02 +0000 (22:49 +0100)
committerFrank Li <lznuaa@gmail.com>
Sun, 8 Feb 2009 07:04:56 +0000 (15:04 +0800)
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/GitLogListBase.h

index 4eaa143..003a0db 100644 (file)
@@ -1453,6 +1453,8 @@ public:
        CGitCall_FetchFullLogInfo(CGitLogListBase* ploglist):m_ploglist(ploglist),m_CollectedCount(0){}\r
        virtual bool OnOutputData(const BYTE* data, size_t size)\r
        {\r
+               if(size==0)\r
+                       return m_ploglist->m_bExitThread;\r
                //Add received data to byte collector\r
                m_ByteCollector.append(data,size);\r
 \r
@@ -1473,6 +1475,13 @@ public:
 \r
                return m_ploglist->m_bExitThread;\r
        }\r
+       virtual void OnEnd()\r
+       {\r
+               //Rest should be a complete log line.\r
+               if(!m_ByteCollector.empty())\r
+                       OnLogInfo(m_ByteCollector);\r
+       }\r
+\r
 \r
        void OnLogInfo(BYTE_VECTOR& logInfo)\r
        {\r
@@ -1508,6 +1517,7 @@ public:
                revInVector->m_ParentHash=oldlist;\r
 \r
                //Reset updating\r
+               InterlockedExchange(&revInVector->m_IsFull,TRUE);\r
                InterlockedExchange(&revInVector->m_IsUpdateing,FALSE);\r
 \r
                //Notify listcontrol and update progress bar\r
@@ -1534,6 +1544,52 @@ void CGitLogListBase::FetchFullLogInfo()
        g_Git.GetLog(&fetcher,CString(),NULL,-1,CGit::LOG_INFO_STAT|CGit::LOG_INFO_FILESTATE|CGit::LOG_INFO_DETECT_COPYRENAME);\r
 }\r
 \r
+void CGitLogListBase::FetchFullLogInfoOrig()\r
+{\r
+       unsigned int updated=0;\r
+       int percent=0;\r
+       CRect rect;\r
+       while(1)\r
+       {\r
+               for(unsigned int i=0;i<m_logEntries.size();i++)\r
+               {\r
+                       if(m_LogCache.GetCacheData(m_logEntries[i]))\r
+                       {\r
+                               if(!m_logEntries.FetchFullInfo(i))\r
+                               {\r
+                                       updated++;\r
+                               }\r
+                               m_LogCache.AddCacheEntry(m_logEntries[i]);\r
+\r
+                       }else\r
+                       {\r
+                               updated++;\r
+                               InterlockedExchange(&m_logEntries[i].m_IsUpdateing,FALSE);\r
+                               InterlockedExchange(&m_logEntries[i].m_IsFull,TRUE);\r
+                       }\r
+                       \r
+                       ::PostMessage(m_hWnd,MSG_LOADED,(WPARAM)i,0);\r
+\r
+                       if(m_bExitThread)\r
+                       {\r
+                               InterlockedExchange(&m_bThreadRunning, FALSE);\r
+                               InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
+                               return;\r
+                       }\r
+\r
+                       percent=updated*98/m_logEntries.size() + GITLOG_START+1;\r
+                       if(percent == GITLOG_END)\r
+                               percent = GITLOG_END -1;\r
+                       \r
+                       ::PostMessage(this->GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) percent,0);\r
+\r
+                       \r
+               }\r
+               if(updated==m_logEntries.size())\r
+                       break;\r
+       }\r
+}\r
+\r
 UINT CGitLogListBase::LogThread()\r
 {\r
 \r
@@ -1585,52 +1641,9 @@ UINT CGitLogListBase::LogThread()
 #endif\r
        InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
 \r
-       unsigned int updated=0;\r
-       int percent=0;\r
-       CRect rect;\r
-/*     while(1)\r
-       {\r
-               for(unsigned int i=0;i<m_logEntries.size();i++)\r
-               {\r
-                       if(m_LogCache.GetCacheData(m_logEntries[i]))\r
-                       {\r
-                               if(!m_logEntries.FetchFullInfo(i))\r
-                               {\r
-                                       updated++;\r
-                               }\r
-                               m_LogCache.AddCacheEntry(m_logEntries[i]);\r
-\r
-                       }else\r
-                       {\r
-                               updated++;\r
-                               InterlockedExchange(&m_logEntries[i].m_IsUpdateing,FALSE);\r
-                               InterlockedExchange(&m_logEntries[i].m_IsFull,TRUE);\r
-                       }\r
-                       \r
-                       ::PostMessage(m_hWnd,MSG_LOADED,(WPARAM)i,0);\r
-\r
-                       if(m_bExitThread)\r
-                       {\r
-                               InterlockedExchange(&m_bThreadRunning, FALSE);\r
-                               InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
-                               return 0;\r
-                       }\r
-\r
-                       percent=updated*98/m_logEntries.size() + GITLOG_START+1;\r
-                       if(percent == GITLOG_END)\r
-                               percent = GITLOG_END -1;\r
-                       \r
-                       ::PostMessage(this->GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) percent,0);\r
-\r
-                       \r
-               }\r
-               if(updated==m_logEntries.size())\r
-                       break;\r
 \r
-               //m_logEntries.FetchFullInfo(i);\r
-       }\r
-*/\r
        FetchFullLogInfo();\r
+       //FetchFullLogInfoOrig();\r
        //RefreshCursor();\r
        // make sure the filter is applied (if any) now, after we refreshed/fetched\r
        // the log messages\r
index 2446c0e..6cfead5 100644 (file)
@@ -191,6 +191,7 @@ protected:
        virtual BOOL PreTranslateMessage(MSG* pMsg);\r
        static UINT LogThreadEntry(LPVOID pVoid);\r
        UINT LogThread();\r
+       void FetchFullLogInfoOrig();\r
        void FetchFullLogInfo();\r
        void FillBackGround(HDC hdc, int Index,CRect &rect);\r
        void DrawTagBranch(HDC,CRect &rect,INT_PTR index);\r