OSDN Git Service

Change Dir Structure to be same as TortoiseSVN'
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / ProjectProperties.h
diff --git a/src/TortoiseProc/ProjectProperties.h b/src/TortoiseProc/ProjectProperties.h
new file mode 100644 (file)
index 0000000..0f0bf95
--- /dev/null
@@ -0,0 +1,212 @@
+// 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
+#include <iostream>\r
+#include <string>\r
+#include "TGitPath.h"\r
+using namespace std;\r
+\r
+#define BUGTRAQPROPNAME_LABEL             _T("bugtraq:label")\r
+#define BUGTRAQPROPNAME_MESSAGE           _T("bugtraq:message")\r
+#define BUGTRAQPROPNAME_NUMBER            _T("bugtraq:number")\r
+#define BUGTRAQPROPNAME_LOGREGEX                 _T("bugtraq:logregex")\r
+#define BUGTRAQPROPNAME_URL               _T("bugtraq:url")\r
+#define BUGTRAQPROPNAME_WARNIFNOISSUE     _T("bugtraq:warnifnoissue")\r
+#define BUGTRAQPROPNAME_APPEND               _T("bugtraq:append")\r
+\r
+#define PROJECTPROPNAME_LOGTEMPLATE              _T("tsvn:logtemplate")\r
+#define PROJECTPROPNAME_LOGWIDTHLINE     _T("tsvn:logwidthmarker")\r
+#define PROJECTPROPNAME_LOGMINSIZE               _T("tsvn:logminsize")\r
+#define PROJECTPROPNAME_LOCKMSGMINSIZE   _T("tsvn:lockmsgminsize")\r
+#define PROJECTPROPNAME_LOGFILELISTLANG          _T("tsvn:logfilelistenglish")\r
+#define PROJECTPROPNAME_LOGSUMMARY               _T("tsvn:logsummary")\r
+#define PROJECTPROPNAME_PROJECTLANGUAGE   _T("tsvn:projectlanguage")\r
+#define PROJECTPROPNAME_USERFILEPROPERTY  _T("tsvn:userfileproperties")\r
+#define PROJECTPROPNAME_USERDIRPROPERTY   _T("tsvn:userdirproperties")\r
+#define PROJECTPROPNAME_AUTOPROPS                _T("tsvn:autoprops")\r
+\r
+#define PROJECTPROPNAME_WEBVIEWER_REV     _T("webviewer:revision")\r
+#define PROJECTPROPNAME_WEBVIEWER_PATHREV _T("webviewer:pathrevision")\r
+\r
+class CTSVNPathList;\r
+struct svn_config_t;\r
+\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * Provides methods for retrieving information about bug/issue trackers\r
+ * associated with a Subversion repository/working copy and other project\r
+ * related properties.\r
+ */\r
+class ProjectProperties\r
+{\r
+public:\r
+       ProjectProperties(void);\r
+       ~ProjectProperties(void);\r
+\r
+       /**\r
+        * Reads the properties from a path. If the path is a file\r
+        * then the properties are read from the parent folder of that file.\r
+        * \param path path to a file or a folder\r
+        */\r
+       BOOL ReadProps(CTGitPath path);\r
+       /**\r
+        * Reads the properties from all paths found in a path list.\r
+        * This method calls ReadProps() for each path .\r
+        * \param list of paths\r
+        */\r
+       BOOL ReadPropsPathList(const CTGitPathList& pathList);\r
+\r
+       /**\r
+        * Searches for the BugID inside a log message. If one is found,\r
+        * the method returns TRUE. The rich edit control is used to set\r
+        * the CFE_LINK effect on the BugID's.\r
+        * \param msg the log message\r
+        * \param pWnd Pointer to a rich edit control\r
+        */\r
+       BOOL FindBugID(const CString& msg, CWnd * pWnd);\r
+\r
+       CString FindBugID(const CString& msg);\r
+       /**\r
+        * Searches for the BugID inside a log message. If one is found,\r
+        * that BugID is returned. If none is found, an empty string is returned.\r
+        * The \c msg is trimmed off the BugID.\r
+        */\r
+       CString GetBugIDFromLog(CString& msg);\r
+       \r
+       /**\r
+        * Checks if the bug ID is valid. If bugtraq:number is 'true', then the\r
+        * functions checks if the bug ID doesn't contain any non-number chars in it.\r
+        */\r
+       BOOL CheckBugID(const CString& sID);\r
+       \r
+       /**\r
+        * Checks if the log message \c sMessage contains a bug ID. This is done by\r
+        * using the bugtraq:checkre property.\r
+        */\r
+       BOOL HasBugID(const CString& sMessage);\r
+       \r
+       /**\r
+        * Returns the URL pointing to the Issue in the issue tracker. The URL is\r
+        * created from the bugtraq:url property and the BugID found in the log message.\r
+        * \param msg the BugID extracted from the log message\r
+        */\r
+       CString GetBugIDUrl(const CString& sBugID);\r
+\r
+       /**\r
+        * Inserts the tGit:autoprops into the Subversion config section.\r
+        * Call this before an import or an add operation.\r
+        */\r
+       //void InsertAutoProps(git_config_t *cfg);\r
+\r
+       /**\r
+        * Adds all the project properties to the specified entry\r
+        */\r
+       bool AddAutoProps(const CTGitPath& path);\r
+\r
+       /**\r
+        * Returns the log message summary if the tGit:logsummaryregex property is\r
+        * set and there are actually some matches.\r
+        * Otherwise, an empty string is returned.\r
+        */\r
+       CString GetLogSummary(const CString& sMessage);\r
+\r
+       /**\r
+        * Returns the path from which the properties were read.\r
+        */\r
+       CTGitPath GetPropsPath() {return propsPath;}\r
+public:\r
+       /** The label to show in the commit dialog where the issue number/bug id\r
+        * is entered. Example: "Bug-ID: " or "Issue-No.:". Default is "Bug-ID :" */\r
+       CString         sLabel;\r
+\r
+       /** The message string to add below the log message the user entered.\r
+        * It must contain the string "%BUGID%" which gets replaced by the client \r
+        * with the issue number / bug id the user entered. */\r
+       CString         sMessage;\r
+\r
+       /** If this is set, then the bug-id / issue number must be a number, no text */\r
+       BOOL            bNumber;\r
+\r
+       /** replaces bNumer: a regular expression string to check the validity of\r
+         * the entered bug ID. */\r
+       CString         sCheckRe;\r
+       \r
+       /** used to extract the bug ID from the string matched by sCheckRe */\r
+       CString         sBugIDRe;\r
+       \r
+       /** The url pointing to the issue tracker. If the url contains the string\r
+        * "%BUGID% the client has to replace it with the issue number / bug id\r
+        * the user entered. */\r
+       CString         sUrl;\r
+       \r
+       /** If set to TRUE, show a warning dialog if the user forgot to enter\r
+        * an issue number in the commit dialog. */\r
+       BOOL            bWarnIfNoIssue;\r
+\r
+       /** If set to FALSE, then the bug tracking entry is inserted at the top of the\r
+          log message instead of at the bottom. Default is TRUE */\r
+       BOOL            bAppend;\r
+\r
+       /** The number of chars the width marker should be shown at. If the property\r
+        * is not set, then this value is 80 by default. */\r
+       int                     nLogWidthMarker;\r
+\r
+       /** The template to use for log messages. */\r
+       CString         sLogTemplate;\r
+\r
+       /** Minimum size a log message must have in chars */\r
+       int                     nMinLogSize;\r
+\r
+       /** Minimum size a lock message must have in chars */\r
+       int                     nMinLockMsgSize;\r
+\r
+       /** TRUE if the file list to be inserted in the commit dialog should be in\r
+        * English and not in the localized language. Default is TRUE */\r
+       BOOL            bFileListInEnglish;\r
+       \r
+       /** The language identifier this project uses for log messages. */\r
+       LONG            lProjectLanguage;\r
+\r
+       /** holds user defined properties for files. */\r
+       CString         sFPPath;\r
+\r
+       /** holds user defined properties for directories. */\r
+       CString         sDPPath;\r
+\r
+       /** The url pointing to the web viewer. The string %REVISION% is replaced\r
+        *  with the revision number, "HEAD", or a date */\r
+       CString         sWebViewerRev;\r
+\r
+       /** The url pointing to the web viewer. The string %REVISION% is replaced\r
+        *  with the revision number, "HEAD", or a date. The string %PATH% is replaced\r
+        *  with the path relative to the repository root, e.g. "/trunk/src/file" */\r
+       CString         sWebViewerPathRev;\r
+\r
+       /**\r
+        * The regex string to extract a summary from a log message. The summary\r
+        * is the first matching regex group.\r
+        */\r
+       CString         sLogSummaryRe;\r
+private:\r
+       CString         sAutoProps;\r
+       CTGitPath       propsPath;\r
+#ifdef DEBUG\r
+       friend class PropTest;\r
+#endif\r
+};\r