Added another note for sysadmins
[TortoiseGit.git] / src / TortoiseGitBlame / LogListBlameAction.cpp
blob17f1e9a32bd33aebf79d2224a3f6b1ddcd3c1412
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - TortoiseGit
4 // Copyright (C) 2011-2012 Sven Strickroth <email@cs-ware.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "stdafx.h"
22 #include "GitBlameLogList.h"
23 #include "GitRev.h"
24 #include "TortoiseGitBlameDoc.h"
25 #include "TortoiseGitBlameView.h"
26 #include "MainFrm.h"
27 #include "CommonAppUtils.h"
29 IMPLEMENT_DYNAMIC(CGitBlameLogList, CHintListCtrl)
31 void CGitBlameLogList::hideUnimplementedCommands()
33 hideFromContextMenu(
34 GetContextMenuBit(ID_COMPAREWITHPREVIOUS) |
35 GetContextMenuBit(ID_COPYCLIPBOARD) |
36 GetContextMenuBit(ID_COPYHASH) |
37 GetContextMenuBit(ID_EXPORT) |
38 GetContextMenuBit(ID_CREATE_BRANCH) |
39 GetContextMenuBit(ID_CREATE_TAG) |
40 GetContextMenuBit(ID_SWITCHTOREV)
41 , true);
42 m_ContextMenuMask |= GetContextMenuBit(ID_LOG) | GetContextMenuBit(ID_BLAME) | GetContextMenuBit(ID_REPOBROWSE);
45 void CGitBlameLogList::ContextMenuAction(int cmd, int /*FirstSelect*/, int /*LastSelect*/, CMenu * /*menu*/)
47 POSITION pos = GetFirstSelectedItemPosition();
48 int indexNext = GetNextSelectedItem(pos);
49 if (indexNext < 0)
50 return;
52 CString procCmd = _T("/path:\"");
53 procCmd += ((CMainFrame*)::AfxGetApp()->GetMainWnd())->GetActiveView()->GetDocument()->GetPathName();
54 procCmd += _T("\" ");
55 procCmd += _T(" /rev:")+this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString();
57 procCmd += _T(" /command:");
59 switch (cmd)
61 case ID_GNUDIFF1:
62 procCmd += _T("diff /udiff");
63 break;
64 case ID_COMPAREWITHPREVIOUS:
65 if (indexNext + 1 < m_logEntries.size()) // cannot diff previous revision in first revision
67 procCmd+=CString(_T("diff /startrev:"))+this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString()+CString(_T(" /endrev:"))+this->m_logEntries.GetGitRevAt(indexNext+1).m_CommitHash.ToString();
69 else
71 return;
73 break;
74 case ID_COPYCLIPBOARD:
76 CopySelectionToClipBoard();
78 return;
79 case ID_COPYHASH:
81 CopySelectionToClipBoard(ID_COPY_HASH);
83 return;
84 case ID_EXPORT:
85 procCmd += _T("export");
86 break;
87 case ID_CREATE_BRANCH:
88 procCmd += _T("branch");
89 break;
90 case ID_CREATE_TAG:
91 procCmd += _T("tag");
92 break;
93 case ID_SWITCHTOREV:
94 procCmd += _T("switch");
95 break;
96 case ID_BLAME:
97 procCmd += _T("blame");
98 procCmd += _T(" /endrev:") + this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString();
99 break;
100 case ID_LOG:
101 procCmd += _T("log");
102 break;
103 case ID_REPOBROWSE:
104 procCmd.Format(_T("/command:repobrowser /path:\"%s\" /rev:%s"), g_Git.m_CurrentDir, this->m_logEntries.GetGitRevAt(indexNext).m_CommitHash.ToString());
105 break;
106 default:
107 //CMessageBox::Show(NULL,_T("Have not implemented"),_T("TortoiseGit"),MB_OK);
108 return;
109 } // switch (cmd)
111 CCommonAppUtils::RunTortoiseGitProc(procCmd);