1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\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
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
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
22 #include "TGitPath.h"
\r
23 using namespace std;
\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
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
44 #define PROJECTPROPNAME_WEBVIEWER_REV _T("webviewer:revision")
\r
45 #define PROJECTPROPNAME_WEBVIEWER_PATHREV _T("webviewer:pathrevision")
\r
47 class CTSVNPathList;
\r
48 struct svn_config_t;
\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
56 class ProjectProperties
\r
59 ProjectProperties(void);
\r
60 ~ProjectProperties(void);
\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
67 BOOL ReadProps(CTGitPath path);
\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
73 BOOL ReadPropsPathList(const CTGitPathList& pathList);
\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
82 BOOL FindBugID(const CString& msg, CWnd * pWnd);
\r
84 CString FindBugID(const CString& msg);
\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
90 CString GetBugIDFromLog(CString& msg);
\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
96 BOOL CheckBugID(const CString& sID);
\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
102 BOOL HasBugID(const CString& sMessage);
\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
109 CString GetBugIDUrl(const CString& sBugID);
\r
112 * Inserts the tGit:autoprops into the Subversion config section.
\r
113 * Call this before an import or an add operation.
\r
115 //void InsertAutoProps(git_config_t *cfg);
\r
118 * Adds all the project properties to the specified entry
\r
120 bool AddAutoProps(const CTGitPath& path);
\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
127 CString GetLogSummary(const CString& sMessage);
\r
130 * Returns the path from which the properties were read.
\r
132 CTGitPath GetPropsPath() {return propsPath;}
\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
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
143 /** If this is set, then the bug-id / issue number must be a number, no text */
\r
146 /** replaces bNumer: a regular expression string to check the validity of
\r
147 * the entered bug ID. */
\r
150 /** used to extract the bug ID from the string matched by sCheckRe */
\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
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
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
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
170 /** The template to use for log messages. */
\r
171 CString sLogTemplate;
\r
173 /** Minimum size a log message must have in chars */
\r
176 /** Minimum size a lock message must have in chars */
\r
177 int nMinLockMsgSize;
\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
183 /** The language identifier this project uses for log messages. */
\r
184 LONG lProjectLanguage;
\r
186 /** holds user defined properties for files. */
\r
189 /** holds user defined properties for directories. */
\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
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
202 * The regex string to extract a summary from a log message. The summary
\r
203 * is the first matching regex group.
\r
205 CString sLogSummaryRe;
\r
207 CString sAutoProps;
\r
208 CTGitPath propsPath;
\r
210 friend class PropTest;
\r