OSDN Git Service

Add Resolve to explore context menu
[tortoisegit/TortoiseGitJp.git] / src / TortoiseShell / ContextMenu.cpp
index c341248..5f819b6 100644 (file)
@@ -73,6 +73,9 @@ CShellExt::MenuInfo CShellExt::menuInfo[] =
        { ShellMenuShowChanged,                                 MENUSHOWCHANGED,        IDI_SHOWCHANGED,                IDS_MENUSHOWCHANGED,            IDS_MENUDESCSHOWCHANGED,\r
        ITEMIS_INSVN|ITEMIS_ONLYONE, 0, ITEMIS_FOLDER|ITEMIS_FOLDERINSVN|ITEMIS_ONLYONE, 0, 0, 0, 0, 0},\r
 \r
+       { ShellMenuRebase,                                          MENUREBASE,                 IDI_SHOWCHANGED,                IDS_MENUREBASE,                         IDS_MENUREBASE,\r
+       ITEMIS_INSVN|ITEMIS_ONLYONE, 0, ITEMIS_FOLDER|ITEMIS_FOLDERINSVN|ITEMIS_ONLYONE, 0, 0, 0, 0, 0},\r
+\r
 //     { ShellMenuRevisionGraph,                               MENUREVISIONGRAPH,      IDI_REVISIONGRAPH,              IDS_MENUREVISIONGRAPH,          IDS_MENUDESCREVISIONGRAPH,\r
 //     ITEMIS_INSVN|ITEMIS_ONLYONE, ITEMIS_ADDED, ITEMIS_FOLDER|ITEMIS_FOLDERINSVN|ITEMIS_ONLYONE, ITEMIS_ADDED, 0, 0, 0, 0},\r
 \r
@@ -81,8 +84,8 @@ CShellExt::MenuInfo CShellExt::menuInfo[] =
        { ShellMenuConflictEditor,                              MENUCONFLICTEDITOR,     IDI_CONFLICT,                   IDS_MENUCONFLICT,                       IDS_MENUDESCCONFLICT,\r
        ITEMIS_INSVN|ITEMIS_CONFLICTED, ITEMIS_FOLDER, 0, 0, 0, 0, 0, 0 },\r
 \r
-//     { ShellMenuResolve,                                             MENURESOLVE,            IDI_RESOLVE,                    IDS_MENURESOLVE,                        IDS_MENUDESCRESOLVE,\r
-//     ITEMIS_INSVN|ITEMIS_CONFLICTED, 0, ITEMIS_INSVN|ITEMIS_FOLDER, 0, ITEMIS_FOLDERINSVN, 0, 0, 0 },\r
+       { ShellMenuResolve,                                             MENURESOLVE,            IDI_RESOLVE,                    IDS_MENURESOLVE,                        IDS_MENUDESCRESOLVE,\r
+       ITEMIS_INSVN|ITEMIS_CONFLICTED, 0, ITEMIS_INSVN|ITEMIS_FOLDER, 0, ITEMIS_FOLDERINSVN, 0, 0, 0 },\r
 \r
 //     { ShellMenuUpdateExt,                                   MENUUPDATEEXT,          IDI_UPDATE,                             IDS_MENUUPDATEEXT,                      IDS_MENUDESCUPDATEEXT,\r
 //     ITEMIS_INSVN, ITEMIS_ADDED, ITEMIS_FOLDERINSVN, ITEMIS_ADDED, 0, 0, 0, 0 },\r
@@ -157,6 +160,8 @@ CShellExt::MenuInfo CShellExt::menuInfo[] =
 \r
        { ShellMenuBlame,                                               MENUBLAME,                      IDI_BLAME,                              IDS_MENUBLAME,                          IDS_MENUDESCBLAME,\r
        ITEMIS_NORMAL|ITEMIS_ONLYONE, ITEMIS_FOLDER|ITEMIS_ADDED, 0, 0, 0, 0, 0, 0 },\r
+       // TODO: original code is ITEMIS_INSVN|ITEMIS_ONLYONE, makes sense to only allow blaming of versioned files\r
+       //       why was this changed, is this related to GitStatus?\r
 \r
        { ShellMenuIgnoreSub,                                   MENUIGNORE,                     IDI_IGNORE,                             IDS_MENUIGNORE,                         IDS_MENUDESCIGNORE,\r
        ITEMIS_INVERSIONEDFOLDER, ITEMIS_IGNORED|ITEMIS_INSVN, 0, 0, 0, 0, 0, 0 },\r
@@ -336,13 +341,14 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                                                                ATLTRACE2(_T("Exception in GitStatus::GetStatus()\n"));\r
                                                        }\r
 \r
+                                                       // TODO: should we really assume any sub-directory to be versioned\r
+                                                       //       or only if it contains versioned files\r
                                                        if ( askedpath.IsDirectory() )\r
                                                        {\r
                                                                if (askedpath.HasAdminDir())\r
                                                                        itemStates |= ITEMIS_INSVN;\r
                                                        }\r
                                                        if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
-                                                       //if (askedpath.HasAdminDir())\r
                                                                itemStates |= ITEMIS_INSVN;\r
                                                        if (status == git_wc_status_ignored)\r
                                                                itemStates |= ITEMIS_IGNORED;\r
@@ -444,13 +450,14 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                                                                }\r
                                                        }\r
 \r
+                                                       // TODO: should we really assume any sub-directory to be versioned\r
+                                                       //       or only if it contains versioned files\r
                                                        if ( strpath.IsDirectory() )\r
                                                        {\r
                                                                if (strpath.HasAdminDir())\r
                                                                        itemStates |= ITEMIS_INSVN;\r
                                                        }\r
                                                        if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
-                                                       //if (strpath.HasAdminDir())\r
                                                                itemStates |= ITEMIS_INSVN;\r
                                                        if (status == git_wc_status_ignored)\r
                                                        {\r
@@ -1169,13 +1176,8 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
                                        }\r
                                        else\r
                                        {\r
-                                               // the 'get lock' command is special\r
                                                bool bIsTop = ((topmenu & menuInfo[menuIndex].menuID) != 0);\r
-                                               if (menuInfo[menuIndex].command == ShellMenuLock)\r
-                                               {\r
-                                                       if ((itemStates & ITEMIS_NEEDSLOCK) && g_ShellCache.IsGetLockTop())\r
-                                                               bIsTop = true;\r
-                                               }\r
+\r
                                                // insert the menu entry\r
                                                InsertGitMenu(  bIsTop,\r
                                                                                bIsTop ? hMenu : subMenu,\r
@@ -1616,6 +1618,14 @@ STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
                                        svnCmd += folder_;\r
                                svnCmd += _T("\"");\r
                                break;\r
+                       case ShellMenuRebase:\r
+                               svnCmd += _T("rebase /path:\"");\r
+                               if (files_.size() > 0)\r
+                                       svnCmd += files_.front();\r
+                               else\r
+                                       svnCmd += folder_;\r
+                               svnCmd += _T("\"");\r
+                               break;\r
                        case ShellMenuShowChanged:\r
                                if (files_.size() > 1)\r
                 {\r
@@ -1755,28 +1765,6 @@ STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
                                        svnCmd += folder_;\r
                                svnCmd += _T("\"");\r
                                break;\r
-                       case ShellMenuLock:\r
-                               tempfile = WriteFileListToTempFile();\r
-                               svnCmd += _T("lock /pathfile:\"");\r
-                               svnCmd += tempfile;\r
-                               svnCmd += _T("\"");\r
-                               svnCmd += _T(" /deletepathfile");\r
-                               break;\r
-                       case ShellMenuUnlock:\r
-                               tempfile = WriteFileListToTempFile();\r
-                               svnCmd += _T("unlock /pathfile:\"");\r
-                               svnCmd += tempfile;\r
-                               svnCmd += _T("\"");\r
-                               svnCmd += _T(" /deletepathfile");\r
-                               break;\r
-                       case ShellMenuUnlockForce:\r
-                               tempfile = WriteFileListToTempFile();\r
-                               svnCmd += _T("unlock /pathfile:\"");\r
-                               svnCmd += tempfile;\r
-                               svnCmd += _T("\"");\r
-                               svnCmd += _T(" /deletepathfile");\r
-                               svnCmd += _T(" /force");\r
-                               break;\r
                        case ShellMenuProperties:\r
                                tempfile = WriteFileListToTempFile();\r
                                svnCmd += _T("properties /pathfile:\"");\r
@@ -2145,18 +2133,6 @@ LPCTSTR CShellExt::GetMenuTextFromResource(int id)
                        resource = MAKEINTRESOURCE(menuInfo[menuIndex].iconID);\r
                        switch (id)\r
                        {\r
-                       case ShellMenuLock:\r
-                               // menu lock is special because it can be set to the top\r
-                               // with a separate option in the registry\r
-                               space = ((layout & MENULOCK) || ((itemStates & ITEMIS_NEEDSLOCK) && g_ShellCache.IsGetLockTop())) ? 0 : 6;\r
-                               if ((layout & MENULOCK) || ((itemStates & ITEMIS_NEEDSLOCK) && g_ShellCache.IsGetLockTop()))\r
-                               {\r
-                                       _tcscpy_s(textbuf, 255, _T("Git "));\r
-                                       _tcscat_s(textbuf, 255, stringtablebuffer);\r
-                                       _tcscpy_s(stringtablebuffer, 255, textbuf);\r
-                               }\r
-                               break;\r
-                               // the sub menu entries are special because they're *always* on the top level menu\r
                        case ShellSubMenuMultiple:\r
                        case ShellSubMenuLink:\r
                        case ShellSubMenuFolder:\r