OSDN Git Service

BrowseRefs: Add option to start reflog from BrowseRefs dialog.
authorJohan 't Hart <johanthart@gmail.com>
Wed, 3 Jun 2009 23:27:17 +0000 (01:27 +0200)
committerJohan 't Hart <johanthart@gmail.com>
Wed, 3 Jun 2009 23:27:17 +0000 (01:27 +0200)
src/TortoiseProc/BrowseRefsDlg.cpp
src/TortoiseProc/BrowseRefsDlg.h

index 05d046c..ab3d3f7 100644 (file)
@@ -10,6 +10,7 @@
 #include "Settings\SettingGitRemote.h"\r
 #include "SinglePropSheetDlg.h"\r
 #include "MessageBox.h"\r
+#include "RefLogDlg.h"\r
 \r
 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending)\r
 {\r
@@ -509,11 +510,27 @@ void CBrowseRefsDlg::ShowContextMenu(CPoint point, HTREEITEM hTreePos, VectorPSh
 \r
        if(selectedLeafs.size()==1)\r
        {\r
+               bool bShowReflogOption = false;\r
                popupMenu.AppendMenu(MF_STRING,eCmd_ViewLog,L"View log");\r
                if(selectedLeafs[0]->IsFrom(L"refs/heads"))\r
+               {\r
                        popupMenu.AppendMenu(MF_STRING,eCmd_DeleteBranch,L"Delete Branch");\r
+                       bShowReflogOption = true;\r
+               }\r
+               else if(selectedLeafs[0]->IsFrom(L"refs/remotes"))\r
+               {\r
+                       bShowReflogOption = true;\r
+               }\r
                else if(selectedLeafs[0]->IsFrom(L"refs/tags"))\r
+               {\r
                        popupMenu.AppendMenu(MF_STRING,eCmd_DeleteTag,L"Delete Tag");\r
+               }\r
+\r
+               if(bShowReflogOption)\r
+                       popupMenu.AppendMenu(MF_STRING, eCmd_ShowReflog, L"Show Reflog");\r
+\r
+\r
+\r
 \r
 //             CShadowTree* pTree = (CShadowTree*)m_ListRefLeafs.GetItemData(pNMHDR->idFrom);\r
 //             if(pTree==NULL)\r
@@ -560,6 +577,13 @@ void CBrowseRefsDlg::ShowContextMenu(CPoint point, HTREEITEM hTreePos, VectorPSh
                        Refresh();\r
                }\r
                break;\r
+       case eCmd_ShowReflog:\r
+               {\r
+                       CRefLogDlg refLogDlg(this);\r
+                       refLogDlg.m_CurrentBranch = selectedLeafs[0]->GetRefName();\r
+                       refLogDlg.DoModal();\r
+               }\r
+               break;\r
        case eCmd_AddRemote:\r
                {\r
                        CAddRemoteDlg(this).DoModal();\r
index 16391be..5bfa067 100644 (file)
@@ -65,7 +65,8 @@ public:
                eCmd_CreateBranch,\r
                eCmd_CreateTag,\r
                eCmd_DeleteBranch,\r
-               eCmd_DeleteTag\r
+               eCmd_DeleteTag,\r
+               eCmd_ShowReflog\r
        };\r
 \r
        enum eCol\r