1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2007 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "GitStatus.h"
23 #include "ILogReceiver.h"
27 #include "GitLogCache.h"
31 * \ingroup TortoiseProc
32 * Instances of CStoreSelection save the selection of the CLogDlg. When the instance
33 * is deleted the destructor restores the selection.
35 typedef std::map
<CString
, int> MAP_HASH_REV
;
40 CStoreSelection(CLogDlg
* dlg
);
44 std::set
<LONG
> m_SetSelectedRevisions
;
49 * \ingroup TortoiseProc
50 * Helper class for the log dialog, handles all the log entries, including
53 class CLogDataVector
: public std::vector
<CGitHash
>
56 CLogCache
*m_pLogCache
;
57 /// De-allocates log items.
58 CLogDataVector(CLogCache
*pLogCache
)
60 m_pLogCache
=pLogCache
;
63 GitRev
& GetGitRevAt(int i
)
66 return m_pLogCache
->m_HashMap
[(*this)[i
]];
69 int ParserFromLog(CTGitPath
*path
=NULL
,int count
= -1,int infomask
=CGit::LOG_INFO_STAT
|CGit::LOG_INFO_FILESTATE
|CGit::LOG_INFO_SHOW_MERGEDFILE
,
70 CString
*from
=NULL
,CString
*to
=NULL
);
72 int FetchShortLog(CTGitPath
*path
, CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
, int showWC
=0 );
73 int ParserShortLog(CTGitPath
*path
,CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
);
75 int ParserFromRefLog(CString ref
);
77 int FetchFullInfo(int i
);
82 MAP_HASH_REV m_HashMap
;
83 void updateLanes(GitRev
& c
, Lanes
& lns
, CString
&sha
) ;
84 void setLane(CString
& sha
) ;
86 BYTE_VECTOR m_RawlogData
;
87 std::vector
<int> m_RawLogStart
;
90 /// Ascending date sorting.
93 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
95 return pStart
->tmDate
< pEnd
->tmDate
;
98 /// Descending date sorting.
101 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
103 return pStart
->tmDate
> pEnd
->tmDate
;
106 /// Ascending revision sorting.
109 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
111 return pStart
->Rev
< pEnd
->Rev
;
114 /// Descending revision sorting.
117 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
119 return pStart
->Rev
> pEnd
->Rev
;
122 /// Ascending author sorting.
125 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
127 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
129 return pStart
->Rev
< pEnd
->Rev
;
133 /// Descending author sorting.
134 struct DescAuthorSort
136 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
138 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
140 return pStart
->Rev
> pEnd
->Rev
;
144 /// Ascending bugID sorting.
147 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
149 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
151 return pStart
->Rev
< pEnd
->Rev
;
155 /// Descending bugID sorting.
158 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
160 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
162 return pStart
->Rev
> pEnd
->Rev
;
166 /// Ascending message sorting.
167 struct AscMessageSort
169 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
171 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)<0;
174 /// Descending message sorting.
175 struct DescMessageSort
177 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
179 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)>0;
182 /// Ascending action sorting
185 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
187 if (pStart
->actions
== pEnd
->actions
)
188 return pStart
->Rev
< pEnd
->Rev
;
189 return pStart
->actions
< pEnd
->actions
;
192 /// Descending action sorting
193 struct DescActionSort
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
;