OSDN Git Service

Fixed issue #144: Attaching message to a merge
authorFrank Li <lznuaa@gmail.com>
Sat, 15 Aug 2009 06:33:10 +0000 (14:33 +0800)
committerFrank Li <lznuaa@gmail.com>
Sat, 15 Aug 2009 06:33:59 +0000 (14:33 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/Commands/MergeCommand.cpp
src/TortoiseProc/MergeDlg.cpp
src/TortoiseProc/MergeDlg.h
src/TortoiseProc/resource.h

index 39f3cbd..c19275a 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index ff5a530..c4ff691 100644 (file)
@@ -30,6 +30,7 @@ bool MergeCommand::Execute()
                CString cmd;\r
                CString noff;\r
                CString squash;\r
+               CString msg;\r
 \r
                if(dlg.m_bNoFF)\r
                        noff=_T("--no-ff");\r
@@ -37,7 +38,12 @@ bool MergeCommand::Execute()
                if(dlg.m_bSquash)\r
                        squash=_T("--squash");\r
 \r
-               cmd.Format(_T("git.exe merge %s %s %s"),\r
+               if(!dlg.m_strLogMesage.IsEmpty())\r
+               {       \r
+                       msg+=_T("-m \"")+dlg.m_strLogMesage+_T("\"");\r
+               }\r
+               cmd.Format(_T("git.exe merge %s %s %s %s"),\r
+                       msg,\r
                        noff,\r
                        squash,\r
                        dlg.m_VersionName);\r
index 5170cc3..36b7cb6 100644 (file)
@@ -1,3 +1,22 @@
+// TortoiseGit - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2007-2009 - TortoiseGit\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+\r
 // MergeDlg.cpp : implementation file\r
 //\r
 \r
@@ -17,7 +36,9 @@ CMergeDlg::CMergeDlg(CWnd* pParent /*=NULL*/)
        : CResizableStandAloneDialog(CMergeDlg::IDD, pParent),\r
        CChooseVersion(this)\r
 {\r
-\r
+       \r
+       m_pDefaultText = _T("<Auto Generated by Git>");\r
+       \r
 }\r
 \r
 CMergeDlg::~CMergeDlg()\r
@@ -32,6 +53,7 @@ void CMergeDlg::DoDataExchange(CDataExchange* pDX)
 \r
        DDX_Check(pDX,IDC_CHECK_NOFF,this->m_bNoFF);\r
        DDX_Check(pDX,IDC_CHECK_SQUASH,this->m_bSquash);\r
+       DDX_Control(pDX, IDC_LOGMESSAGE, m_cLogMessage);\r
 }\r
 \r
 \r
@@ -49,7 +71,8 @@ BOOL CMergeDlg::OnInitDialog()
        CHOOSE_VERSION_ADDANCHOR;\r
 \r
        AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);\r
-\r
+       AddAnchor(IDC_STATIC_MERGE_MESSAGE,TOP_LEFT,BOTTOM_RIGHT);\r
+       AddAnchor(IDC_LOGMESSAGE,TOP_LEFT,BOTTOM_RIGHT);\r
        \r
        AddAnchor(IDOK,BOTTOM_RIGHT);\r
        AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
@@ -62,6 +85,14 @@ BOOL CMergeDlg::OnInitDialog()
        Init();\r
        \r
        this->SetDefaultChoose(IDC_RADIO_BRANCH);\r
+\r
+       m_ProjectProperties.ReadProps(CTGitPath(g_Git.m_CurrentDir));\r
+\r
+       m_cLogMessage.Init(m_ProjectProperties);\r
+       m_cLogMessage.SetFont((CString)CRegString(_T("Software\\TortoiseGit\\LogFontName"), _T("Courier New")), (DWORD)CRegDWORD(_T("Software\\TortoiseGit\\LogFontSize"), 8));\r
+       m_cLogMessage.RegisterContextMenuHandler(this);\r
+\r
+       m_cLogMessage.SetText(m_pDefaultText);\r
        \r
        EnableSaveRestore(_T("MergeDlg"));\r
 \r
@@ -78,5 +109,11 @@ void CMergeDlg::OnBnClickedOk()
        \r
        this->UpdateRevsionName();\r
 \r
+       this->m_strLogMesage = m_cLogMessage.GetText() ;\r
+       if( m_strLogMesage == CString(this->m_pDefaultText) )\r
+       {\r
+               m_strLogMesage.Empty();\r
+       }\r
+\r
        OnOK();\r
 }\r
index 2967bb0..f01ae3e 100644 (file)
@@ -1,11 +1,32 @@
+// TortoiseGit - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2007-2009 - TortoiseGit\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+\r
+\r
 #pragma once\r
 \r
 #include "StandAloneDlg.h"\r
 #include "HistoryCombo.h"\r
 #include "ChooseVersion.h"\r
+#include "SciEdit.h"\r
 // CMergeDlg dialog\r
 \r
-class CMergeDlg : public CResizableStandAloneDialog,public CChooseVersion\r
+class CMergeDlg : public CResizableStandAloneDialog,public CChooseVersion , public CSciEditContextMenuInterface\r
 {\r
        DECLARE_DYNAMIC(CMergeDlg)\r
 \r
@@ -25,10 +46,16 @@ public:
 protected:\r
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
        virtual BOOL OnInitDialog();\r
+       \r
+       CSciEdit                        m_cLogMessage;\r
+       ProjectProperties       m_ProjectProperties;\r
 \r
+       TCHAR                           * m_pDefaultText;\r
        DECLARE_MESSAGE_MAP()\r
        CHOOSE_EVENT_RADIO() ;\r
 public:\r
 \r
+       CString m_strLogMesage;\r
+\r
        afx_msg void OnBnClickedOk();\r
 };\r
index 969805c..a4ab5d3 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ