Drop unused code
[TortoiseGit.git] / src / TortoiseProc / LogDlgHelper.h
blob5fa33ab69edb621093f13ad767f38f5c91186337
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2007 - TortoiseSVN
4 // Copyright (C) 2008-2015 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
21 #include "Git.h"
22 #include "GitRevLoglist.h"
23 #include "GitStatus.h"
24 #include "ILogReceiver.h"
25 #include "lanes.h"
26 #include <set>
27 #include "GitHash.h"
28 #include "GitLogCache.h"
29 class CLogDlg;
31 /**
32 * \ingroup TortoiseProc
33 * Instances of CStoreSelection save the selection of the CLogDlg. When the instance
34 * is deleted the destructor restores the selection.
36 typedef std::map<CGitHash, int> MAP_HASH_REV;
38 /**
39 * \ingroup TortoiseProc
40 * Helper class for the log dialog, handles all the log entries, including
41 * sorting.
43 class CLogDataVector : public std::vector<CGitHash>
45 public:
46 CLogCache *m_pLogCache;
47 /// De-allocates log items.
48 CLogDataVector(CLogCache *pLogCache)
50 m_pLogCache=pLogCache;
51 m_FirstFreeLane=0;
53 CLogDataVector()
55 m_pLogCache=NULL;
56 m_FirstFreeLane=0;
58 void SetLogCache(CLogCache *pLogCache)
60 m_pLogCache = pLogCache;
62 GitRevLoglist& GetGitRevAt(size_t i)
64 ASSERT(i<size());
65 return m_pLogCache->m_HashMap[(*this)[i]];
67 void ClearAll();
68 int ParserFromLog(CTGitPath* path = nullptr, DWORD count = 0, DWORD infomask = CGit::LOG_INFO_STAT | CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE, CString* range = nullptr);
69 int Fill(std::set<CGitHash>& hashes);
71 int FetchFullInfo(int i);
72 // void AddFullInfo(
74 Lanes m_Lns;
75 int m_FirstFreeLane;
76 MAP_HASH_REV m_HashMap;
77 void updateLanes(GitRevLoglist& c, Lanes& lns, CGitHash& sha);
78 void setLane(CGitHash& sha) ;
79 void append(CGitHash& sha, bool storeInVector);
81 BYTE_VECTOR m_RawlogData;
82 std::vector<int> m_RawLogStart;
84 #if 0
85 /// Ascending date sorting.
86 struct AscDateSort
88 bool operator()(GitRev& pStart, GitRev& pEnd)
90 return pStart->tmDate < pEnd->tmDate;
93 /// Descending date sorting.
94 struct DescDateSort
96 bool operator()(GitRev& pStart, GitRev& pEnd)
98 return pStart->tmDate > pEnd->tmDate;
101 /// Ascending revision sorting.
102 struct AscRevSort
104 bool operator()(GitRev& pStart, GitRev& pEnd)
106 return pStart->Rev < pEnd->Rev;
109 /// Descending revision sorting.
110 struct DescRevSort
112 bool operator()(GitRev& pStart, GitRev& pEnd)
114 return pStart->Rev > pEnd->Rev;
117 /// Ascending author sorting.
118 struct AscAuthorSort
120 bool operator()(GitRev& pStart, GitRev& pEnd)
122 int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);
123 if (ret == 0)
124 return pStart->Rev < pEnd->Rev;
125 return ret<0;
128 /// Descending author sorting.
129 struct DescAuthorSort
131 bool operator()(GitRev& pStart, GitRev& pEnd)
133 int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);
134 if (ret == 0)
135 return pStart->Rev > pEnd->Rev;
136 return ret>0;
139 /// Ascending bugID sorting.
140 struct AscBugIDSort
142 bool operator()(GitRev& pStart, GitRev& pEnd)
144 int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);
145 if (ret == 0)
146 return pStart->Rev < pEnd->Rev;
147 return ret<0;
150 /// Descending bugID sorting.
151 struct DescBugIDSort
153 bool operator()(GitRev& pStart, GitRev& pEnd)
155 int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);
156 if (ret == 0)
157 return pStart->Rev > pEnd->Rev;
158 return ret>0;
161 /// Ascending message sorting.
162 struct AscMessageSort
164 bool operator()(GitRev& pStart, GitRev& pEnd)
166 return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)<0;
169 /// Descending message sorting.
170 struct DescMessageSort
172 bool operator()(GitRev& pStart, GitRev& pEnd)
174 return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)>0;
177 /// Ascending action sorting
178 struct AscActionSort
180 bool operator() (GitRev& pStart, GitRev& pEnd)
182 if (pStart->actions == pEnd->actions)
183 return pStart->Rev < pEnd->Rev;
184 return pStart->actions < pEnd->actions;
187 /// Descending action sorting
188 struct DescActionSort
190 bool operator() (GitRev& pStart, GitRev& pEnd)
192 if (pStart->actions == pEnd->actions)
193 return pStart->Rev > pEnd->Rev;
194 return pStart->actions > pEnd->actions;
197 #endif