OSDN Git Service

Enable formatpatch at log dialog
authorFrank Li <lznuaa@gmail.com>
Tue, 28 Apr 2009 06:38:08 +0000 (14:38 +0800)
committerFrank Li <lznuaa@gmail.com>
Tue, 28 Apr 2009 07:14:26 +0000 (15:14 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Resources/CommonResource.h
src/Resources/TortoiseCommon.rc2
src/TortoiseProc/Commands/FormatPatchCommand.cpp
src/TortoiseProc/FormatPatchDlg.cpp
src/TortoiseProc/GitLogListAction.cpp
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/GitLogListBase.h
src/TortoiseProc/TortoiseProc.vcproj

index bc3583e..e875d91 100644 (file)
@@ -67,4 +67,5 @@
 #define IDS_COMBINE_TO_ONE                             20065\r
 #define IDS_CHERRY_PICK_VERSION                        20066\r
 #define IDS_COPY_COMMIT_HASH                   20067\r
+#define IDS_CREATE_PATCH                               20068\r
 \r
index e74c38e..e4816f7 100644 (file)
@@ -76,6 +76,7 @@ BEGIN
        IDS_COMBINE_TO_ONE                      "*Combine to one commit"\r
        IDS_CHERRY_PICK_VERSION         "Cherry Pick this version..."\r
        IDS_COPY_COMMIT_HASH            "Copy Commit Hash"\r
+       IDS_CREATE_PATCH                        "Format Patch..."\r
        \r
 END \r
 \r
index f5e7cb2..b3fa3ea 100644 (file)
@@ -33,7 +33,21 @@ bool FormatPatchCommand::Execute()
 {\r
        CFormatPatchDlg dlg;\r
 //     dlg.m_bIsTag=TRUE;\r
-       \r
+       CString startval = parser.GetVal(_T("startrev"));\r
+       CString endval = parser.GetVal(_T("endrev"));\r
+\r
+       if( endval.IsEmpty() && (!startval.IsEmpty()))\r
+       {\r
+               dlg.m_Since=startval;\r
+               dlg.m_Radio = IDC_RADIO_SINCE;\r
+\r
+       }else if( (!endval.IsEmpty()) && (!startval.IsEmpty()))\r
+       {\r
+               dlg.m_From=startval;\r
+               dlg.m_To=endval;\r
+               dlg.m_Radio = IDC_RADIO_RANGE;\r
+       }\r
+\r
        if(dlg.DoModal()==IDOK)\r
        {\r
                CString cmd;\r
index 5b613fd..f644b94 100644 (file)
@@ -16,6 +16,7 @@ CFormatPatchDlg::CFormatPatchDlg(CWnd* pParent /*=NULL*/)
 {\r
        m_Num=1;\r
        this->m_bSendMail = m_regSendMail;\r
+       this->m_Radio = IDC_RADIO_SINCE;\r
 }\r
 \r
 CFormatPatchDlg::~CFormatPatchDlg()\r
@@ -84,13 +85,22 @@ BOOL CFormatPatchDlg::OnInitDialog()
        g_Git.GetBranchList(list,NULL,CGit::BRANCH_ALL);\r
        m_cSince.AddString(list);\r
 \r
+       if(!m_Since.IsEmpty())\r
+               m_cSince.SetWindowText(m_Since);\r
+\r
        m_cFrom.LoadHistory(_T("Software\\TortoiseGit\\History\\FormatPatchFromURLS"), _T("ver"));\r
        m_cFrom.SetCurSel(0);\r
 \r
+       if(!m_From.IsEmpty())\r
+               m_cFrom.SetWindowText(m_From);\r
+\r
        m_cTo.LoadHistory(_T("Software\\TortoiseGit\\History\\FormatPatchToURLS"), _T("ver"));\r
        m_cTo.SetCurSel(0);\r
 \r
-       this->CheckRadioButton(IDC_RADIO_SINCE,IDC_RADIO_RANGE,IDC_RADIO_SINCE);\r
+       if(!m_To.IsEmpty())\r
+               m_cTo.SetWindowText(m_To);\r
+\r
+       this->CheckRadioButton(IDC_RADIO_SINCE,IDC_RADIO_RANGE,this->m_Radio);\r
        \r
        OnBnClickedRadio();\r
 \r
index 63c33cf..a40b32e 100644 (file)
@@ -437,6 +437,38 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)
                                }\r
                        }\r
                        break;\r
+               case ID_CREATE_PATCH:\r
+                       {\r
+                               int select=this->GetSelectedCount();\r
+                               CString cmd;\r
+                               cmd = CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe");\r
+                               cmd += _T(" /command:formatpatch");\r
+\r
+                               GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
+                               GitRev * r2 = NULL;\r
+                               if(select == 1)\r
+                               {\r
+                                       cmd += _T(" /startrev:")+r1->m_CommitHash;\r
+                               }\r
+                               else \r
+                               {\r
+                                       r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
+                                       if( this->m_IsOldFirst )\r
+                                       {       \r
+                                               cmd += _T(" /startrev:")+r1->m_CommitHash;\r
+                                               cmd += _T(" /endrev:")+r2->m_CommitHash;\r
+       \r
+                                       }else\r
+                                       {       \r
+                                               cmd += _T(" /startrev:")+r2->m_CommitHash;\r
+                                               cmd += _T(" /endrev:")+r1->m_CommitHash;        \r
+                                       }                               \r
+                                       \r
+                               }\r
+\r
+                               CAppUtils::LaunchApplication(cmd,IDS_ERR_PROC,false);\r
+                       }\r
+                       break;\r
                default:\r
                        //CMessageBox::Show(NULL,_T("Have not implemented"),_T("TortoiseGit"),MB_OK);\r
                        break;\r
index 29ba187..6dd415e 100644 (file)
@@ -1191,6 +1191,11 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                        }\r
                        if(m_ContextMenuMask&GetContextMenuBit(ID_CHERRY_PICK))\r
                                popup.AppendMenuIcon(ID_CHERRY_PICK, IDS_CHERRY_PICK_VERSION, IDI_EXPORT);\r
+\r
+                       if(GetSelectedCount()<=2)\r
+                               if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_PATCH))\r
+                                       popup.AppendMenuIcon(ID_CREATE_PATCH, IDS_CREATE_PATCH, IDI_PATCH);\r
+                       \r
                        popup.AppendMenu(MF_SEPARATOR, NULL);\r
        \r
                }\r
index ac6f6ca..b91a7d2 100644 (file)
@@ -143,6 +143,7 @@ public:
        ID_STASH_APPLY,\r
        ID_REFLOG_DEL,\r
        ID_REBASE_TO_VERSION,\r
+       ID_CREATE_PATCH,\r
        };\r
        inline unsigned __int64 GetContextMenuBit(int i){ return ((unsigned __int64 )0x1)<<i ;}\r
        void InsertGitColumn();\r
index d0d4733..eef9e2a 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>\r
 <VisualStudioProject\r
        ProjectType="Visual C++"\r
-       Version="9,00"\r
+       Version="9.00"\r
        Name="TortoiseProc"\r
        ProjectGUID="{50797F06-39C5-4802-8E2B-7B7A4EF03214}"\r
        RootNamespace="TortoiseProc"\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory="..\..\bin\$(ConfigurationName)\bin"\r
-                       IntermediateDirectory="..\..\obj\TortoiseProc\$(ConfigurationName)"\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="..\..\bin\Debug64\bin"\r
+                       IntermediateDirectory="..\..\obj\TortoiseProc\Debug64"\r
                        ConfigurationType="1"\r
                        UseOfMFC="2"\r
+                       UseOfATL="0"\r
                        CharacterSet="1"\r
-                       WholeProgramOptimization="1"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
+                               PreprocessorDefinitions="_DEBUG"\r
                                MkTypLibCompatible="false"\r
+                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
                                AdditionalIncludeDirectories="..\TortoiseProc;..\Resources;&quot;$InputDir&quot;;../../ext/ResizableLib;../Git;&quot;../../ext/apr-util/include&quot;;&quot;../../ext/apr-util/xml/expat/lib&quot;;../../ext/Subversion/subversion/include;../../ext/Subversion/subversion/libsvn_client;../../ext/apr/include;../../ext/boost;..\Utils;..\SVN;..\..\ext\ResizableLib;..\crashrpt;&quot;..\..\ext\libintl\libintl3-win32\inc&quot;;..\..\ext\hunspell;..\..\ext\scintilla\include;..\Utils\TreePropSheet;..\Utils\ColourPickerXP;..\Utils\NewMenu;..\Utils\MiscUI;..\LogCache;&quot;../../ext/cyrus-sasl/include&quot;;../../../common/openssl/inc32;.\RevisionGraph;..\TortoiseShell"\r
-                               PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;THESAURUS"\r
-                               StringPooling="true"\r
-                               MinimalRebuild="false"\r
+                               PreprocessorDefinitions="WIN64;_WINDOWS;_DEBUG;SVN_DEBUG;ENABLE_NLS;THESAURUS"\r
+                               MinimalRebuild="true"\r
                                ExceptionHandling="2"\r
-                               RuntimeLibrary="2"\r
-                               BufferSecurityCheck="false"\r
+                               RuntimeLibrary="3"\r
                                TreatWChar_tAsBuiltInType="true"\r
                                ForceConformanceInForLoopScope="true"\r
                                RuntimeTypeInfo="true"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="4"\r
                                DebugInformationFormat="3"\r
-                               DisableSpecificWarnings="4996,4018"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                        />\r
                        <Tool\r
                                Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
+                               PreprocessorDefinitions="_DEBUG"\r
                                Culture="1033"\r
                                AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\TortoiseShell"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalDependencies="Crypt32.lib gdiplus.lib shfolder.lib shell32.lib comctl32.lib ws2_32.lib rpcrt4.lib shlwapi.lib wininet.lib version.lib Dnsapi.lib"\r
-                               LinkIncremental="1"\r
-                               AdditionalLibraryDirectories="../../ext/wingit"\r
+                               LinkIncremental="2"\r
                                IgnoreDefaultLibraryNames=""\r
                                DelayLoadDLLs="gdiplus.dll"\r
                                GenerateDebugInformation="true"\r
                                SubSystem="2"\r
-                               OptimizeReferences="2"\r
-                               EnableCOMDATFolding="2"\r
-                               OptimizeForWindows98="0"\r
                                RandomizedBaseAddress="1"\r
                                DataExecutionPrevention="0"\r
-                               TargetMachine="1"\r
-                               Profile="true"\r
+                               TargetMachine="17"\r
                        />\r
                        <Tool\r
                                Name="VCALinkTool"\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Debug|x64"\r
-                       OutputDirectory="..\..\bin\Debug64\bin"\r
-                       IntermediateDirectory="..\..\obj\TortoiseProc\Debug64"\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="..\..\bin\$(ConfigurationName)\bin"\r
+                       IntermediateDirectory="..\..\obj\TortoiseProc\$(ConfigurationName)"\r
                        ConfigurationType="1"\r
                        UseOfMFC="2"\r
-                       UseOfATL="0"\r
                        CharacterSet="1"\r
+                       WholeProgramOptimization="1"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
+                               PreprocessorDefinitions="NDEBUG"\r
                                MkTypLibCompatible="false"\r
-                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
                                AdditionalIncludeDirectories="..\TortoiseProc;..\Resources;&quot;$InputDir&quot;;../../ext/ResizableLib;../Git;&quot;../../ext/apr-util/include&quot;;&quot;../../ext/apr-util/xml/expat/lib&quot;;../../ext/Subversion/subversion/include;../../ext/Subversion/subversion/libsvn_client;../../ext/apr/include;../../ext/boost;..\Utils;..\SVN;..\..\ext\ResizableLib;..\crashrpt;&quot;..\..\ext\libintl\libintl3-win32\inc&quot;;..\..\ext\hunspell;..\..\ext\scintilla\include;..\Utils\TreePropSheet;..\Utils\ColourPickerXP;..\Utils\NewMenu;..\Utils\MiscUI;..\LogCache;&quot;../../ext/cyrus-sasl/include&quot;;../../../common/openssl/inc32;.\RevisionGraph;..\TortoiseShell"\r
-                               PreprocessorDefinitions="WIN64;_WINDOWS;_DEBUG;SVN_DEBUG;ENABLE_NLS;THESAURUS"\r
-                               MinimalRebuild="true"\r
+                               PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;THESAURUS"\r
+                               StringPooling="true"\r
+                               MinimalRebuild="false"\r
                                ExceptionHandling="2"\r
-                               RuntimeLibrary="3"\r
+                               RuntimeLibrary="2"\r
+                               BufferSecurityCheck="false"\r
                                TreatWChar_tAsBuiltInType="true"\r
                                ForceConformanceInForLoopScope="true"\r
                                RuntimeTypeInfo="true"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="4"\r
                                DebugInformationFormat="3"\r
+                               DisableSpecificWarnings="4996,4018"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                        />\r
                        <Tool\r
                                Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
+                               PreprocessorDefinitions="NDEBUG"\r
                                Culture="1033"\r
                                AdditionalIncludeDirectories="&quot;$(IntDir)&quot;;..\TortoiseShell"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalDependencies="Crypt32.lib gdiplus.lib shfolder.lib shell32.lib comctl32.lib ws2_32.lib rpcrt4.lib shlwapi.lib wininet.lib version.lib Dnsapi.lib"\r
-                               LinkIncremental="2"\r
+                               LinkIncremental="1"\r
+                               AdditionalLibraryDirectories="../../ext/wingit"\r
                                IgnoreDefaultLibraryNames=""\r
                                DelayLoadDLLs="gdiplus.dll"\r
                                GenerateDebugInformation="true"\r
                                SubSystem="2"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               OptimizeForWindows98="0"\r
                                RandomizedBaseAddress="1"\r
                                DataExecutionPrevention="0"\r
-                               TargetMachine="17"\r
+                               TargetMachine="1"\r
+                               Profile="true"\r
                        />\r
                        <Tool\r
                                Name="VCALinkTool"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\copy.ico"\r
+                               RelativePath=".\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\copy.ico"\r
+                               RelativePath="..\Resources\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\refresh.ico"\r
+                               RelativePath=".\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\refresh.ico"\r
+                               RelativePath="..\Resources\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                />\r
                        </FileConfiguration>\r
                        <FileConfiguration\r
-                               Name="Release|Win32"\r
+                               Name="Debug|x64"\r
                                >\r
                                <Tool\r
                                        Name="VCCLCompilerTool"\r
                                />\r
                        </FileConfiguration>\r
                        <FileConfiguration\r
-                               Name="Debug|x64"\r
+                               Name="Release|Win32"\r
                                >\r
                                <Tool\r
                                        Name="VCCLCompilerTool"\r