Use processdlg to format patch.
[TortoiseGit.git] / src / TortoiseProc / Commands / BlameCommand.cpp
blob3d889cb20103a65fa9e4dc1738aeb91d32c7fdc7
1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2007-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "StdAfx.h"
20 #include "BlameCommand.h"
22 #include "BlameDlg.h"
23 #include "Blame.h"
24 #include "Git.h"
25 #include "AppUtils.h"
26 #include "MessageBox.h"
29 bool BlameCommand::Execute()
31 // bool bRet = false;
32 // bool bShowDialog = true;
33 // CBlameDlg dlg;
34 // CString options;
35 // dlg.DoModal();
36 // dlg.EndRev = GitRev::REV_HEAD;
37 CAppUtils::LaunchTortoiseBlame(orgCmdLinePath.GetWinPath(), _T(""),_T(""));
38 #if 0
39 if (parser.HasKey(_T("startrev")) && parser.HasKey(_T("endrev")))
41 bShowDialog = false;
42 dlg.StartRev = parser.GetLongVal(_T("startrev"));
43 dlg.EndRev = parser.GetLongVal(_T("endrev"));
44 if (parser.HasKey(_T("ignoreeol")) || parser.HasKey(_T("ignorespaces")) || parser.HasKey(_T("ignoreallspaces")))
46 options = SVN::GetOptionsString(parser.HasKey(_T("ignoreeol")), parser.HasKey(_T("ignorespaces")), parser.HasKey(_T("ignoreallspaces")));
49 if ((!bShowDialog)||(dlg.DoModal() == IDOK))
51 CBlame blame;
52 CString tempfile;
53 CString logfile;
54 if (bShowDialog)
55 options = SVN::GetOptionsString(dlg.m_bIgnoreEOL, dlg.m_IgnoreSpaces);
57 tempfile = blame.BlameToTempFile(cmdLinePath, dlg.StartRev, dlg.EndRev,
58 cmdLinePath.IsUrl() ? SVNRev() : SVNRev::REV_WC, logfile,
59 options, dlg.m_bIncludeMerge, TRUE, TRUE);
60 if (!tempfile.IsEmpty())
62 if (dlg.m_bTextView)
64 //open the default text editor for the result file
65 bRet = !!CAppUtils::StartTextViewer(tempfile);
67 else
69 CString sVal;
70 if (parser.HasVal(_T("line")))
72 sVal = _T("/line:");
73 sVal += parser.GetVal(_T("line"));
74 sVal += _T(" ");
76 sVal += _T("/path:\"") + cmdLinePath.GetSVNPathString() + _T("\" ");
77 if (bShowDialog)
79 if (dlg.m_bIgnoreEOL)
80 sVal += _T("/ignoreeol ");
81 switch (dlg.m_IgnoreSpaces)
83 case svn_diff_file_ignore_space_change:
84 sVal += _T("/ignorespaces ");
85 break;
86 case svn_diff_file_ignore_space_all:
87 sVal += _T("/ignoreallspaces ");
90 else
92 if (parser.HasKey(_T("ignoreeol")))
93 sVal += _T("/ignoreeol ");
94 if (parser.HasKey(_T("ignorespaces")))
95 sVal += _T("/ignorespaces ");
96 if (parser.HasKey(_T("ignoreallspaces")))
97 sVal += _T("/ignoreallspaces ");
100 bRet = CAppUtils::LaunchTortoiseBlame(tempfile, logfile, cmdLinePath.GetFileOrDirectoryName(), sVal);
103 else
105 CMessageBox::Show(hwndExplorer, blame.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
108 #endif
109 return TRUE;