1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2007 - TortoiseSVN
4 // Copyright (C) 2008-2011 - 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(int 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
,
80 CString
*from
=NULL
,CString
*to
=NULL
);
82 int FetchShortLog(CTGitPath
*path
, CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
, int showWC
=0 );
83 int ParserShortLog(CTGitPath
*path
,CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
);
85 int ParserFromRefLog(CString ref
);
87 int FetchFullInfo(int i
);
92 MAP_HASH_REV m_HashMap
;
93 void updateLanes(GitRev
& c
, Lanes
& lns
, CGitHash
&sha
) ;
94 void setLane(CGitHash
& sha
) ;
96 BYTE_VECTOR m_RawlogData
;
97 std::vector
<int> m_RawLogStart
;
100 /// Ascending date sorting.
103 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
105 return pStart
->tmDate
< pEnd
->tmDate
;
108 /// Descending date sorting.
111 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
113 return pStart
->tmDate
> pEnd
->tmDate
;
116 /// Ascending revision sorting.
119 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
121 return pStart
->Rev
< pEnd
->Rev
;
124 /// Descending revision sorting.
127 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
129 return pStart
->Rev
> pEnd
->Rev
;
132 /// Ascending author sorting.
135 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
137 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
139 return pStart
->Rev
< pEnd
->Rev
;
143 /// Descending author sorting.
144 struct DescAuthorSort
146 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
148 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
150 return pStart
->Rev
> pEnd
->Rev
;
154 /// Ascending bugID sorting.
157 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
159 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
161 return pStart
->Rev
< pEnd
->Rev
;
165 /// Descending bugID sorting.
168 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
170 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
172 return pStart
->Rev
> pEnd
->Rev
;
176 /// Ascending message sorting.
177 struct AscMessageSort
179 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
181 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)<0;
184 /// Descending message sorting.
185 struct DescMessageSort
187 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
189 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)>0;
192 /// Ascending action sorting
195 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
197 if (pStart
->actions
== pEnd
->actions
)
198 return pStart
->Rev
< pEnd
->Rev
;
199 return pStart
->actions
< pEnd
->actions
;
202 /// Descending action sorting
203 struct DescActionSort
205 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
207 if (pStart
->actions
== pEnd
->actions
)
208 return pStart
->Rev
> pEnd
->Rev
;
209 return pStart
->actions
> pEnd
->actions
;