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
32 bool bShowDialog = true;
\r
35 dlg.EndRev = SVNRev::REV_HEAD;
\r
36 if (parser.HasKey(_T("startrev")) && parser.HasKey(_T("endrev")))
\r
38 bShowDialog = false;
\r
39 dlg.StartRev = parser.GetLongVal(_T("startrev"));
\r
40 dlg.EndRev = parser.GetLongVal(_T("endrev"));
\r
41 if (parser.HasKey(_T("ignoreeol")) || parser.HasKey(_T("ignorespaces")) || parser.HasKey(_T("ignoreallspaces")))
\r
43 options = SVN::GetOptionsString(parser.HasKey(_T("ignoreeol")), parser.HasKey(_T("ignorespaces")), parser.HasKey(_T("ignoreallspaces")));
\r
46 if ((!bShowDialog)||(dlg.DoModal() == IDOK))
\r
52 options = SVN::GetOptionsString(dlg.m_bIgnoreEOL, dlg.m_IgnoreSpaces);
\r
54 tempfile = blame.BlameToTempFile(cmdLinePath, dlg.StartRev, dlg.EndRev,
\r
55 cmdLinePath.IsUrl() ? SVNRev() : SVNRev::REV_WC, logfile,
\r
56 options, dlg.m_bIncludeMerge, TRUE, TRUE);
\r
57 if (!tempfile.IsEmpty())
\r
59 if (dlg.m_bTextView)
\r
61 //open the default text editor for the result file
\r
62 bRet = !!CAppUtils::StartTextViewer(tempfile);
\r
67 if (parser.HasVal(_T("line")))
\r
69 sVal = _T("/line:");
\r
70 sVal += parser.GetVal(_T("line"));
\r
73 sVal += _T("/path:\"") + cmdLinePath.GetSVNPathString() + _T("\" ");
\r
76 if (dlg.m_bIgnoreEOL)
\r
77 sVal += _T("/ignoreeol ");
\r
78 switch (dlg.m_IgnoreSpaces)
\r
80 case svn_diff_file_ignore_space_change:
\r
81 sVal += _T("/ignorespaces ");
\r
83 case svn_diff_file_ignore_space_all:
\r
84 sVal += _T("/ignoreallspaces ");
\r
89 if (parser.HasKey(_T("ignoreeol")))
\r
90 sVal += _T("/ignoreeol ");
\r
91 if (parser.HasKey(_T("ignorespaces")))
\r
92 sVal += _T("/ignorespaces ");
\r
93 if (parser.HasKey(_T("ignoreallspaces")))
\r
94 sVal += _T("/ignoreallspaces ");
\r
97 bRet = CAppUtils::LaunchTortoiseBlame(tempfile, logfile, cmdLinePath.GetFileOrDirectoryName(), sVal);
\r
102 CMessageBox::Show(hwndExplorer, blame.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR);
\r