OSDN Git Service

Show Ignore Sub Menu
[tortoisegit/TortoiseGitJp.git] / TortoiseProc / RevisionGraph / FullHistory.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 \r
21 #include "SVN.h"\r
22 #include "SVNPrompt.h"\r
23 #include "SVNLogQuery.h"\r
24 #include "CacheLogQuery.h"\r
25 \r
26 class CFullGraphNode;\r
27 \r
28 /**\r
29  * \ingroup TortoiseProc\r
30  * helper struct containing information about a copy operation in the revision graph\r
31  */\r
32 class SCopyInfo\r
33 {\r
34 public:\r
35 \r
36         revision_t fromRevision;\r
37         index_t fromPathIndex;\r
38         revision_t toRevision;\r
39         index_t toPathIndex;\r
40 \r
41         struct STarget\r
42         {\r
43                 CFullGraphNode* source;\r
44                 CDictionaryBasedTempPath path;\r
45 \r
46                 STarget ( CFullGraphNode* source\r
47                                 , const CDictionaryBasedTempPath& path)\r
48                         : source (source)\r
49                         , path (path)\r
50                 {\r
51                 }\r
52         };\r
53 \r
54         std::vector<STarget> targets;\r
55 \r
56     static SCopyInfo* Create (boost::pool<>& copyInfoPool)\r
57     {\r
58         SCopyInfo* result = static_cast<SCopyInfo*>(copyInfoPool.malloc());\r
59         new (result) SCopyInfo();\r
60         return result;\r
61     }\r
62 \r
63     void Destroy (boost::pool<>& copyInfoPool)\r
64     {\r
65         this->~SCopyInfo();\r
66         copyInfoPool.free (this);\r
67     }\r
68 };\r
69 \r
70 /**\r
71  * \ingroup TortoiseProc\r
72  * Handles and analyzes log data to produce a revision graph.\r
73  * \r
74  * Since Subversion only stores information where each entry is copied \b from\r
75  * and not where it is copied \b to, the first thing we do here is crawl all\r
76  * revisions and create separate CRevisionEntry objects where we store the\r
77  * information where those are copied \b to.\r
78  *\r
79  * In a next step, we go again through all the CRevisionEntry objects to find\r
80  * out if they are related to the path we're looking at. If they are, we mark\r
81  * them as \b in-use.\r
82  */\r
83 class CFullHistory : private ILogReceiver\r
84 {\r
85 public:\r
86 \r
87     /// construction / destruction\r
88 \r
89         CFullHistory(void);\r
90         ~CFullHistory(void);\r
91 \r
92     /// query data\r
93 \r
94         bool                                            FetchRevisionData (CString path, SVNRev pegRev, bool showWCRev, CProgressDlg* progress);\r
95 \r
96     /// data access\r
97 \r
98         CString                                         GetLastErrorMessage() const;\r
99 \r
100         svn_revnum_t                            GetHeadRevision() const {return headRevision;}\r
101         svn_revnum_t                            GetPegRevision() const {return pegRevision;}\r
102         CString                                         GetRepositoryRoot() const {return CString (repoRoot);}\r
103         CString                                         GetRepositoryUUID() const {return uuid;}\r
104         CString                                         GetRelativePath() const {return CString (relPath);}\r
105 \r
106     const CDictionaryBasedTempPath* GetStartPath() const {return startPath.get();}\r
107     revision_t                  GetStartRevision() const {return startRevision;}\r
108 \r
109     const CDictionaryBasedTempPath* GetWCPath() const {return wcPath.get();}\r
110     revision_t                  GetWCRevision() const {return wcRevision;}\r
111 \r
112     SCopyInfo**                 GetFirstCopyFrom() const {return copyFromRelation;}\r
113     SCopyInfo**                 GetFirstCopyTo() const {return copyToRelation;}\r
114     void                        GetCopyFromRange (SCopyInfo**& first, SCopyInfo**& last, revision_t revision) const;\r
115     void                        GetCopyToRange (SCopyInfo**& first, SCopyInfo**& last, revision_t revision) const;\r
116 \r
117     SVN&                        GetSVN() {return svn;}\r
118     const CCachedLogInfo*       GetCache() const {return cache;}\r
119 \r
120 private:\r
121 \r
122     /// data members\r
123 \r
124     CProgressDlg*                   progress;\r
125 \r
126     CStringA                                    repoRoot;\r
127         CStringA                                        relPath;\r
128     CString                     uuid;\r
129         revision_t                                      headRevision;\r
130         revision_t                                      pegRevision;\r
131 \r
132         svn_client_ctx_t                        ctx;\r
133         SVNPrompt                                       prompt;\r
134         SVN                                                     svn;\r
135 \r
136         svn_error_t *                           Err;                    ///< Global error object struct\r
137         apr_pool_t *                            parentpool;\r
138         apr_pool_t *                            pool;                   ///< memory pool\r
139 \r
140         bool                                            cancelled;\r
141 \r
142     const CCachedLogInfo*       cache;\r
143         std::auto_ptr<CSVNLogQuery> svnQuery;\r
144         std::auto_ptr<CCacheLogQuery> query;\r
145 \r
146     std::auto_ptr<CDictionaryBasedTempPath> startPath;\r
147     revision_t                  startRevision;\r
148 \r
149         std::auto_ptr<CDictionaryBasedTempPath> wcPath;\r
150     revision_t                  wcRevision;\r
151 \r
152     boost::pool<>               copyInfoPool;\r
153         std::vector<SCopyInfo*>         copiesContainer;\r
154         SCopyInfo**                         copyToRelation;\r
155         SCopyInfo**                         copyToRelationEnd;\r
156         SCopyInfo**                         copyFromRelation;\r
157         SCopyInfo**                         copyFromRelationEnd;\r
158 \r
159     /// SVN callback\r
160 \r
161         static svn_error_t*                     cancel(void *baton);\r
162 \r
163     /// utility methods\r
164 \r
165     void                        ClearCopyInfo();\r
166         void                                            AnalyzeRevisionData();\r
167         void                                            BuildForwardCopies();\r
168         \r
169         /// implement ILogReceiver\r
170 \r
171         void ReceiveLog ( LogChangedPathArray* changes\r
172                                         , svn_revnum_t rev\r
173                     , const StandardRevProps* stdRevProps\r
174                     , UserRevPropArray* userRevProps\r
175                     , bool mergesFollow);\r
176 \r
177 };\r