From 50bf0dc5846ef84e78224f570cab137ee1439e6f Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Fri, 8 Feb 2013 00:38:57 +0100 Subject: [PATCH] If there are submodule changes in the file list when resolving conflicts while rebasing, show warning message in red background Signed-off-by: Sup Yut Sum --- Languages/Tortoise.pot | 4 ++++ src/Resources/TortoiseProcENG.rc | 3 ++- src/TortoiseProc/RebaseDlg.cpp | 44 +++++++++++++++++++++++++++++++++++++++- src/TortoiseProc/RebaseDlg.h | 3 +++ src/TortoiseProc/resource.h | 1 + 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index 794ea75b3..fe203845e 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -7936,6 +7936,10 @@ msgstr "" msgid "Tags:" msgstr "" +#. Resource IDs: (1386) +msgid "take care of submodule changes" +msgstr "" + #. Resource IDs: (64) msgid "Tasks" msgstr "" diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index b1d34207e..bf67c1c27 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -1355,7 +1355,7 @@ BEGIN CONTROL "",IDC_REBASE_SPLIT,"Static",SS_OWNERDRAW,7,129,402,6,WS_EX_TRANSPARENT PUSHBUTTON "Dumy Group For locat TabCtr",IDC_REBASE_DUMY_TAB,7,137,402,64,NOT WS_VISIBLE CONTROL "",IDC_REBASE_PROGRESS,"msctls_progress32",WS_BORDER,7,204,402,7 - LTEXT "",IDC_STATUS_STATIC,7,215,101,8 + LTEXT "",IDC_STATUS_STATIC,7,215,201,8 DEFPUSHBUTTON "Continue",IDC_REBASE_CONTINUE,213,217,63,14 PUSHBUTTON "Abort",IDC_REBASE_ABORT,285,217,57,14 PUSHBUTTON "Help",IDHELP,351,217,58,14 @@ -3976,6 +3976,7 @@ BEGIN IDS_SETTINGS_ENABLELOGCACHE_TT "Enable loading/saving log cache files (tortoisegit.data, tortoisegit.index)" IDS_LOG_FILTER_EMAILS "Emails" + IDS_CARE_SUBMODULE_CHANGES "take care of submodule changes" END #endif // English (U.S.) resources diff --git a/src/TortoiseProc/RebaseDlg.cpp b/src/TortoiseProc/RebaseDlg.cpp index 2746bf752..070e5e8ad 100644 --- a/src/TortoiseProc/RebaseDlg.cpp +++ b/src/TortoiseProc/RebaseDlg.cpp @@ -45,6 +45,7 @@ CRebaseDlg::CRebaseDlg(CWnd* pParent /*=NULL*/) , m_bSquashAll(FALSE) , m_bEditAll(FALSE) , m_bAddCherryPickedFrom(FALSE) + , m_bStatusWarning(false) { m_RebaseStage=CHOOSE_BRANCH; m_CurrentRebaseIndex=-1; @@ -96,6 +97,7 @@ BEGIN_MESSAGE_MAP(CRebaseDlg, CResizableStandAloneDialog) ON_BN_CLICKED(IDC_BUTTON_DOWN2, &CRebaseDlg::OnBnClickedButtonDown2) ON_REGISTERED_MESSAGE(WM_TASKBARBTNCREATED, OnTaskbarBtnCreated) ON_NOTIFY(LVN_ITEMCHANGED, IDC_COMMIT_LIST, OnLvnItemchangedLoglist) + ON_WM_CTLCOLOR() END_MESSAGE_MAP() void CRebaseDlg::AddRebaseAnchor() @@ -309,6 +311,18 @@ BOOL CRebaseDlg::OnInitDialog() } // CRebaseDlg message handlers +HBRUSH CRebaseDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) +{ + if (pWnd->GetDlgCtrlID() == IDC_STATUS_STATIC && nCtlColor == CTLCOLOR_STATIC && m_bStatusWarning) + { + pDC->SetBkColor(RGB(255, 0, 0)); + pDC->SetTextColor(RGB(255, 255, 255)); + return CreateSolidBrush(RGB(255, 0, 0)); + } + + return CResizableStandAloneDialog::OnCtlColor(pDC, pWnd, nCtlColor); +} + void CRebaseDlg::OnBnClickedPickAll() { this->UpdateData(); @@ -921,6 +935,9 @@ int CRebaseDlg::FinishRebase() while (m_ctrlTabCtrl.GetTabsNum() > 1) m_ctrlTabCtrl.RemoveTab(0); m_CtrlStatusText.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_REBASEFINISHED))); + m_sStatusText = CString(MAKEINTRESOURCE(IDS_PROC_REBASEFINISHED)); + m_bStatusWarning = false; + m_CtrlStatusText.Invalidate(); return 0; } @@ -1385,8 +1402,10 @@ void CRebaseDlg::UpdateProgress() { CString text; text.Format(IDS_PROC_REBASING_PROGRESS, index, m_CommitList.GetItemCount()); + m_sStatusText = text; m_CtrlStatusText.SetWindowText(text); - + m_bStatusWarning = false; + m_CtrlStatusText.Invalidate(); } GitRev *prevRev=NULL, *curRev=NULL; @@ -1641,6 +1660,29 @@ void CRebaseDlg::ListConflictFile() CTGitPath::LOGACTIONS_UNMERGED); m_FileListCtrl.Check(GITSLC_SHOWFILES); + bool hasSubmoduleChange = false; + for (int i = 0; i < m_FileListCtrl.GetItemCount(); i++) + { + CTGitPath *entry = (CTGitPath *)m_FileListCtrl.GetItemData(i); + if (entry->IsDirectory()) + { + hasSubmoduleChange = true; + break; + } + } + + if (hasSubmoduleChange) + { + m_CtrlStatusText.SetWindowText(m_sStatusText + _T(", ") + CString(MAKEINTRESOURCE(IDS_CARE_SUBMODULE_CHANGES))); + m_bStatusWarning = true; + m_CtrlStatusText.Invalidate(); + } + else + { + m_CtrlStatusText.SetWindowText(m_sStatusText); + m_bStatusWarning = false; + m_CtrlStatusText.Invalidate(); + } } LRESULT CRebaseDlg::OnRebaseUpdateUI(WPARAM,LPARAM) diff --git a/src/TortoiseProc/RebaseDlg.h b/src/TortoiseProc/RebaseDlg.h index 82f174195..ba2f9e101 100644 --- a/src/TortoiseProc/RebaseDlg.h +++ b/src/TortoiseProc/RebaseDlg.h @@ -71,6 +71,7 @@ protected: virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); + virtual HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); LRESULT OnRebaseUpdateUI(WPARAM wParam, LPARAM lParam); void DoSize(int delta); void AddRebaseAnchor(); @@ -86,6 +87,8 @@ protected: CRect m_DlgOrigRect; CRect m_CommitListOrigRect; + CString m_sStatusText; + bool m_bStatusWarning; BOOL PreTranslateMessage(MSG* pMsg); bool LogListHasFocus(HWND hwnd); diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index bff184e7f..a6ae7ed39 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -863,6 +863,7 @@ #define IDS_PROC_BROWSEREFS_DELETEALLTAGS 1387 #define IDS_SETTINGS_ENABLELOGCACHE_TT 1388 #define IDS_LOG_FILTER_EMAILS 1389 +#define IDS_CARE_SUBMODULE_CHANGES 1390 #define IDC_REVISIONGROUP 1393 #define IDC_REPOLABEL 1394 #define IDS_WARN_FOLDERNOTEXIST 1400 -- 2.11.4.GIT