From dfa3c249b261c4eb2926b4af4c0713d5bfb0be23 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 8 Jul 2017 11:01:05 +0200 Subject: [PATCH] Allow to view diff on Delete/Modified conflict Signed-off-by: Sven Strickroth --- Languages/Tortoise.pot | 2 +- src/Resources/TortoiseProcENG.rc | 30 ++++++++++++++++-------------- src/TortoiseProc/AppUtils.cpp | 11 ++++++++++- src/TortoiseProc/DeleteConflictDlg.cpp | 25 +++++++++++++++++++++++++ src/TortoiseProc/DeleteConflictDlg.h | 3 +++ src/TortoiseProc/resource.h | 2 ++ 6 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Languages/Tortoise.pot b/Languages/Tortoise.pot index 59f486d19..21c5f7d36 100644 --- a/Languages/Tortoise.pot +++ b/Languages/Tortoise.pot @@ -8731,7 +8731,7 @@ msgstr "" msgid "Show &Whole Project" msgstr "" -#. Resource IDs: (IDS_LOG_POPUP_DIFF) +#. Resource IDs: (Dialog IDD_RESOLVE_CONFLICT: Control id 1133, Dialog IDD_RESOLVE_CONFLICT: Control id 1134, IDS_LOG_POPUP_DIFF) msgid "Show &changes" msgstr "" diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index b101f8846..56410fcc2 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -1483,23 +1483,25 @@ BEGIN PUSHBUTTON "Button3",IDC_REBASE_POST_BUTTON,6,217,75,14,NOT WS_VISIBLE END -IDD_RESOLVE_CONFLICT DIALOGEX 0, 0, 285, 125 +IDD_RESOLVE_CONFLICT DIALOGEX 0, 0, 315, 129 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Conflict" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - GROUPBOX "Delete/modify merge conflict",IDC_DEL_GROUP,7,7,271,91 - LTEXT "",IDC_INFOLABEL,22,21,248,8,SS_WORDELLIPSIS + GROUPBOX "Delete/modify merge conflict",IDC_DEL_GROUP,7,7,301,96 + LTEXT "",IDC_INFOLABEL,22,21,275,8,SS_WORDELLIPSIS LTEXT "Static",IDC_LOCAL_STATUS,22,50,167,8 EDITTEXT IDC_FROMHASH,19,35,188,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_CLIENTEDGE - PUSHBUTTON "Show log",IDC_LOG,218,35,52,12 - LTEXT "Static",IDC_REMOTE_STATUS,22,81,164,8 - EDITTEXT IDC_TOHASH,19,66,188,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_CLIENTEDGE - PUSHBUTTON "Show log",IDC_LOG2,218,66,52,12 - PUSHBUTTON "OK",IDC_MODIFY,37,104,50,14 - PUSHBUTTON "Delete",IDC_DELETE,98,104,50,14 - DEFPUSHBUTTON "Abort",IDCANCEL,159,104,50,14 - PUSHBUTTON "Help",IDHELP,220,104,50,14 + PUSHBUTTON "Show log",IDC_LOG,218,35,79,12 + PUSHBUTTON "Show &changes",IDC_SHOWDIFF,218,50,79,12,NOT WS_VISIBLE + LTEXT "Static",IDC_REMOTE_STATUS,22,84,164,8 + EDITTEXT IDC_TOHASH,19,69,188,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER,WS_EX_CLIENTEDGE + PUSHBUTTON "Show log",IDC_LOG2,218,69,79,12 + PUSHBUTTON "Show &changes",IDC_SHOWDIFF2,218,84,79,12,NOT WS_VISIBLE + PUSHBUTTON "OK",IDC_MODIFY,65,108,50,14 + PUSHBUTTON "Delete",IDC_DELETE,126,108,50,14 + DEFPUSHBUTTON "Abort",IDCANCEL,187,108,50,14 + PUSHBUTTON "Help",IDHELP,247,108,50,14 END IDD_REFLOG DIALOGEX 0, 0, 356, 196 @@ -2831,13 +2833,13 @@ BEGIN IDD_RESOLVE_CONFLICT, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 278 + RIGHTMARGIN, 308 VERTGUIDE, 19 VERTGUIDE, 22 VERTGUIDE, 218 - VERTGUIDE, 270 + VERTGUIDE, 297 TOPMARGIN, 7 - BOTTOMMARGIN, 118 + BOTTOMMARGIN, 122 END IDD_REFLOG, DIALOG diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index a7ec23860..c20b871ae 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -1912,7 +1912,13 @@ bool CAppUtils::ConflictEdit(CTGitPath& path, bool bAlternativeTool /*= false*/, { ::DeleteFile(mine.GetWinPathString()); ::DeleteFile(theirs.GetWinPathString()); - ::DeleteFile(base.GetWinPathString()); + if (!b_base) + ::DeleteFile(base.GetWinPathString()); + + SCOPE_EXIT{ + if (b_base) + ::DeleteFile(base.GetWinPathString()); + }; CDeleteConflictDlg dlg; if (!isRebase) @@ -1921,6 +1927,7 @@ bool CAppUtils::ConflictEdit(CTGitPath& path, bool bAlternativeTool /*= false*/, DescribeConflictFile(b_remote, b_base, dlg.m_RemoteStatus); dlg.m_LocalHash = mineTitle; dlg.m_RemoteHash = theirsTitle; + dlg.m_bDiffMine = b_local; } else { @@ -1928,9 +1935,11 @@ bool CAppUtils::ConflictEdit(CTGitPath& path, bool bAlternativeTool /*= false*/, DescribeConflictFile(b_remote, b_base, dlg.m_LocalStatus); dlg.m_LocalHash = theirsTitle; dlg.m_RemoteHash = mineTitle; + dlg.m_bDiffMine = !b_local; } dlg.m_bShowModifiedButton = b_base; dlg.m_File = merge; + dlg.m_FileBaseVersion = base; if(dlg.DoModal() == IDOK) { CString out; diff --git a/src/TortoiseProc/DeleteConflictDlg.cpp b/src/TortoiseProc/DeleteConflictDlg.cpp index 258587d0c..668e18e44 100644 --- a/src/TortoiseProc/DeleteConflictDlg.cpp +++ b/src/TortoiseProc/DeleteConflictDlg.cpp @@ -33,6 +33,7 @@ CDeleteConflictDlg::CDeleteConflictDlg(CWnd* pParent /*=nullptr*/) : CStandAloneDialog(CDeleteConflictDlg::IDD, pParent) , m_bShowModifiedButton(FALSE) , m_bIsDelete(FALSE) + , m_bDiffMine(true) { } @@ -57,6 +58,8 @@ BEGIN_MESSAGE_MAP(CDeleteConflictDlg, CStandAloneDialog) ON_BN_CLICKED(IDC_DELETE, &CDeleteConflictDlg::OnBnClickedDelete) ON_BN_CLICKED(IDC_MODIFY, &CDeleteConflictDlg::OnBnClickedModify) ON_BN_CLICKED(IDHELP, &OnHelp) + ON_BN_CLICKED(IDC_SHOWDIFF, &CDeleteConflictDlg::OnBnClickedShowdiff) + ON_BN_CLICKED(IDC_SHOWDIFF2, &CDeleteConflictDlg::OnBnClickedShowdiff) END_MESSAGE_MAP() @@ -65,7 +68,13 @@ BOOL CDeleteConflictDlg::OnInitDialog() CStandAloneDialog::OnInitDialog(); if(this->m_bShowModifiedButton ) + { this->GetDlgItem(IDC_MODIFY)->SetWindowText(CString(MAKEINTRESOURCE(IDS_SVNACTION_MODIFIED))); + if (m_bDiffMine) + GetDlgItem(IDC_SHOWDIFF)->ShowWindow(SW_SHOW); + else + GetDlgItem(IDC_SHOWDIFF2)->ShowWindow(SW_SHOW); + } else this->GetDlgItem(IDC_MODIFY)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_CREATED))); if (m_LocalHash.IsEmpty()) @@ -113,3 +122,19 @@ void CDeleteConflictDlg::ShowLog(CString hash) sCmd.Format(L"/command:log /path:\"%s\" /endrev:%s", (LPCTSTR)g_Git.CombinePath(m_File), (LPCTSTR)hash); CAppUtils::RunTortoiseGitProc(sCmd, false, false); } + +void CDeleteConflictDlg::OnBnClickedShowdiff() +{ + CString base; + base.LoadString(IDS_PROC_DIFF_BASE); + CAppUtils::DiffFlags flags; + flags.bAlternativeTool = !!(GetAsyncKeyState(VK_SHIFT) & 0x8000); + CAppUtils::StartExtDiff(m_FileBaseVersion.GetWinPathString(), g_Git.CombinePath(m_File), + base, + m_bDiffMine ? m_LocalHash : m_RemoteHash, + m_FileBaseVersion.GetWinPathString(), + g_Git.CombinePath(m_File), + m_bDiffMine ? m_LocalHash : m_RemoteHash, + m_bDiffMine ? m_RemoteHash : m_LocalHash, + flags); +} diff --git a/src/TortoiseProc/DeleteConflictDlg.h b/src/TortoiseProc/DeleteConflictDlg.h index ebc654bf8..b36889ec2 100644 --- a/src/TortoiseProc/DeleteConflictDlg.h +++ b/src/TortoiseProc/DeleteConflictDlg.h @@ -39,6 +39,7 @@ protected: afx_msg void OnBnClickedLog2(); afx_msg void OnBnClickedDelete(); afx_msg void OnBnClickedModify(); + afx_msg void OnBnClickedShowdiff(); BOOL OnInitDialog(); void ShowLog(CString hash); DECLARE_MESSAGE_MAP() @@ -50,5 +51,7 @@ public: CString m_RemoteHash; BOOL m_bShowModifiedButton; CTGitPath m_File; + CTGitPath m_FileBaseVersion; BOOL m_bIsDelete; + bool m_bDiffMine; }; diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index 01c473a5c..831a8bacd 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -399,8 +399,10 @@ #define IDS_GITEXEERROR_NOMESSAGE 1132 #define IDC_GRAPHCOMBO 1133 #define IDS_PROC_CLONE_URLDIREMPTY 1133 +#define IDC_SHOWDIFF2 1133 #define IDC_GRAPHTYPELABEL 1134 #define IDS_PROC_COMMIT_SHOWPATCH 1134 +#define IDC_SHOWDIFF 1134 #define IDC_COMMITSEACHWEEK 1135 #define IDS_PROC_COMMIT_HIDEPATCH 1135 #define IDC_MOSTACTIVEAUTHOR 1136 -- 2.11.4.GIT