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.
20 #include "BlameCommand.h"
26 #include "MessageBox.h"
29 bool BlameCommand::Execute()
32 // bool bShowDialog = true;
36 // dlg.EndRev = GitRev::REV_HEAD;
37 CAppUtils::LaunchTortoiseBlame(orgCmdLinePath
.GetWinPath(), _T(""),_T(""));
39 if (parser
.HasKey(_T("startrev")) && parser
.HasKey(_T("endrev")))
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
))
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())
64 //open the default text editor for the result file
65 bRet
= !!CAppUtils::StartTextViewer(tempfile
);
70 if (parser
.HasVal(_T("line")))
73 sVal
+= parser
.GetVal(_T("line"));
76 sVal
+= _T("/path:\"") + cmdLinePath
.GetSVNPathString() + _T("\" ");
80 sVal
+= _T("/ignoreeol ");
81 switch (dlg
.m_IgnoreSpaces
)
83 case svn_diff_file_ignore_space_change
:
84 sVal
+= _T("/ignorespaces ");
86 case svn_diff_file_ignore_space_all
:
87 sVal
+= _T("/ignoreallspaces ");
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
);
105 CMessageBox::Show(hwndExplorer
, blame
.GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR
);