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