OSDN Git Service

1c1e913930dd151ba6759e9a58899219bb5ce196
[tortoisegit/TortoiseGitJp.git] / TortoiseProc / Commands / ShowCompareCommand.cpp
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2008 - TortoiseSVN\r
4 \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
9 \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
14 \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
18 //\r
19 #include "StdAfx.h"\r
20 #include "ShowCompareCommand.h"\r
21 #include "SVNDiff.h"\r
22 \r
23 \r
24 bool ShowCompareCommand::Execute()\r
25 {\r
26         bool            bRet = false;\r
27         SVNDiff         diff(NULL, hwndExplorer);\r
28 \r
29         SVNRev          rev1;\r
30         SVNRev          rev2;\r
31         SVNRev          pegrev;\r
32         SVNRev          headpeg;\r
33 \r
34         CTSVNPath       url1 = CTSVNPath(parser.GetVal(_T("url1")));\r
35         CTSVNPath       url2 = CTSVNPath(parser.GetVal(_T("url2")));\r
36         bool            ignoreancestry = !!parser.HasKey(_T("ignoreancestry"));\r
37         bool            blame = !!parser.HasKey(_T("blame"));\r
38         bool            unified = !!parser.HasKey(_T("unified"));\r
39 \r
40         if (parser.HasVal(_T("revision1")))\r
41                 rev1 = SVNRev(parser.GetVal(_T("revision1")));\r
42         if (parser.HasVal(_T("revision2")))\r
43                 rev2 = SVNRev(parser.GetVal(_T("revision2")));\r
44         if (parser.HasVal(_T("pegrevision")))\r
45                 pegrev = SVNRev(parser.GetVal(_T("pegrevision")));\r
46         if (parser.HasVal(_T("headpegrevision")))\r
47                 diff.SetHEADPeg(SVNRev(parser.GetVal(_T("headpegrevision"))));\r
48         diff.SetAlternativeTool(!!parser.HasKey(_T("alternatediff")));\r
49 \r
50         if (unified)\r
51                 bRet = diff.ShowUnifiedDiff(url1, rev1, url2, rev2, pegrev, ignoreancestry);\r
52         else\r
53                 bRet = diff.ShowCompare(url1, rev1, url2, rev2, pegrev, ignoreancestry, blame);\r
54 \r
55         return bRet;\r
56 }\r