1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2017 - 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.
26 typedef std::vector
<CGitHash
> GIT_REV_LIST
;
28 #define LOG_REV_AUTHOR_NAME L'0'
29 #define LOG_REV_AUTHOR_EMAIL L'1'
30 #define LOG_REV_AUTHOR_DATE L'2'
31 #define LOG_REV_COMMIT_NAME L'3'
32 #define LOG_REV_COMMIT_EMAIL L'4'
33 #define LOG_REV_COMMIT_DATE L'5'
34 #define LOG_REV_COMMIT_SUBJECT L'6'
35 #define LOG_REV_COMMIT_BODY L'7'
36 #define LOG_REV_COMMIT_HASH L'8'
37 #define LOG_REV_COMMIT_PARENT L'9'
38 #define LOG_REV_COMMIT_FILE L'A'
39 #define LOG_REV_ITEM_BEGIN L'B'
40 #define LOG_REV_ITEM_END L'C'
46 CString m_AuthorEmail
;
48 CString m_CommitterName
;
49 CString m_CommitterEmail
;
50 CTime m_CommitterDate
;
58 CString
GetAuthorName() const
63 CString
GetAuthorEmail() const
68 CTime
GetAuthorDate() const
73 CString
GetCommitterName() const
75 return m_CommitterName
;
78 CString
GetCommitterEmail() const
80 return m_CommitterEmail
;
83 CTime
GetCommitterDate() const
85 return m_CommitterDate
;
88 CString
GetSubject() const
93 CString
GetBody() const
98 virtual ~GitRev(void);
102 REV_HEAD
= -1, ///< head revision
103 REV_BASE
= -2, ///< base revision
104 REV_WC
= -3, ///< revision of the working copy
105 REV_UNSPECIFIED
= -4, ///< unspecified revision
108 static CString
GetHead() { return L
"HEAD"; };
109 static CString
GetWorkingCopy() { return GIT_REV_ZERO
; };
111 CGitHash m_CommitHash
;
112 GIT_REV_LIST m_ParentHash
;
114 virtual void Clear();
115 inline int ParentsCount(){ return (int)m_ParentHash
.size(); }
117 int ParserFromCommit(GIT_COMMIT
*commit
);
118 int ParserParentFromCommit(GIT_COMMIT
*commit
);
120 int ParserFromCommit(const git_commit
* commit
);
121 int ParserParentFromCommit(const git_commit
* commit
);
122 int GetCommitFromHash(git_repository
* repo
, const CGitHash
& hash
);
123 int GetCommit(git_repository
* repo
, const CString
& Rev
);
125 int GetParentFromHash(const CGitHash
& hash
);
126 int GetCommitFromHash(const CGitHash
& hash
);
127 int GetCommit(const CString
& rev
);
129 CString
GetLastErr() const { return m_sErr
; }
134 int GetCommitFromHash_withoutLock(const CGitHash
& hash
);