Enable security checks and features
[TortoiseGit.git] / src / TortoiseProc / Commands / DiffCommand.cpp
blob4a9c4fdd9c1133896212a0df40de65f97854a340
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 "DiffCommand.h"
21 #include "PathUtils.h"
22 #include "AppUtils.h"
23 #include "ChangedDlg.h"
24 #include "GitDiff.h"
25 #include "GitStatus.h"
27 bool DiffCommand::Execute()
29 bool bRet = false;
30 CString path2 = CPathUtils::GetLongPathname(parser.GetVal(_T("path2")));
31 bool bAlternativeTool = !!parser.HasKey(_T("alternative"));
32 // bool bBlame = !!parser.HasKey(_T("blame"));
33 if (path2.IsEmpty())
35 if (this->orgCmdLinePath.IsDirectory())
37 CChangedDlg dlg;
38 dlg.m_pathList = CTGitPathList(cmdLinePath);
39 dlg.DoModal();
40 bRet = true;
42 else
44 CGitDiff diff;
45 //diff.SetAlternativeTool(bAlternativeTool);
46 if ( parser.HasKey(_T("startrev")) && parser.HasKey(_T("endrev")) )
48 bRet = !!diff.Diff(&cmdLinePath,&cmdLinePath,git_revnum_t(parser.GetVal(_T("startrev"))),git_revnum_t(parser.GetVal(_T("endrev"))));
50 else
52 //git_revnum_t baseRev = 0;
53 bRet = !!diff.Diff(&cmdLinePath,&cmdLinePath,git_revnum_t(GIT_REV_ZERO),git_revnum_t(_T("HEAD")));
57 else
58 bRet = CAppUtils::StartExtDiff(
59 path2, orgCmdLinePath.GetWinPathString(), CString(), CString(),
60 CAppUtils::DiffFlags().AlternativeTool(bAlternativeTool));
61 return bRet;