Use processdlg to format patch.
[TortoiseGit.git] / src / TortoiseProc / Commands / DiffCommand.cpp
blobdd081f88e1696ce2ee65f252dcf209653061370d
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 (cmdLinePath.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 0
47 if ( parser.HasKey(_T("startrev")) && parser.HasKey(_T("endrev")) )
49 //SVNRev StartRevision = SVNRev(parser.GetLongVal(_T("startrev")));
50 //SVNRev EndRevision = SVNRev(parser.GetLongVal(_T("endrev")));
51 //bRet = diff.ShowCompare(cmdLinePath, StartRevision, cmdLinePath, EndRevision, SVNRev(), false, bBlame);
53 else
54 #endif
56 //git_revnum_t baseRev = 0;
57 bRet = diff.Diff(&cmdLinePath,&cmdLinePath,git_revnum_t(GIT_REV_ZERO),git_revnum_t(_T("HEAD")));
61 else
62 bRet = CAppUtils::StartExtDiff(
63 path2, orgCmdLinePath.GetWinPathString(), CString(), CString(),
64 CAppUtils::DiffFlags().AlternativeTool(bAlternativeTool));
65 return bRet;