OSDN Git Service

Add "paste last commit message" at commit dialog box
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / CommitDlg.cpp
index 34b2cb4..c78eb55 100644 (file)
@@ -678,20 +678,15 @@ UINT CCommitDlg::StatusThread()
        DialogEnableWindow(IDC_EXTERNALWARNING, false);\r
     // read the list of recent log entries before querying the WC for status\r
     // -> the user may select one and modify / update it while we are crawling the WC\r
-#if 0\r
+\r
        if (m_History.GetCount()==0)\r
        {\r
                CString reg;\r
-               if (m_ListCtrl.m_sUUID.IsEmpty() && m_pathList.GetCount()>0)\r
-               {\r
-                       Git Git;\r
-                       reg.Format(_T("Software\\TortoiseGit\\History\\commit%s"), (LPCTSTR)Git.GetUUIDFromPath(m_pathList[0]));\r
-               }\r
-               else\r
-                       reg.Format(_T("Software\\TortoiseGit\\History\\commit%s"), (LPCTSTR)m_ListCtrl.m_sUUID);\r
+               reg.Format(_T("Software\\TortoiseGit\\History\\commit%s"), (LPCTSTR)m_ListCtrl.m_sUUID);\r
+               reg.Replace(_T(':'),_T('_'));\r
                m_History.Load(reg, _T("logmsgs"));\r
        }\r
-#endif\r
+\r
     // Initialise the list control with the status of the files/folders below us\r
        m_ListCtrl.Clear();\r
        BOOL success;\r
@@ -1241,6 +1236,15 @@ void CCommitDlg::InsertMenuItems(CMenu& mPopup, int& nCmd)
        CString sMenuItemText(MAKEINTRESOURCE(IDS_COMMITDLG_POPUP_PASTEFILELIST));\r
        m_nPopupPasteListCmd = nCmd++;\r
        mPopup.AppendMenu(MF_STRING | MF_ENABLED, m_nPopupPasteListCmd, sMenuItemText);\r
+\r
+       //CString sMenuItemText(MAKEINTRESOURCE(IDS_COMMITDLG_POPUP_PASTEFILELIST));\r
+       if(m_History.GetCount() > 0)\r
+       {\r
+               sMenuItemText.LoadString(IDS_COMMITDLG_POPUP_PASTELASTMESSAGE);\r
+               m_nPopupPasteLastMessage = nCmd++;\r
+               mPopup.AppendMenu(MF_STRING | MF_ENABLED, m_nPopupPasteLastMessage, sMenuItemText);\r
+       }\r
+       \r
 }\r
 \r
 bool CCommitDlg::HandleMenuItemClick(int cmd, CSciEdit * pSciEdit)\r
@@ -1276,6 +1280,16 @@ bool CCommitDlg::HandleMenuItemClick(int cmd, CSciEdit * pSciEdit)
                return true;\r
        }\r
 \r
+       if(cmd == m_nPopupPasteLastMessage)\r
+       {\r
+               if(m_History.GetCount() ==0 )\r
+                       return false;\r
+\r
+               CString logmsg;\r
+               logmsg +=m_History.GetEntry(0);\r
+               pSciEdit->InsertText(logmsg);\r
+               return true;\r
+       }\r
        return false;\r
 }\r
 \r