Keep the font size of 8 for the explorer property page
[TortoiseGit.git] / src / Git / GitRevLoglist.h
blob6cc14d4b1ea3f0e0d0fc577f5e1721d14eed1216
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2018 - 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.
20 #pragma once
21 #include "GitRev.h"
22 #include "TGitPath.h"
23 #include "gitdll.h"
25 class CGit;
26 extern CGit g_Git;
27 class GitRevLoglist;
28 class CLogCache;
29 class IAsyncDiffCB;
31 typedef int CALL_UPDATE_DIFF_ASYNC(GitRevLoglist* pRev, IAsyncDiffCB* data);
33 class GitRevLoglist : public GitRev
35 public:
36 friend class CLogCache;
38 GitRevLoglist(void);
39 ~GitRevLoglist(void);
41 protected:
42 int m_RebaseAction;
43 unsigned int m_Action;
44 CTGitPathList m_Files;
45 CTGitPathList m_UnRevFiles;
47 public:
48 GIT_COMMIT m_GitCommit;
50 CString m_Notes;
52 TCHAR m_Mark;
53 CString m_Ref; // for Refloglist
54 CString m_RefAction; // for Refloglist
56 // Show version tree Graphic
57 std::vector<int> m_Lanes;
59 volatile LONG m_IsFull;
60 volatile LONG m_IsUpdateing;
61 volatile LONG m_IsCommitParsed;
62 volatile LONG m_IsDiffFiles;
64 CALL_UPDATE_DIFF_ASYNC *m_CallDiffAsync;
66 int CheckAndDiff()
68 if (!m_IsDiffFiles && !m_CommitHash.IsEmpty())
70 int ret = 0;
71 ret = SafeFetchFullInfo(&g_Git);
72 InterlockedExchange(&m_IsDiffFiles, TRUE);
73 if (m_IsCommitParsed)
74 InterlockedExchange(&m_IsFull, TRUE);
75 return ret;
77 return 1;
80 public:
81 unsigned int& GetAction(IAsyncDiffCB* data)
83 CheckAndParser();
84 if (!m_IsDiffFiles && m_CallDiffAsync)
85 m_CallDiffAsync(this, data);
86 else
87 CheckAndDiff();
88 return m_Action;
91 int& GetRebaseAction()
93 return m_RebaseAction;
96 CTGitPathList& GetFiles(IAsyncDiffCB* data)
98 CheckAndParser();
99 if (data && !m_IsDiffFiles && m_CallDiffAsync)
100 m_CallDiffAsync(this, data);
101 else
102 CheckAndDiff();
103 return m_Files;
106 CTGitPathList& GetUnRevFiles()
108 return m_UnRevFiles;
111 protected:
112 void CheckAndParser()
114 if (!m_IsCommitParsed && m_GitCommit.m_pGitCommit)
116 ParserFromCommit(&m_GitCommit);
117 InterlockedExchange(&m_IsCommitParsed, TRUE);
118 git_free_commit(&m_GitCommit);
119 if (m_IsDiffFiles)
120 InterlockedExchange(&m_IsFull, TRUE);
124 public:
125 CString& GetAuthorName()
127 CheckAndParser();
128 return m_AuthorName;
131 CString& GetAuthorEmail()
133 CheckAndParser();
134 return m_AuthorEmail;
137 CTime& GetAuthorDate()
139 CheckAndParser();
140 return m_AuthorDate;
143 CString& GetCommitterName()
145 CheckAndParser();
146 return m_CommitterName;
149 CString& GetCommitterEmail()
151 CheckAndParser();
152 return m_CommitterEmail;
155 CTime& GetCommitterDate()
157 CheckAndParser();
158 return m_CommitterDate;
161 CString& GetSubject()
163 CheckAndParser();
164 return m_Subject;
167 CString& GetBody()
169 CheckAndParser();
170 return m_Body;
173 CString GetSubjectBody(bool crlf = false)
175 CheckAndParser();
176 CString ret(m_Subject);
177 if (!crlf)
179 ret += L"\n";
180 ret += m_Body;
182 else
184 ret.TrimRight();
185 ret += L"\r\n";
186 CString body(m_Body);
187 body.Replace(L"\n", L"\r\n");
188 ret += body.TrimRight();
190 return ret;
193 BOOL IsBoundary() { return m_Mark == L'-'; }
195 virtual void Clear() override;
197 int SafeFetchFullInfo(CGit* git);
199 int SafeGetSimpleList(CGit* git);
200 volatile LONG m_IsSimpleListReady;
201 STRING_VECTOR m_SimpleFileList; /* use for find and filter, no rename detection and line num stat info */
203 static int GetRefLog(const CString& ref, std::vector<GitRevLoglist>& refloglist, CString& error);