OSDN Git Service

Show Auto following tag at log dialog box
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / ProjectProperties.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 #include <iostream>\r
21 #include <string>\r
22 #include "TGitPath.h"\r
23 using namespace std;\r
24 \r
25 #define BUGTRAQPROPNAME_LABEL             _T("bugtraq:label")\r
26 #define BUGTRAQPROPNAME_MESSAGE           _T("bugtraq:message")\r
27 #define BUGTRAQPROPNAME_NUMBER            _T("bugtraq:number")\r
28 #define BUGTRAQPROPNAME_LOGREGEX                  _T("bugtraq:logregex")\r
29 #define BUGTRAQPROPNAME_URL               _T("bugtraq:url")\r
30 #define BUGTRAQPROPNAME_WARNIFNOISSUE     _T("bugtraq:warnifnoissue")\r
31 #define BUGTRAQPROPNAME_APPEND                _T("bugtraq:append")\r
32 \r
33 #define PROJECTPROPNAME_LOGTEMPLATE               _T("tsvn:logtemplate")\r
34 #define PROJECTPROPNAME_LOGWIDTHLINE      _T("tsvn:logwidthmarker")\r
35 #define PROJECTPROPNAME_LOGMINSIZE                _T("tsvn:logminsize")\r
36 #define PROJECTPROPNAME_LOCKMSGMINSIZE    _T("tsvn:lockmsgminsize")\r
37 #define PROJECTPROPNAME_LOGFILELISTLANG   _T("tsvn:logfilelistenglish")\r
38 #define PROJECTPROPNAME_LOGSUMMARY                _T("tsvn:logsummary")\r
39 #define PROJECTPROPNAME_PROJECTLANGUAGE   _T("tsvn:projectlanguage")\r
40 #define PROJECTPROPNAME_USERFILEPROPERTY  _T("tsvn:userfileproperties")\r
41 #define PROJECTPROPNAME_USERDIRPROPERTY   _T("tsvn:userdirproperties")\r
42 #define PROJECTPROPNAME_AUTOPROPS                 _T("tsvn:autoprops")\r
43 \r
44 #define PROJECTPROPNAME_WEBVIEWER_REV     _T("webviewer:revision")\r
45 #define PROJECTPROPNAME_WEBVIEWER_PATHREV _T("webviewer:pathrevision")\r
46 \r
47 class CTSVNPathList;\r
48 struct svn_config_t;\r
49 \r
50 /**\r
51  * \ingroup TortoiseProc\r
52  * Provides methods for retrieving information about bug/issue trackers\r
53  * associated with a Subversion repository/working copy and other project\r
54  * related properties.\r
55  */\r
56 class ProjectProperties\r
57 {\r
58 public:\r
59         ProjectProperties(void);\r
60         ~ProjectProperties(void);\r
61 \r
62         /**\r
63          * Reads the properties from a path. If the path is a file\r
64          * then the properties are read from the parent folder of that file.\r
65          * \param path path to a file or a folder\r
66          */\r
67         BOOL ReadProps(CTGitPath path);\r
68         /**\r
69          * Reads the properties from all paths found in a path list.\r
70          * This method calls ReadProps() for each path .\r
71          * \param list of paths\r
72          */\r
73         BOOL ReadPropsPathList(const CTGitPathList& pathList);\r
74 \r
75         /**\r
76          * Searches for the BugID inside a log message. If one is found,\r
77          * the method returns TRUE. The rich edit control is used to set\r
78          * the CFE_LINK effect on the BugID's.\r
79          * \param msg the log message\r
80          * \param pWnd Pointer to a rich edit control\r
81          */\r
82         BOOL FindBugID(const CString& msg, CWnd * pWnd);\r
83 \r
84         CString FindBugID(const CString& msg);\r
85         /**\r
86          * Searches for the BugID inside a log message. If one is found,\r
87          * that BugID is returned. If none is found, an empty string is returned.\r
88          * The \c msg is trimmed off the BugID.\r
89          */\r
90         CString GetBugIDFromLog(CString& msg);\r
91         \r
92         /**\r
93          * Checks if the bug ID is valid. If bugtraq:number is 'true', then the\r
94          * functions checks if the bug ID doesn't contain any non-number chars in it.\r
95          */\r
96         BOOL CheckBugID(const CString& sID);\r
97         \r
98         /**\r
99          * Checks if the log message \c sMessage contains a bug ID. This is done by\r
100          * using the bugtraq:checkre property.\r
101          */\r
102         BOOL HasBugID(const CString& sMessage);\r
103         \r
104         /**\r
105          * Returns the URL pointing to the Issue in the issue tracker. The URL is\r
106          * created from the bugtraq:url property and the BugID found in the log message.\r
107          * \param msg the BugID extracted from the log message\r
108          */\r
109         CString GetBugIDUrl(const CString& sBugID);\r
110 \r
111         /**\r
112          * Inserts the tGit:autoprops into the Subversion config section.\r
113          * Call this before an import or an add operation.\r
114          */\r
115         //void InsertAutoProps(git_config_t *cfg);\r
116 \r
117         /**\r
118          * Adds all the project properties to the specified entry\r
119          */\r
120         bool AddAutoProps(const CTGitPath& path);\r
121 \r
122         /**\r
123          * Returns the log message summary if the tGit:logsummaryregex property is\r
124          * set and there are actually some matches.\r
125          * Otherwise, an empty string is returned.\r
126          */\r
127         CString GetLogSummary(const CString& sMessage);\r
128 \r
129         /**\r
130          * Returns the path from which the properties were read.\r
131          */\r
132         CTGitPath GetPropsPath() {return propsPath;}\r
133 public:\r
134         /** The label to show in the commit dialog where the issue number/bug id\r
135          * is entered. Example: "Bug-ID: " or "Issue-No.:". Default is "Bug-ID :" */\r
136         CString         sLabel;\r
137 \r
138         /** The message string to add below the log message the user entered.\r
139          * It must contain the string "%BUGID%" which gets replaced by the client \r
140          * with the issue number / bug id the user entered. */\r
141         CString         sMessage;\r
142 \r
143         /** If this is set, then the bug-id / issue number must be a number, no text */\r
144         BOOL            bNumber;\r
145 \r
146         /** replaces bNumer: a regular expression string to check the validity of\r
147           * the entered bug ID. */\r
148         CString         sCheckRe;\r
149         \r
150         /** used to extract the bug ID from the string matched by sCheckRe */\r
151         CString         sBugIDRe;\r
152         \r
153         /** The url pointing to the issue tracker. If the url contains the string\r
154          * "%BUGID% the client has to replace it with the issue number / bug id\r
155          * the user entered. */\r
156         CString         sUrl;\r
157         \r
158         /** If set to TRUE, show a warning dialog if the user forgot to enter\r
159          * an issue number in the commit dialog. */\r
160         BOOL            bWarnIfNoIssue;\r
161 \r
162         /** If set to FALSE, then the bug tracking entry is inserted at the top of the\r
163            log message instead of at the bottom. Default is TRUE */\r
164         BOOL            bAppend;\r
165 \r
166         /** The number of chars the width marker should be shown at. If the property\r
167          * is not set, then this value is 80 by default. */\r
168         int                     nLogWidthMarker;\r
169 \r
170         /** The template to use for log messages. */\r
171         CString         sLogTemplate;\r
172 \r
173         /** Minimum size a log message must have in chars */\r
174         int                     nMinLogSize;\r
175 \r
176         /** Minimum size a lock message must have in chars */\r
177         int                     nMinLockMsgSize;\r
178 \r
179         /** TRUE if the file list to be inserted in the commit dialog should be in\r
180          * English and not in the localized language. Default is TRUE */\r
181         BOOL            bFileListInEnglish;\r
182         \r
183         /** The language identifier this project uses for log messages. */\r
184         LONG            lProjectLanguage;\r
185 \r
186         /** holds user defined properties for files. */\r
187         CString         sFPPath;\r
188 \r
189         /** holds user defined properties for directories. */\r
190         CString         sDPPath;\r
191 \r
192         /** The url pointing to the web viewer. The string %REVISION% is replaced\r
193          *  with the revision number, "HEAD", or a date */\r
194         CString         sWebViewerRev;\r
195 \r
196         /** The url pointing to the web viewer. The string %REVISION% is replaced\r
197          *  with the revision number, "HEAD", or a date. The string %PATH% is replaced\r
198          *  with the path relative to the repository root, e.g. "/trunk/src/file" */\r
199         CString         sWebViewerPathRev;\r
200 \r
201         /**\r
202          * The regex string to extract a summary from a log message. The summary\r
203          * is the first matching regex group.\r
204          */\r
205         CString         sLogSummaryRe;\r
206 private:\r
207         CString         sAutoProps;\r
208         CTGitPath       propsPath;\r
209 #ifdef DEBUG\r
210         friend class PropTest;\r
211 #endif\r
212 };\r