OSDN Git Service

Change Dir Structure to be same as TortoiseSVN'
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / RevisionGraph / FullHistory.h
diff --git a/src/TortoiseProc/RevisionGraph/FullHistory.h b/src/TortoiseProc/RevisionGraph/FullHistory.h
new file mode 100644 (file)
index 0000000..b96217a
--- /dev/null
@@ -0,0 +1,177 @@
+// TortoiseSVN - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2003-2008 - TortoiseSVN\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#pragma once\r
+\r
+#include "SVN.h"\r
+#include "SVNPrompt.h"\r
+#include "SVNLogQuery.h"\r
+#include "CacheLogQuery.h"\r
+\r
+class CFullGraphNode;\r
+\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * helper struct containing information about a copy operation in the revision graph\r
+ */\r
+class SCopyInfo\r
+{\r
+public:\r
+\r
+       revision_t fromRevision;\r
+       index_t fromPathIndex;\r
+       revision_t toRevision;\r
+       index_t toPathIndex;\r
+\r
+       struct STarget\r
+       {\r
+               CFullGraphNode* source;\r
+               CDictionaryBasedTempPath path;\r
+\r
+               STarget ( CFullGraphNode* source\r
+                               , const CDictionaryBasedTempPath& path)\r
+                       : source (source)\r
+                       , path (path)\r
+               {\r
+               }\r
+       };\r
+\r
+       std::vector<STarget> targets;\r
+\r
+    static SCopyInfo* Create (boost::pool<>& copyInfoPool)\r
+    {\r
+        SCopyInfo* result = static_cast<SCopyInfo*>(copyInfoPool.malloc());\r
+        new (result) SCopyInfo();\r
+        return result;\r
+    }\r
+\r
+    void Destroy (boost::pool<>& copyInfoPool)\r
+    {\r
+        this->~SCopyInfo();\r
+        copyInfoPool.free (this);\r
+    }\r
+};\r
+\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * Handles and analyzes log data to produce a revision graph.\r
+ * \r
+ * Since Subversion only stores information where each entry is copied \b from\r
+ * and not where it is copied \b to, the first thing we do here is crawl all\r
+ * revisions and create separate CRevisionEntry objects where we store the\r
+ * information where those are copied \b to.\r
+ *\r
+ * In a next step, we go again through all the CRevisionEntry objects to find\r
+ * out if they are related to the path we're looking at. If they are, we mark\r
+ * them as \b in-use.\r
+ */\r
+class CFullHistory : private ILogReceiver\r
+{\r
+public:\r
+\r
+    /// construction / destruction\r
+\r
+       CFullHistory(void);\r
+       ~CFullHistory(void);\r
+\r
+    /// query data\r
+\r
+       bool                                            FetchRevisionData (CString path, SVNRev pegRev, bool showWCRev, CProgressDlg* progress);\r
+\r
+    /// data access\r
+\r
+       CString                                         GetLastErrorMessage() const;\r
+\r
+       svn_revnum_t                            GetHeadRevision() const {return headRevision;}\r
+       svn_revnum_t                            GetPegRevision() const {return pegRevision;}\r
+       CString                                         GetRepositoryRoot() const {return CString (repoRoot);}\r
+       CString                                         GetRepositoryUUID() const {return uuid;}\r
+       CString                                         GetRelativePath() const {return CString (relPath);}\r
+\r
+    const CDictionaryBasedTempPath* GetStartPath() const {return startPath.get();}\r
+    revision_t                  GetStartRevision() const {return startRevision;}\r
+\r
+    const CDictionaryBasedTempPath* GetWCPath() const {return wcPath.get();}\r
+    revision_t                  GetWCRevision() const {return wcRevision;}\r
+\r
+    SCopyInfo**                 GetFirstCopyFrom() const {return copyFromRelation;}\r
+    SCopyInfo**                 GetFirstCopyTo() const {return copyToRelation;}\r
+    void                        GetCopyFromRange (SCopyInfo**& first, SCopyInfo**& last, revision_t revision) const;\r
+    void                        GetCopyToRange (SCopyInfo**& first, SCopyInfo**& last, revision_t revision) const;\r
+\r
+    SVN&                        GetSVN() {return svn;}\r
+    const CCachedLogInfo*       GetCache() const {return cache;}\r
+\r
+private:\r
+\r
+    /// data members\r
+\r
+    CProgressDlg*                  progress;\r
+\r
+    CStringA                                   repoRoot;\r
+       CStringA                                        relPath;\r
+    CString                     uuid;\r
+       revision_t                                      headRevision;\r
+       revision_t                                      pegRevision;\r
+\r
+       svn_client_ctx_t                        ctx;\r
+       SVNPrompt                                       prompt;\r
+       SVN                                                     svn;\r
+\r
+       svn_error_t *                           Err;                    ///< Global error object struct\r
+       apr_pool_t *                            parentpool;\r
+       apr_pool_t *                            pool;                   ///< memory pool\r
+\r
+       bool                                            cancelled;\r
+\r
+    const CCachedLogInfo*       cache;\r
+       std::auto_ptr<CSVNLogQuery> svnQuery;\r
+       std::auto_ptr<CCacheLogQuery> query;\r
+\r
+    std::auto_ptr<CDictionaryBasedTempPath> startPath;\r
+    revision_t                  startRevision;\r
+\r
+       std::auto_ptr<CDictionaryBasedTempPath> wcPath;\r
+    revision_t                  wcRevision;\r
+\r
+    boost::pool<>               copyInfoPool;\r
+       std::vector<SCopyInfo*>         copiesContainer;\r
+       SCopyInfo**                         copyToRelation;\r
+       SCopyInfo**                         copyToRelationEnd;\r
+       SCopyInfo**                         copyFromRelation;\r
+       SCopyInfo**                         copyFromRelationEnd;\r
+\r
+    /// SVN callback\r
+\r
+       static svn_error_t*                     cancel(void *baton);\r
+\r
+    /// utility methods\r
+\r
+    void                        ClearCopyInfo();\r
+       void                                            AnalyzeRevisionData();\r
+       void                                            BuildForwardCopies();\r
+       \r
+       /// implement ILogReceiver\r
+\r
+       void ReceiveLog ( LogChangedPathArray* changes\r
+                                       , svn_revnum_t rev\r
+                    , const StandardRevProps* stdRevProps\r
+                    , UserRevPropArray* userRevProps\r
+                    , bool mergesFollow);\r
+\r
+};\r