OSDN Git Service

Show Conflict Status at Filelist at delete conflict local: delete, remote:modified
authorFrank Li <lznuaa@gmail.com>
Fri, 27 Feb 2009 15:19:55 +0000 (23:19 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 27 Feb 2009 15:19:55 +0000 (23:19 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/GitStatusListCtrl.cpp
src/Git/TGitPath.cpp
src/TortoiseProc/AppUtils.cpp

index 0884469..a8e4e56 100644 (file)
@@ -5409,14 +5409,14 @@ int CGitStatusListCtrl::UpdateFileList(git_revnum_t hash,CTGitPathList *list)
        this->m_bBusy=TRUE;\r
        m_CurrentVersion=hash;\r
 \r
+       int count = 0;\r
+       if(list == NULL)\r
+               count = 1;\r
+       else\r
+               count = list->GetCount();\r
+\r
        if(hash == GIT_REV_ZERO)\r
        {\r
-               int count = 0;\r
-               if(list == NULL)\r
-                       count = 1;\r
-               else\r
-                       count = list->GetCount();\r
-\r
                for(int i=0;i<count;i++)\r
                {       \r
                        BYTE_VECTOR cmdout;\r
@@ -5477,7 +5477,31 @@ int CGitStatusListCtrl::UpdateFileList(git_revnum_t hash,CTGitPathList *list)
                else\r
                        this->m_StatusFileList.ParserFromLog(out);\r
 \r
-               \r
+               //handle delete conflict case, when remote : modified, local : deleted. \r
+               for(int i=0;i<count;i++)\r
+               {       \r
+                       BYTE_VECTOR cmdout;\r
+                       CString cmd;\r
+\r
+                       if(list == NULL)\r
+                               cmd=_T("git.exe ls-files -u -t -z");\r
+                       else\r
+                               cmd.Format(_T("git.exe ls-files -u -t -z -- \"%s\""),(*list)[i].GetGitPathString());\r
+\r
+                       g_Git.Run(cmd,&cmdout);\r
+\r
+                       CTGitPathList conflictlist;\r
+                       conflictlist.ParserFromLog(cmdout);\r
+                       for(int i=0;i<conflictlist.GetCount();i++)\r
+                       {\r
+                               CTGitPath *p=m_StatusFileList.LookForGitPath(conflictlist[i].GetGitPathString());\r
+                               if(p)\r
+                                       p->m_Action|=CTGitPath::LOGACTIONS_UNMERGED;\r
+                               else\r
+                                       m_StatusFileList.AddPath(conflictlist[i]);\r
+                       }       \r
+               }\r
+\r
        }else\r
        {\r
                int count = 0;\r
@@ -5502,12 +5526,14 @@ int CGitStatusListCtrl::UpdateFileList(git_revnum_t hash,CTGitPathList *list)
                this->m_StatusFileList.ParserFromLog(out);\r
 \r
        }\r
+       \r
        for(int i=0;i<m_StatusFileList.GetCount();i++)\r
        {\r
                CTGitPath * gitpatch=(CTGitPath*)&m_StatusFileList[i];\r
                gitpatch->m_Checked = TRUE;\r
                m_arStatusArray.push_back((CTGitPath*)&m_StatusFileList[i]);\r
        }\r
+\r
        this->m_bBusy=FALSE;\r
        return 0;\r
 }\r
@@ -5715,4 +5741,4 @@ HRESULT STDMETHODCALLTYPE CSVNStatusListCtrlDropTarget::DragOver(DWORD grfKeySta
        return S_OK;\r
 }f\r
 \r
-#endif
\ No newline at end of file
+#endif\r
index 93787c0..7c7e43c 100644 (file)
@@ -1879,12 +1879,12 @@ CTGitPath * CTGitPathList::LookForGitPath(CString path)
 }\r
 CString CTGitPath::GetActionName(int action)\r
 {\r
+       if(action  & CTGitPath::LOGACTIONS_UNMERGED)\r
+               return _T("Conflict");\r
        if(action  & CTGitPath::LOGACTIONS_ADDED)\r
                return _T("Added");\r
        if(action  & CTGitPath::LOGACTIONS_DELETED)\r
                return _T("Deleted");\r
-       if(action  & CTGitPath::LOGACTIONS_UNMERGED)\r
-               return _T("Conflict");\r
        if(action  & CTGitPath::LOGACTIONS_MODIFIED)\r
                return _T("Modified");\r
        if(action  & CTGitPath::LOGACTIONS_REPLACED)\r
index 67d3955..d1af68d 100644 (file)
@@ -1364,6 +1364,7 @@ bool CAppUtils::ConflictEdit(CTGitPath &path,bool bAlternativeTool)
                CDeleteConflictDlg dlg;\r
                DescribeFile(b_local, b_base,dlg.m_LocalStatus);\r
                DescribeFile(b_remote,b_base,dlg.m_RemoteStatus);\r
+               dlg.m_bShowModifiedButton=b_base;\r
                dlg.m_File=merge.GetGitPathString();\r
                if(dlg.DoModal() == IDOK)\r
                {\r