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"
30 * \ingroup TortoiseProc
31 * Instances of CStoreSelection save the selection of the CLogDlg. When the instance
32 * is deleted the destructor restores the selection.
34 typedef std::map
<CString
, int> MAP_HASH_REV
;
39 CStoreSelection(CLogDlg
* dlg
);
43 std::set
<LONG
> m_SetSelectedRevisions
;
48 * \ingroup TortoiseProc
49 * Helper class for the log dialog, handles all the log entries, including
52 class CLogDataVector
: public std::vector
<GitRev
>
55 /// De-allocates log items.
61 int ParserFromLog(CTGitPath
*path
=NULL
,int count
= -1,int infomask
=CGit::LOG_INFO_STAT
|CGit::LOG_INFO_FILESTATE
|CGit::LOG_INFO_SHOW_MERGEDFILE
,
62 CString
*from
=NULL
,CString
*to
=NULL
);
64 int FetchShortLog(CTGitPath
*path
, CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
, int showWC
=0 );
65 int ParserShortLog(CTGitPath
*path
,CString
&hash
,int count
=-1 ,int mask
=CGit::LOG_INFO_ONLY_HASH
);
67 int ParserFromRefLog(CString ref
);
69 int FetchFullInfo(int i
);
74 MAP_HASH_REV m_HashMap
;
75 void updateLanes(GitRev
& c
, Lanes
& lns
, CString
&sha
) ;
76 void setLane(CString
& sha
) ;
78 BYTE_VECTOR m_RawlogData
;
79 std::vector
<int> m_RawLogStart
;
82 /// Ascending date sorting.
85 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
87 return pStart
->tmDate
< pEnd
->tmDate
;
90 /// Descending date sorting.
93 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
95 return pStart
->tmDate
> pEnd
->tmDate
;
98 /// Ascending revision sorting.
101 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
103 return pStart
->Rev
< pEnd
->Rev
;
106 /// Descending revision sorting.
109 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
111 return pStart
->Rev
> pEnd
->Rev
;
114 /// Ascending author sorting.
117 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
119 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
121 return pStart
->Rev
< pEnd
->Rev
;
125 /// Descending author sorting.
126 struct DescAuthorSort
128 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
130 int ret
= pStart
->sAuthor
.CompareNoCase(pEnd
->sAuthor
);
132 return pStart
->Rev
> pEnd
->Rev
;
136 /// Ascending bugID sorting.
139 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
141 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
143 return pStart
->Rev
< pEnd
->Rev
;
147 /// Descending bugID sorting.
150 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
152 int ret
= pStart
->sBugIDs
.CompareNoCase(pEnd
->sBugIDs
);
154 return pStart
->Rev
> pEnd
->Rev
;
158 /// Ascending message sorting.
159 struct AscMessageSort
161 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
163 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)<0;
166 /// Descending message sorting.
167 struct DescMessageSort
169 bool operator()(GitRev
& pStart
, GitRev
& pEnd
)
171 return pStart
->sShortMessage
.CompareNoCase(pEnd
->sShortMessage
)>0;
174 /// Ascending action sorting
177 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
179 if (pStart
->actions
== pEnd
->actions
)
180 return pStart
->Rev
< pEnd
->Rev
;
181 return pStart
->actions
< pEnd
->actions
;
184 /// Descending action sorting
185 struct DescActionSort
187 bool operator() (GitRev
& pStart
, GitRev
& pEnd
)
189 if (pStart
->actions
== pEnd
->actions
)
190 return pStart
->Rev
> pEnd
->Rev
;
191 return pStart
->actions
> pEnd
->actions
;