From ef8ca0ec8bfd78dbf7e1d33a50da28b4dcbe9ca7 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Fri, 14 Aug 2015 00:04:09 +0200 Subject: [PATCH] Drop unused code Signed-off-by: Sven Strickroth --- src/Git/Git.cpp | 13 +--- src/Git/Git.h | 2 +- src/TortoiseProc/GitLogListBase.cpp | 61 +--------------- src/TortoiseProc/ILogReceiver.h | 134 ------------------------------------ src/TortoiseProc/LogDataVector.cpp | 26 +------ src/TortoiseProc/LogDlg.cpp | 123 +-------------------------------- src/TortoiseProc/LogDlg.h | 8 --- src/TortoiseProc/LogDlgHelper.h | 9 --- 8 files changed, 8 insertions(+), 368 deletions(-) delete mode 100644 src/TortoiseProc/ILogReceiver.h diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index b63cb32a5..6f62131ad 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -934,7 +934,7 @@ int CGit::BuildOutputFormat(CString &format,bool IsFull) return 0; } -CString CGit::GetLogCmd(const CString& range, const CTGitPath* path, int mask, bool paramonly, +CString CGit::GetLogCmd(const CString& range, const CTGitPath* path, int mask, CFilterData *Filter) { CString cmd; @@ -1064,15 +1064,8 @@ CString CGit::GetLogCmd(const CString& range, const CTGitPath* path, int mask, b else if (logOrderBy == LOG_ORDER_DATEORDER) param += _T(" --date-order"); - if(paramonly) //tgit.dll.Git.cpp:setup_revisions() only looks at args[1] and greater. To account for this, pass a dummy parameter in the 0th place - cmd.Format(_T("--ignore-this-parameter %s -z %s --parents "), (LPCTSTR)num, (LPCTSTR)param); - else - { - CString log; - BuildOutputFormat(log,!(mask&CGit::LOG_INFO_ONLY_HASH)); - cmd.Format(_T("git.exe log %s -z %s --parents --pretty=format:\"%s\""), - (LPCTSTR)num, (LPCTSTR)param, (LPCTSTR)log); - } + // gitdll.dll:setup_revisions() only looks at args[1] and greater. To account for this, pass a dummy parameter in the 0th place + cmd.Format(_T("--ignore-this-parameter %s -z %s --parents "), (LPCTSTR)num, (LPCTSTR)param); cmd += file; diff --git a/src/Git/Git.h b/src/Git/Git.h index 8028a9049..e07ade47c 100644 --- a/src/Git/Git.h +++ b/src/Git/Git.h @@ -368,7 +368,7 @@ public: CString FixBranchName_Mod(CString& branchName); CString FixBranchName(const CString& branchName); - CString GetLogCmd(const CString& range, const CTGitPath* path = nullptr, int InfoMask = LOG_INFO_FULL_DIFF | LOG_INFO_STAT | LOG_INFO_FILESTATE | LOG_INFO_BOUNDARY | LOG_INFO_DETECT_COPYRENAME | LOG_INFO_SHOW_MERGEDFILE, bool paramonly = false, CFilterData* filter = nullptr); + CString GetLogCmd(const CString& range, const CTGitPath* path = nullptr, int InfoMask = LOG_INFO_FULL_DIFF | LOG_INFO_STAT | LOG_INFO_FILESTATE | LOG_INFO_BOUNDARY | LOG_INFO_DETECT_COPYRENAME | LOG_INFO_SHOW_MERGEDFILE, CFilterData* filter = nullptr); int GetHash(CGitHash &hash, const CString& friendname); static int GetHash(git_repository * repo, CGitHash &hash, const CString& friendname, bool skipFastCheck = false); diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 3fb2516ce..ea1587c75 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -2446,63 +2446,6 @@ void CGitLogListBase::DiffSelectedRevWithPrevious() } ContextMenuAction(ID_COMPAREWITHPREVIOUS,FirstSelect,LastSelect, NULL); - -#if 0 - UpdateLogInfoLabel(); - int selIndex = m_LogList.GetSelectionMark(); - if (selIndex < 0) - return; - int selCount = m_LogList.GetSelectedCount(); - if (selCount != 1) - return; - - // Find selected entry in the log list - POSITION pos = m_LogList.GetFirstSelectedItemPosition(); - PLOGENTRYDATA pLogEntry = reinterpret_cast(m_arShownList.SafeGetAt(m_LogList.GetNextSelectedItem(pos))); - long rev1 = pLogEntry->Rev; - long rev2 = rev1-1; - CTGitPath path = m_path; - - // See how many files under the relative root were changed in selected revision - int nChanged = 0; - LogChangedPath * changed = NULL; - for (INT_PTR c = 0; c < pLogEntry->pArChangedPaths->GetCount(); ++c) - { - LogChangedPath * cpath = pLogEntry->pArChangedPaths->SafeGetAt(c); - if (cpath && cpath -> sPath.Left(m_sRelativeRoot.GetLength()).Compare(m_sRelativeRoot)==0) - { - ++nChanged; - changed = cpath; - } - } - - if (m_path.IsDirectory() && nChanged == 1) - { - // We're looking at the log for a directory and only one file under dir was changed in the revision - // Do diff on that file instead of whole directory - path.AppendPathString(changed->sPath.Mid(m_sRelativeRoot.GetLength())); - } - - m_bCancelled = FALSE; - DialogEnableWindow(IDOK, FALSE); - SetPromptApp(&theApp); - theApp.DoWaitCursor(1); - - if (PromptShown()) - { - GitDiff diff(this, m_hWnd, true); - diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000)); - diff.SetHEADPeg(m_LogRevision); - diff.ShowCompare(path, rev2, path, rev1); - } - else - { - CAppUtils::StartShowCompare(m_hWnd, path, rev2, path, rev1, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000)); - } - - theApp.DoWaitCursor(-1); - EnableOKButton(); -#endif } void CGitLogListBase::OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult) @@ -2686,7 +2629,7 @@ int CGitLogListBase::BeginFetchLog() if (mask & CGit::LOG_INFO_FOLLOW) mask &= ~CGit::LOG_INFO_ALL_BRANCH | CGit::LOG_INFO_LOCAL_BRANCHES; - CString cmd = g_Git.GetLogCmd(m_sRange, path, mask, true, &m_Filter); + CString cmd = g_Git.GetLogCmd(m_sRange, path, mask, &m_Filter); //this->m_logEntries.ParserFromLog(); if(IsInWorkingThread()) @@ -2721,7 +2664,7 @@ int CGitLogListBase::BeginFetchLog() if (list.size() == 0) return 0; - cmd = g_Git.GetLogCmd(list[0], path, mask, true, &m_Filter); + cmd = g_Git.GetLogCmd(list[0], path, mask, &m_Filter); } g_Git.m_critGitDllSec.Lock(); diff --git a/src/TortoiseProc/ILogReceiver.h b/src/TortoiseProc/ILogReceiver.h deleted file mode 100644 index 85180714b..000000000 --- a/src/TortoiseProc/ILogReceiver.h +++ /dev/null @@ -1,134 +0,0 @@ -// TortoiseGit - a Windows shell extension for easy version control - -// Copyright (C) 2007-2007 - TortoiseSVN - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -#pragma once - -/////////////////////////////////////////////////////////////// -// temporarily used to disambiguate LogChangedPath definitions -/////////////////////////////////////////////////////////////// - -#ifndef __ILOGRECEIVER_H__ -#define __ILOGRECEIVER_H__ -#endif - -/////////////////////////////////////////////////////////////// -// required includes -/////////////////////////////////////////////////////////////// - -//#include "svn_types.h" - - -/** - * data structure to accommodate the change list. - */ -struct LogChangedPath -{ - CString sPath; -// CString sCopyFromPath; - CString lCopyFromRev; - DWORD action; - - /// returns the action as a string - const CString& GetAction() const; - -private: - - /// cached return value of GetAction() - mutable CString actionAsString; -}; - - - -/// auto-deleting extension of MFC Arrays for pointer arrays - -template -class CAutoArray : public CArray -{ -public: - - // default and copy construction - - CAutoArray() - { - } - - CAutoArray (const CAutoArray& rhs) - { - Copy (rhs); - } - - // destruction deletes members - - ~CAutoArray() - { - for (INT_PTR i = 0, count = GetCount(); i < count; ++i) - delete GetAt (i); - } -}; - -typedef CAutoArray LogChangedPathArray; - -/** - * standard revision properties - */ - -struct StandardRevProps -{ - CString author; -// apr_time_t timeStamp; - CString message; -}; - -/** - * data structure to accommodate the list of user-defined revision properties. - */ -struct UserRevProp -{ - CString name; - CString value; -}; - -typedef CAutoArray UserRevPropArray; - - -/** - * Interface for receiving log information. It will be used as a callback - * in ILogQuery::Log(). - * - * To cancel the log and/or indicate errors, throw an SVNError exception. - */ -class ILogReceiver -{ -public: - - /// call-back for every revision found - /// (called at most once per revision) - /// - /// the implementation may modify but not delete() - /// the data containers passed to it - /// - /// any pointer may be NULL - /// - /// may throw a SVNError to cancel the log - - virtual void ReceiveLog ( LogChangedPathArray* changes - , CString rev - , const StandardRevProps* stdRevProps - , UserRevPropArray* userRevProps - , bool mergesFollow) = 0; -}; diff --git a/src/TortoiseProc/LogDataVector.cpp b/src/TortoiseProc/LogDataVector.cpp index 9936476af..ae36f625a 100644 --- a/src/TortoiseProc/LogDataVector.cpp +++ b/src/TortoiseProc/LogDataVector.cpp @@ -49,9 +49,6 @@ void CLogDataVector::ClearAll() { m_pLogCache->ClearAllLanes(); } - - m_RawlogData.clear(); - m_RawLogStart.clear(); } //CLogDataVector Class @@ -72,7 +69,7 @@ int CLogDataVector::ParserFromLog(CTGitPath* path, DWORD count, DWORD infomask, filter.m_NumberOfLogs = count; filter.m_NumberOfLogsScale = CFilterData::SHOW_LAST_N_COMMITS; } - CString cmd = g_Git.GetLogCmd(gitrange, path, infomask, true, &filter); + CString cmd = g_Git.GetLogCmd(gitrange, path, infomask, &filter); if (!g_Git.CanParseRev(gitrange)) return 0; @@ -263,27 +260,6 @@ int CLogDataVector::Fill(std::set& hashes) return 0; } -int AddTolist(unsigned char * /*osha1*/, unsigned char *nsha1, const char * /*name*/, unsigned long /*time*/, int /*sz*/, const char *msg, void *data) -{ - CLogDataVector *vector = (CLogDataVector*)data; - GitRevLoglist rev; - rev.m_CommitHash = (char*)nsha1; - - CString one = CUnicodeUtils::GetUnicode(msg); - - int message = one.Find(_T(":"), 0); - if (message > 0) - { - rev.m_RefAction = one.Left(message); - rev.GetSubject() = one.Mid(message + 1); - } - - vector->m_pLogCache->m_HashMap[rev.m_CommitHash] = rev; - vector->insert(vector->begin(),rev.m_CommitHash); - - return 0; -} - void CLogDataVector::append(CGitHash& sha, bool storeInVector) { if (storeInVector) diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index c967e8de7..083ef56bc 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -40,7 +40,6 @@ IMPLEMENT_DYNAMIC(CLogDlg, CResizableStandAloneDialog) CLogDlg::CLogDlg(CWnd* pParent /*=NULL*/) : CResizableStandAloneDialog(CLogDlg::IDD, pParent) , m_wParam(0) - , m_currentChangedArray(NULL) , m_nSortColumn(0) , m_bFollowRenames(false) , m_bSelect(false) @@ -105,9 +104,6 @@ CLogDlg::~CLogDlg() m_regbShowLocalBranches = m_bShowLocalBranches; m_regbShowRemoteBranches = m_bShowRemoteBranches; m_regbShowGravatar = m_bShowGravatar; - - m_CurrentFilteredChangedArray.RemoveAll(); - } void CLogDlg::DoDataExchange(CDataExchange* pDX) @@ -730,7 +726,6 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) // empty the changed files list m_ChangedFileListCtrl.SetRedraw(FALSE); // InterlockedExchange(&m_bNoDispUpdates, TRUE); - m_currentChangedArray = NULL; m_ChangedFileListCtrl.DeleteAllItems(); // if we're not here to really show a selected revision, just @@ -916,29 +911,12 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) // the log message view must be emptied // the changed files list contains all the changed paths from all // selected revisions, with 'doubles' removed - m_currentChangedPathList = GetChangedPathsFromSelectedRevisions(true); m_gravatar.LoadGravatar(); } // redraw the views // InterlockedExchange(&m_bNoDispUpdates, FALSE); -#if 0 - if (m_currentChangedArray) - { - m_ChangedFileListCtrl.SetItemCountEx(m_currentChangedArray->GetCount()); - m_ChangedFileListCtrl.RedrawItems(0, m_currentChangedArray->GetCount()); - } - else if (m_currentChangedPathList.GetCount()) - { - m_ChangedFileListCtrl.SetItemCountEx(m_currentChangedPathList.GetCount()); - m_ChangedFileListCtrl.RedrawItems(0, m_currentChangedPathList.GetCount()); - } - else - { - m_ChangedFileListCtrl.SetItemCountEx(0); - m_ChangedFileListCtrl.Invalidate(); - } -#endif + // sort according to the settings if (m_nSortColumnPathList > 0) SetSortArrow(&m_ChangedFileListCtrl, m_nSortColumnPathList, m_bAscendingPathList); @@ -1593,61 +1571,6 @@ void CLogDlg::OnOK() #endif } -void CLogDlg::DoDiffFromLog(INT_PTR selIndex, GitRev* rev1, GitRev* rev2, bool /*blame*/, bool /*unified*/) -{ - DialogEnableWindow(IDOK, FALSE); -// SetPromptApp(&theApp); - theApp.DoWaitCursor(1); - - CString temppath; - GetTempPath(temppath); - - CString file1; - file1.Format(_T("%s%s_%s%s"), - (LPCTSTR)temppath, - (LPCTSTR)(*m_currentChangedArray)[selIndex].GetBaseFilename(), - (LPCTSTR)rev1->m_CommitHash.ToString().Left(g_Git.GetShortHASHLength()), - (LPCTSTR)(*m_currentChangedArray)[selIndex].GetFileExtension()); - - CString file2; - file2.Format(_T("%s\\%s_%s%s"), - (LPCTSTR)temppath, - (LPCTSTR)(*m_currentChangedArray)[selIndex].GetBaseFilename(), - (LPCTSTR)rev2->m_CommitHash.ToString().Left(g_Git.GetShortHASHLength()), - (LPCTSTR)(*m_currentChangedArray)[selIndex].GetFileExtension()); - - CString cmd; - CTGitPath &path = (CTGitPath &)(*m_currentChangedArray)[selIndex]; - - if (g_Git.GetOneFile(rev1->m_CommitHash.ToString(), path, file1)) - { - CString out; - out.Format(IDS_STATUSLIST_CHECKOUTFILEFAILED, (LPCTSTR)path.GetGitPathString(), (LPCTSTR)rev1->m_CommitHash.ToString(), (LPCTSTR)file1); - CMessageBox::Show(nullptr, g_Git.GetGitLastErr(out, CGit::GIT_CMD_GETONEFILE), _T("TortoiseGit"), MB_OK); - theApp.DoWaitCursor(-1); - EnableOKButton(); - return; - } - if (g_Git.GetOneFile(rev2->m_CommitHash.ToString(), path, file2)) - { - CString out; - out.Format(IDS_STATUSLIST_CHECKOUTFILEFAILED, (LPCTSTR)path.GetGitPathString(), (LPCTSTR)rev2->m_CommitHash.ToString(), (LPCTSTR)file2); - CMessageBox::Show(nullptr, g_Git.GetGitLastErr(out, CGit::GIT_CMD_GETONEFILE), _T("TortoiseGit"), MB_OK); - theApp.DoWaitCursor(-1); - EnableOKButton(); - return; - } - - CAppUtils::DiffFlags flags; - CAppUtils::StartExtDiff(file1,file2,_T("A"),_T("B"), - g_Git.CombinePath(path), g_Git.CombinePath(path), - rev1->m_CommitHash.ToString(), rev2->m_CommitHash.ToString(), - flags); - - theApp.DoWaitCursor(-1); - EnableOKButton(); -} - void CLogDlg::OnPasteGitHash() { if (!IsClipboardFormatAvailable(CF_TEXT)) @@ -2696,50 +2619,6 @@ void CLogDlg::OnBnClickedJumpDown() CMessageBox::ShowCheck(GetSafeHwnd(), IDS_PROC_LOG_JUMPNOTFOUND, IDS_APPNAME, 1, IDI_INFORMATION, IDS_OKBUTTON, 0, 0, _T("NoJumpNotFoundWarning"), IDS_MSGBOX_DONOTSHOWAGAIN); } -CTGitPathList CLogDlg::GetChangedPathsFromSelectedRevisions(bool /*bRelativePaths*/ /* = false */, bool /*bUseFilter*/ /* = true */) -{ - CTGitPathList pathList; -#if 0 - - if (m_sRepositoryRoot.IsEmpty() && (bRelativePaths == false)) - { - m_sRepositoryRoot = GetRepositoryRoot(m_path); - } - if (m_sRepositoryRoot.IsEmpty() && (bRelativePaths == false)) - return pathList; - - POSITION pos = m_LogList.GetFirstSelectedItemPosition(); - if (pos != NULL) - { - while (pos) - { - int nextpos = m_LogList.GetNextSelectedItem(pos); - if (nextpos >= m_arShownList.GetCount()) - continue; - PLOGENTRYDATA pLogEntry = reinterpret_cast(m_arShownList.SafeGetAt(nextpos)); - LogChangedPathArray * cpatharray = pLogEntry->pArChangedPaths; - for (INT_PTR cpPathIndex = 0; cpPathIndexGetCount(); ++cpPathIndex) - { - LogChangedPath * cpath = cpatharray->SafeGetAt(cpPathIndex); - if (cpath == NULL) - continue; - CTGitPath path; - if (!bRelativePaths) - path.SetFromGit(m_sRepositoryRoot); - path.AppendPathString(cpath->sPath); - if ((!bUseFilter)|| - ((m_cHidePaths.GetState() & 0x0003)!=BST_CHECKED)|| - (cpath->sPath.Left(m_sRelativeRoot.GetLength()).Compare(m_sRelativeRoot)==0)) - pathList.AddPath(path); - - } - } - } - pathList.RemoveDuplicates(); -#endif - return pathList; -} - void CLogDlg::SortByColumn(int /*nSortColumn*/, bool /*bAscending*/) { #if 0 diff --git a/src/TortoiseProc/LogDlg.h b/src/TortoiseProc/LogDlg.h index 3598100ed..f5859827f 100644 --- a/src/TortoiseProc/LogDlg.h +++ b/src/TortoiseProc/LogDlg.h @@ -152,8 +152,6 @@ protected: afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnPaint(); - void DoDiffFromLog(INT_PTR selIndex, GitRev *rev1, GitRev *rev2, bool blame, bool unified); - void OnPasteGitHash(); void JumpToGitHash(CString& hash); @@ -179,7 +177,6 @@ private: void CopySelectionToClipBoard(); void CopyChangedSelectionToClipBoard(); - CTGitPathList GetChangedPathsFromSelectedRevisions(bool bRelativePaths = false, bool bUseFilter = true); void SortShownListArray(); void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending); @@ -190,7 +187,6 @@ private: void SaveSplitterPos(); bool ValidateRegexp(LPCTSTR regexp_str, std::tr1::wregex& pat, bool bMatchCase); void CheckRegexpTooltip(); - void GetChangedPaths(std::vector& changedpaths, std::vector& changedlogpaths); void SetDlgTitle(); CString GetAbsoluteUrlFromRelativeUrl(const CString& url); void ShowGravatar(); @@ -244,10 +240,6 @@ private: bool m_bNavigatingWithSelect; bool m_bAsteriskLogPrefix; - CTGitPathList * m_currentChangedArray; - LogChangedPathArray m_CurrentFilteredChangedArray; - CTGitPathList m_currentChangedPathList; - bool m_bFilterWithRegex; bool m_bFilterCaseSensitively; diff --git a/src/TortoiseProc/LogDlgHelper.h b/src/TortoiseProc/LogDlgHelper.h index 5fa33ab69..2f3be29de 100644 --- a/src/TortoiseProc/LogDlgHelper.h +++ b/src/TortoiseProc/LogDlgHelper.h @@ -18,12 +18,7 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // #pragma once -#include "Git.h" -#include "GitRevLoglist.h" -#include "GitStatus.h" -#include "ILogReceiver.h" #include "lanes.h" -#include #include "GitHash.h" #include "GitLogCache.h" class CLogDlg; @@ -69,7 +64,6 @@ public: int Fill(std::set& hashes); int FetchFullInfo(int i); -// void AddFullInfo( Lanes m_Lns; int m_FirstFreeLane; @@ -78,9 +72,6 @@ public: void setLane(CGitHash& sha) ; void append(CGitHash& sha, bool storeInVector); - BYTE_VECTOR m_RawlogData; - std::vector m_RawLogStart; - #if 0 /// Ascending date sorting. struct AscDateSort -- 2.11.4.GIT