1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2007 - TortoiseSVN
4 // Copyright (C) 2008-2013 - 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.
23 #include "GitStatus.h"
24 #include "ILogReceiver.h"
28 #include "GitLogCache.h"
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
;
41 CStoreSelection(CLogDlg
* dlg
);
45 std::set
<LONG
> m_SetSelectedRevisions
;
50 * \ingroup TortoiseProc
51 * Helper class for the log dialog, handles all the log entries, including
54 class CLogDataVector
: public std::vector
<CGitHash
>
57 CLogCache
*m_pLogCache
;
58 /// De-allocates log items.
59 CLogDataVector(CLogCache
*pLogCache
)
61 m_pLogCache
=pLogCache
;
69 void SetLogCache(CLogCache
*pLogCache
)
71 m_pLogCache
= pLogCache
;
73 GitRev
& GetGitRevAt(size_t i
)
76 return m_pLogCache
->m_HashMap
[(*this)[i
]];
79 int ParserFromLog(CTGitPath
*path
=NULL
, int count
= -1, int infomask
= CGit::LOG_INFO_STAT
| CGit::LOG_INFO_FILESTATE
| CGit::LOG_INFO_SHOW_MERGEDFILE
, CString
*range
= NULL
);
81 int FetchShortLog(CTGitPath
*path
, CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
, int showWC
=0 );
82 int ParserShortLog(CTGitPath
*path
,CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
);
84 int ParserFromRefLog(CString ref
);
86 int FetchFullInfo(int i
);
91 MAP_HASH_REV m_HashMap
;
92 void updateLanes(GitRev
& c
, Lanes
& lns
, CGitHash
&sha
) ;
93 void setLane(CGitHash
& sha
) ;
95 BYTE_VECTOR m_RawlogData
;
96 std::vector
<int> m_RawLogStart
;
99 /// Ascending date sorting.
102 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
104 return pStart
->tmDate
< pEnd
->tmDate
;
107 /// Descending date sorting.
110 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
112 return pStart
->tmDate
> pEnd
->tmDate
;
115 /// Ascending revision sorting.
118 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
120 return pStart
->Rev
< pEnd
->Rev
;
123 /// Descending revision sorting.
126 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
128 return pStart
->Rev
> pEnd
->Rev
;
131 /// Ascending author sorting.
134 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
136 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
138 return pStart
->Rev
< pEnd
->Rev
;
142 /// Descending author sorting.
143 struct DescAuthorSort
145 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
147 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
149 return pStart
->Rev
> pEnd
->Rev
;
153 /// Ascending bugID sorting.
156 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
158 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
160 return pStart
->Rev
< pEnd
->Rev
;
164 /// Descending bugID sorting.
167 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
169 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
171 return pStart
->Rev
> pEnd
->Rev
;
175 /// Ascending message sorting.
176 struct AscMessageSort
178 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
180 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)<0;
183 /// Descending message sorting.
184 struct DescMessageSort
186 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
188 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)>0;
191 /// Ascending action sorting
194 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
196 if (pStart
->actions
== pEnd
->actions
)
197 return pStart
->Rev
< pEnd
->Rev
;
198 return pStart
->actions
< pEnd
->actions
;
201 /// Descending action sorting
202 struct DescActionSort
204 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
206 if (pStart
->actions
== pEnd
->actions
)
207 return pStart
->Rev
> pEnd
->Rev
;
208 return pStart
->actions
> pEnd
->actions
;