• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28246 (tree)
Time2018-06-07 02:00:58
Authorstefankueng

Log Message

Add a "compare with working copy" context menu to the file list in the log dialog.

Change Summary

Incremental Difference

--- trunk/src/TortoiseProc/LogDialog/LogDlg.cpp (revision 28245)
+++ trunk/src/TortoiseProc/LogDialog/LogDlg.cpp (revision 28246)
@@ -6232,6 +6232,9 @@
62326232
62336233 switch (cmd)
62346234 {
6235+ case ID_COMPARE:
6236+ ExecuteCompareChangedPaths(pCmi, selIndex);
6237+ break;
62356238 case ID_DIFF:
62366239 ExecuteDiffChangedPaths(pCmi, selIndex, false);
62376240 break;
@@ -7095,6 +7098,10 @@
70957098 popup.AppendMenuIcon(ID_BLAMEDIFF, IDS_LOG_POPUP_BLAMEDIFF, IDI_BLAME);
70967099 popup.SetDefaultItem(ID_DIFF, FALSE);
70977100 popup.AppendMenuIcon(ID_GNUDIFF1, IDS_LOG_POPUP_GNUDIFF_CH, IDI_DIFF);
7101+ if (m_hasWC)
7102+ {
7103+ popup.AppendMenuIcon(ID_COMPARE, IDS_LOG_POPUP_COMPARE, IDI_DIFF);
7104+ }
70987105 bEntryAdded = true;
70997106 }
71007107 else if (pCmi->OneRev)
@@ -7210,7 +7217,77 @@
72107217 }
72117218 }
72127219
7220+void CLogDlg::ExecuteCompareChangedPaths(ContextMenuInfoForChangedPathsPtr pCmi, INT_PTR selIndex)
7221+{
7222+ SVNRev getrev = m_currentChangedArray[selIndex].GetAction() == LOGACTIONS_DELETED ?
7223+ pCmi->Rev2 : pCmi->Rev1;
7224+ auto f = [=]()
7225+ {
7226+ CoInitialize(NULL);
7227+ OnOutOfScope(CoUninitialize());
7228+ this->EnableWindow(FALSE);
7229+ OnOutOfScope(this->EnableWindow(TRUE); this->SetFocus());
72137230
7231+ DialogEnableWindow(IDOK, FALSE);
7232+ SetPromptApp(&theApp);
7233+ CString filepath;
7234+ if (SVN::PathIsURL(m_path))
7235+ {
7236+ filepath = m_path.GetSVNPathString();
7237+ }
7238+ else
7239+ {
7240+ filepath = GetURLFromPath(m_path);
7241+ if (filepath.IsEmpty())
7242+ {
7243+ ReportNoUrlOfFile(filepath);
7244+ EnableOKButton();
7245+ return FALSE;
7246+ }
7247+ }
7248+ m_bCancelled = false;
7249+ filepath = GetRepositoryRoot(CTSVNPath(filepath));
7250+ filepath += m_currentChangedArray[selIndex].GetPath();
7251+ CTSVNPath tsvnfilepath = CTSVNPath(filepath);
7252+
7253+ CProgressDlg progDlg;
7254+ progDlg.SetTitle(IDS_APPNAME);
7255+ CString sInfoLine;
7256+ sInfoLine.FormatMessage(IDS_PROGRESSGETFILEREVISION, (LPCTSTR)filepath,
7257+ (LPCTSTR)getrev.ToString());
7258+ progDlg.SetLine(1, sInfoLine, true);
7259+ SetAndClearProgressInfo(&progDlg);
7260+ progDlg.ShowModeless(m_hWnd);
7261+
7262+ CTSVNPath tempfile = CTempFiles::Instance().GetTempFilePath(false, tsvnfilepath, getrev);
7263+ m_bCancelled = false;
7264+ if (!Export(tsvnfilepath, tempfile, getrev, getrev))
7265+ {
7266+ progDlg.Stop();
7267+ SetAndClearProgressInfo((HWND)NULL);
7268+ ShowErrorDialog(m_hWnd);
7269+ EnableOKButton();
7270+ return FALSE;
7271+ }
7272+ progDlg.Stop();
7273+ SetAndClearProgressInfo((HWND)NULL);
7274+
7275+ CString sName1, sName2;
7276+ sName1.Format(L"%s - Revision %ld", (LPCTSTR)CPathUtils::GetFileNameFromPath(filepath), (svn_revnum_t)getrev);
7277+ sName2.Format(IDS_DIFF_WCNAME, (LPCTSTR)CPathUtils::GetFileNameFromPath(filepath));
7278+ CAppUtils::DiffFlags flags;
7279+ flags.AlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));
7280+ CString mimetype;
7281+ CAppUtils::GetMimeType(tsvnfilepath, mimetype);
7282+
7283+ CAppUtils::StartExtDiff(CTSVNPath(pCmi->wcPath), tempfile, sName1, sName2, tsvnfilepath, tsvnfilepath,
7284+ getrev, getrev, getrev, flags, 0,
7285+ CPathUtils::GetFileNameFromPath(filepath), mimetype);
7286+ EnableOKButton();
7287+ };
7288+ new async::CAsyncCall(f, &netScheduler);
7289+}
7290+
72147291 void CLogDlg::ExecuteDiffChangedPaths( ContextMenuInfoForChangedPathsPtr pCmi, INT_PTR selIndex, bool ignoreprops )
72157292 {
72167293 if ((!pCmi->OneRev)|| IsDiffPossible (m_currentChangedArray[selIndex], pCmi->Rev1))
--- trunk/src/TortoiseProc/LogDialog/LogDlg.h (revision 28245)
+++ trunk/src/TortoiseProc/LogDialog/LogDlg.h (revision 28246)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2017 - TortoiseSVN
3+// Copyright (C) 2003-2018 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -371,6 +371,7 @@
371371 void ExecuteExportTreeChangedPaths(ContextMenuInfoForChangedPathsPtr pCmi);
372372 void ExecuteSaveAsChangedPaths(ContextMenuInfoForChangedPathsPtr pCmi, INT_PTR selIndex);
373373 void ExecuteShowPropertiesChangedPaths(ContextMenuInfoForChangedPathsPtr pCmi);
374+ void ExecuteCompareChangedPaths(ContextMenuInfoForChangedPathsPtr pCmi, INT_PTR selIndex);
374375 void ExecuteDiffChangedPaths(ContextMenuInfoForChangedPathsPtr pCmi, INT_PTR selIndex, bool ignoreprops);
375376 void ExecuteGnuDiff1ChangedPaths(INT_PTR selIndex, ContextMenuInfoForChangedPathsPtr pCmi);
376377 void ExecuteBlameDiffChangedPaths(INT_PTR selIndex, ContextMenuInfoForChangedPathsPtr pCmi);
Show on old repository browser