1 // TortoiseGit - 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 "PrevDiffCommand.h"
22 #include "GitStatus.h"
23 #include "MessageBox.h"
24 #include "ChangedDlg.h"
25 #include "LogDlgHelper.h"
26 #include "CommonResource.h"
27 #include "FileDiffDlg.h"
29 bool PrevDiffCommand::Execute()
32 //bool bAlternativeTool = !!parser.HasKey(_T("alternative"));
33 if (this->orgCmdLinePath
.IsDirectory())
37 dlg
.m_strRev1
= GIT_REV_ZERO
;
38 dlg
.m_strRev2
= _T("HEAD~1");
39 dlg
.m_sFilter
= this->cmdLinePath
.GetGitPathString();
41 //dlg.m_pathList = CTGitPathList(cmdLinePath);
48 // diff.SetAlternativeTool(bAlternativeTool);
50 st
.GetStatus(cmdLinePath
);
59 revs
.m_pLogCache
=&cache
;
61 revs
.ParserFromLog(&cmdLinePath
,2,CGit::LOG_INFO_ONLY_HASH
);
65 CMessageBox::Show(hWndExplorer
, IDS_ERR_NOPREVREVISION
, IDS_APPNAME
, MB_ICONERROR
);
71 bRet
= !!diff
.Diff(&cmdLinePath
,&cmdLinePath
, GIT_REV_ZERO
, revs
.GetGitRevAt(1).m_CommitHash
.ToString());
76 //if (st.GetLastErrorMsg().IsEmpty())
78 CMessageBox::Show(hWndExplorer
, IDS_ERR_NOPREVREVISION
, IDS_APPNAME
, MB_ICONERROR
);
82 // CMessageBox::Show(hWndExplorer, IDS_ERR_NOSTATUS, IDS_APPNAME, MB_ICONERROR);