OSDN Git Service

Group "Modify File" "no version" and ignore basic work.
authorFrank Li <lznuaa@gmail.com>
Sat, 29 Nov 2008 14:07:15 +0000 (22:07 +0800)
committerFrank Li <lznuaa@gmail.com>
Sat, 29 Nov 2008 14:07:15 +0000 (22:07 +0800)
Git/GitStatusListCtrl.cpp
Git/GitStatusListCtrl.h
Git/TGitPath.cpp
Git/TGitPath.h
TortoiseMerge/BaseView.cpp
TortoiseProc/CommitDlg.cpp
TortoiseProc/TortoiseProc.vcproj

index 9c9cef9..d90edf7 100644 (file)
@@ -1043,6 +1043,7 @@ void CGitStatusListCtrl::Show(DWORD dwShow, DWORD dwCheck /*=0*/, bool bShowFold
        //SetItemCount(listIndex);\r
        SetRedraw(FALSE);\r
        DeleteAllItems();\r
+       PrepareGroups();\r
        m_nSelected = 0;\r
 \r
        for(int i=0;i<this->m_arStatusArray.size();i++)\r
@@ -1585,13 +1586,19 @@ void CGitStatusListCtrl::AddEntry(CTGitPath * GitPath, WORD langID, int listInde
        SetCheck(index, GitPath->m_Checked);\r
        if (GitPath->m_Checked)\r
                m_nSelected++;\r
-#if 0\r
-       if (m_changelists.find(entry->changelist) != m_changelists.end())\r
-               SetItemGroup(index, m_changelists[entry->changelist]);\r
+\r
+//#if 0\r
+//     if (m_changelists.find(entry->changelist) != m_changelists.end())\r
+//             SetItemGroup(index, m_changelists[entry->changelist]);\r
+//     else\r
+       if( GitPath->m_Action & CTGitPath::LOGACTIONS_IGNORE)\r
+               SetItemGroup(index, 2);\r
+       else if( GitPath->m_Action & CTGitPath::LOGACTIONS_UNVER)\r
+               SetItemGroup(index,1);\r
        else\r
-               SetItemGroup(index, 0);\r
+               SetItemGroup(index,0);\r
        m_bBlock = FALSE;\r
-#endif\r
+//#endif\r
 \r
 }\r
 #if 0\r
@@ -5209,19 +5216,54 @@ size_t CGitStatusListCtrl::GetNumberOfChangelistsInSelection()
 \r
 bool CGitStatusListCtrl::PrepareGroups(bool bForce /* = false */)\r
 {\r
-       if ((m_dwContextMenus & SVNSLC_POPCHANGELISTS) == NULL)\r
-               return false;   // don't show groups\r
 \r
-       bool bHasGroups = (m_changelists.size() > 0)||(bForce);\r
+       bool bHasGroups=false;\r
+       if ( this->m_UnRevFileList.GetCount()>0 || \r
+               this->m_IgnoreFileList.GetCount()>0 || bForce)\r
+       {\r
+               bHasGroups = true;\r
+       }\r
+\r
        RemoveAllGroups();\r
        EnableGroupView(bHasGroups);\r
-\r
+       \r
        TCHAR groupname[1024];\r
+       int groupindex = 0;\r
 \r
-       m_bHasIgnoreGroup = false;\r
+       if(bHasGroups);\r
+       {\r
+               LVGROUP grp = {0};\r
+               grp.cbSize = sizeof(LVGROUP);\r
+               grp.mask = LVGF_ALIGN | LVGF_GROUPID | LVGF_HEADER;\r
+               CString sUnassignedName(_T("Modified File"));\r
+               _tcsncpy_s(groupname, 1024, (LPCTSTR)sUnassignedName, 1023);\r
+               grp.pszHeader = groupname;\r
+               grp.iGroupId = groupindex;\r
+               grp.uAlign = LVGA_HEADER_LEFT;\r
+               InsertGroup(groupindex++, &grp);\r
 \r
-       // add a new group for each changelist\r
-       int groupindex = 0;\r
+               //if(m_UnRevFileList.GetCount()>0)\r
+               {\r
+                       _tcsncpy_s(groupname, 1024, (LPCTSTR)_T("No Version Control"), 1023);\r
+                       grp.pszHeader = groupname;\r
+                       grp.iGroupId = groupindex;\r
+                       grp.uAlign = LVGA_HEADER_LEFT;\r
+                       InsertGroup(groupindex++, &grp);\r
+               }\r
+\r
+               //if(m_IgnoreFileList.GetCount()>0)\r
+               {\r
+                       _tcsncpy_s(groupname, 1024, (LPCTSTR)_T("Ignored File"), 1023);\r
+                       grp.pszHeader = groupname;\r
+                       grp.iGroupId = groupindex;\r
+                       grp.uAlign = LVGA_HEADER_LEFT;\r
+                       InsertGroup(groupindex++, &grp);\r
+               }\r
+\r
+       }\r
+\r
+\r
+       m_bHasIgnoreGroup = false;\r
 \r
        // now add the items which don't belong to a group\r
        LVGROUP grp = {0};\r
@@ -5298,6 +5340,49 @@ int CGitStatusListCtrl::UpdateFileList(git_revnum_t hash)
        this->m_bBusy=FALSE;\r
        return 0;\r
 }\r
+int CGitStatusListCtrl::UpdateUnRevFileList()\r
+{\r
+       this->m_UnRevFileList.FillUnRev(CTGitPath::LOGACTIONS_UNVER);\r
+       for(int i=0;i<m_UnRevFileList.GetCount();i++)\r
+       {\r
+               CTGitPath * gitpatch=(CTGitPath*)&m_UnRevFileList[i];\r
+               gitpatch->m_Checked = FALSE;\r
+               m_arStatusArray.push_back((CTGitPath*)&m_UnRevFileList[i]);\r
+       }\r
+       return 0;\r
+}\r
+\r
+int CGitStatusListCtrl::UpdateIgnoreFileList()\r
+{\r
+       this->m_IgnoreFileList.FillUnRev(CTGitPath::LOGACTIONS_UNVER|CTGitPath::LOGACTIONS_IGNORE);\r
+       for(int i=0;i<m_IgnoreFileList.GetCount();i++)\r
+       {\r
+               CTGitPath * gitpatch=(CTGitPath*)&m_IgnoreFileList[i];\r
+               gitpatch->m_Checked = FALSE;\r
+               m_arStatusArray.push_back((CTGitPath*)&m_IgnoreFileList[i]);\r
+       }\r
+       return 0;\r
+}\r
+int CGitStatusListCtrl::UpdateFileList(int mask,bool once)\r
+{\r
+       if(mask&CGitStatusListCtrl::FILELIST_MODIFY)\r
+       {\r
+               if(once || (!(m_FileLoaded&CGitStatusListCtrl::FILELIST_MODIFY)))\r
+               {\r
+                       UpdateFileList(GIT_REV_ZERO);\r
+                       m_FileLoaded|=CGitStatusListCtrl::FILELIST_MODIFY;\r
+               }\r
+       }\r
+       if(mask&CGitStatusListCtrl::FILELIST_UNVER)\r
+       {\r
+               if(once || (!(m_FileLoaded&CGitStatusListCtrl::FILELIST_UNVER)))\r
+               {\r
+                       UpdateUnRevFileList();\r
+                       m_FileLoaded|=CGitStatusListCtrl::FILELIST_UNVER;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
 //////////////////////////////////////////////////////////////////////////\r
 #if 0\r
 bool CGitStatusListCtrlDropTarget::OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD * /*pdwEffect*/, POINTL pt)\r
index d2a6e82..28b9125 100644 (file)
@@ -839,6 +839,8 @@ private:
        bool                                            m_bHasIgnoreGroup;\r
        //CTGitPathList                         m_ConflictFileList;\r
        CTGitPathList                           m_StatusFileList;\r
+       CTGitPathList                           m_UnRevFileList;\r
+       CTGitPathList                           m_IgnoreFileList;\r
        //CTGitPathList                         m_StatusUrlList;\r
        CString                                         m_sLastError;\r
 \r
@@ -889,8 +891,19 @@ private:
 \r
        friend class CGitStatusListCtrlDropTarget;\r
 public:\r
+       enum\r
+       {\r
+               FILELIST_MODIFY= 0x1,\r
+               FILELIST_UNVER = 0x2,\r
+               FILELIST_IGNORE =0x4\r
+       };\r
+public:\r
        int UpdateFileList(git_revnum_t hash);\r
+       int UpdateFileList(int mask, bool once=true);\r
+       int UpdateUnRevFileList();\r
+       int UpdateIgnoreFileList();\r
        void AddEntry(CTGitPath* path, WORD langID, int ListIndex);\r
+       int m_FileLoaded;\r
 };\r
 \r
 #if 0\r
index 55c317a..f4c4cf2 100644 (file)
 #include "GitAdminDir.h"\r
 #include "PathUtils.h"\r
 #include <regex>\r
-\r
+#include "git.h"\r
 #if defined(_MFC_VER)\r
 //#include "MessageBox.h"\r
 //#include "AppUtils.h"\r
 #endif\r
 \r
 using namespace std;\r
-\r
+extern CGit g_Git;\r
 \r
 CTGitPath::CTGitPath(void) :\r
        m_bDirectoryKnown(false),\r
@@ -811,7 +811,30 @@ CTGitPathList::CTGitPathList(const CTGitPath& firstEntry)
 {\r
        AddPath(firstEntry);\r
 }\r
+int CTGitPathList::FillUnRev(int action)\r
+{\r
+       int pos=0;\r
+       this->Clear();\r
+       CTGitPath path;\r
+       \r
+       CString cmd(_T("git.cmd ls-files --exclude-standard --full-name --others"));\r
+       if(action & CTGitPath::LOGACTIONS_IGNORE)\r
+               cmd += _T(" --ignored");\r
+       CString out;\r
+       g_Git.Run(cmd,&out);\r
 \r
+       CString one;\r
+       while( pos>=0 )\r
+       {\r
+               one=out.Tokenize(_T("\n"),pos);\r
+\r
+               //SetFromGit will clear all status\r
+               path.SetFromGit(one);\r
+               path.m_Action=action;\r
+               AddPath(path);\r
+       }\r
+       return 0;\r
+}\r
 int CTGitPathList::ParserFromLog(CString &log)\r
 {\r
        this->Clear();\r
index c62dbbd..9633243 100644 (file)
@@ -293,6 +293,7 @@ public:
        bool WriteToFile(const CString& sFilename, bool bANSI = false) const;\r
        CTGitPath * LookForGitPath(CString path);\r
        int     ParserFromLog(CString &log);\r
+       int FillUnRev(int Action);\r
        int GetAction();\r
        /**\r
         * Load from the path argument string, when the 'path' parameter is used\r
index f3d286a..f351cd7 100644 (file)
@@ -1369,10 +1369,10 @@ bool CBaseView::DrawInlineDiff(CDC *pDC, const CRect &rc, int nLineIndex, const
 \r
        CString diffline;\r
        ExpandChars(pszDiffChars, 0, nDiffLength, diffline);\r
-       svn_diff_t * diff = NULL;\r
-       m_svnlinediff.Diff(&diff, line, line.GetLength(), diffline, diffline.GetLength(), m_bInlineWordDiff);\r
-       if (!diff || !SVNLineDiff::ShowInlineDiff(diff))\r
-               return false;\r
+//     svn_diff_t * diff = NULL;\r
+//     m_svnlinediff.Diff(&diff, line, line.GetLength(), diffline, diffline.GetLength(), m_bInlineWordDiff);\r
+//     if (!diff || !SVNLineDiff::ShowInlineDiff(diff))\r
+//             return false;\r
 \r
        int lineoffset = 0;\r
        std::deque<int> removedPositions;\r
index 886d849..1046937 100644 (file)
@@ -112,7 +112,7 @@ BOOL CCommitDlg::OnInitDialog()
 \r
        UpdateData(FALSE);\r
        \r
-       m_ListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLTEXTSTATUS , _T("CommitDlg"));\r
+       m_ListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS , _T("CommitDlg"));\r
        m_ListCtrl.SetSelectButton(&m_SelectAll);\r
        m_ListCtrl.SetStatLabel(GetDlgItem(IDC_STATISTICS));\r
        m_ListCtrl.SetCancelBool(&m_bCancelled);\r
@@ -629,6 +629,8 @@ UINT CCommitDlg::StatusThread()
        BOOL success = m_ListCtrl.GetStatus(m_pathList);\r
 \r
        m_ListCtrl.UpdateFileList(GIT_REV_ZERO);\r
+       if(this->m_bShowUnversioned)\r
+               m_ListCtrl.UpdateFileList(CGitStatusListCtrl::FILELIST_UNVER);\r
        \r
        m_ListCtrl.CheckIfChangelistsArePresent(false);\r
 \r
@@ -828,7 +830,6 @@ void CCommitDlg::OnBnClickedHelp()
 \r
 void CCommitDlg::OnBnClickedShowunversioned()\r
 {\r
-#if 0\r
        m_tooltips.Pop();       // hide the tooltips\r
        UpdateData();\r
        m_regAddBeforeCommit = m_bShowUnversioned;\r
@@ -836,12 +837,11 @@ void CCommitDlg::OnBnClickedShowunversioned()
        {\r
                DWORD dwShow = m_ListCtrl.GetShowFlags();\r
                if (DWORD(m_regAddBeforeCommit))\r
-                       dwShow |= GitSLC_SHOWUNVERSIONED;\r
+                       dwShow |= SVNSLC_SHOWUNVERSIONED;\r
                else\r
-                       dwShow &= ~GitSLC_SHOWUNVERSIONED;\r
+                       dwShow &= ~SVNSLC_SHOWUNVERSIONED;\r
                m_ListCtrl.Show(dwShow);\r
        }\r
-#endif\r
 }\r
 \r
 void CCommitDlg::OnStnClickedExternalwarning()\r
index b07122a..016d2ab 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\copy.ico"\r
+                               RelativePath="..\Resources\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\copy.ico"\r
+                               RelativePath=".\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
-                               RelativePath=".\open.ico"\r
+                               RelativePath="..\Resources\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\open.ico"\r
+                               RelativePath=".\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\refresh.ico"\r
+                               RelativePath="..\Resources\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\refresh.ico"\r
+                               RelativePath=".\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
-                               RelativePath=".\saveas.ico"\r
+                               RelativePath="..\Resources\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\saveas.ico"\r
+                               RelativePath=".\saveas.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
                                        >\r
                                </File>\r
                        </Filter>\r
-                       <Filter\r
-                               Name="Compare"\r
-                               >\r
-                               <File\r
-                                       RelativePath=".\Commands\ShowCompareCommand.cpp"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath=".\Commands\ShowCompareCommand.h"\r
-                                       >\r
-                               </File>\r
-                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Utility Dialogs"\r
                                RelativePath=".\GitStatusListCtrlHelpers.cpp"\r
                                >\r
                        </File>\r
+                       <Filter\r
+                               Name="Compare"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\Commands\ShowCompareCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\ShowCompareCommand.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
                </Filter>\r
                <File\r
                        RelativePath="Resource.h"\r