Prevent the recycle bin from even getting monitored
[TortoiseGit.git] / src / TortoiseProc / ProjectProperties.h
blobb7ae43ba47c582d1647a74f5f39a77c596508181
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
20 #include <iostream>
21 #include <string>
22 #include <set>
23 #include "TGitPath.h"
24 using namespace std;
26 #define BUGTRAQPROPNAME_LABEL _T("bugtraq.label")
27 #define BUGTRAQPROPNAME_MESSAGE _T("bugtraq.message")
28 #define BUGTRAQPROPNAME_NUMBER _T("bugtraq.number")
29 #define BUGTRAQPROPNAME_LOGREGEX _T("bugtraq.logregex")
30 #define BUGTRAQPROPNAME_URL _T("bugtraq.url")
31 #define BUGTRAQPROPNAME_WARNIFNOISSUE _T("bugtraq.warnifnoissue")
32 #define BUGTRAQPROPNAME_APPEND _T("bugtraq.append")
34 #define PROJECTPROPNAME_LOGTEMPLATE _T("tsvn.logtemplate")
35 #define PROJECTPROPNAME_LOGWIDTHLINE _T("tsvn.logwidthmarker")
36 #define PROJECTPROPNAME_LOGMINSIZE _T("tsvn.logminsize")
37 #define PROJECTPROPNAME_LOCKMSGMINSIZE _T("tsvn.lockmsgminsize")
38 #define PROJECTPROPNAME_LOGFILELISTLANG _T("tsvn.logfilelistenglish")
39 #define PROJECTPROPNAME_LOGSUMMARY _T("tsvn.logsummary")
40 #define PROJECTPROPNAME_PROJECTLANGUAGE _T("tsvn.projectlanguage")
41 #define PROJECTPROPNAME_USERFILEPROPERTY _T("tsvn.userfileproperties")
42 #define PROJECTPROPNAME_USERDIRPROPERTY _T("tsvn.userdirproperties")
43 #define PROJECTPROPNAME_AUTOPROPS _T("tsvn.autoprops")
45 #define PROJECTPROPNAME_WEBVIEWER_REV _T("webviewer.revision")
46 #define PROJECTPROPNAME_WEBVIEWER_PATHREV _T("webviewer.pathrevision")
48 class CTSVNPathList;
49 struct svn_config_t;
51 /**
52 * \ingroup TortoiseProc
53 * Provides methods for retrieving information about bug/issue trackers
54 * associated with a Subversion repository/working copy and other project
55 * related properties.
57 class ProjectProperties
59 public:
60 ProjectProperties(void);
61 ~ProjectProperties(void);
63 /**
64 * Reads the properties from a path. If the path is a file
65 * then the properties are read from the parent folder of that file.
66 * \param path path to a file or a folder
68 BOOL ReadProps(CTGitPath path);
69 static BOOL GetStringProps(CString &prop,TCHAR *key,bool bRemoveCR=true);
70 static BOOL GetBOOLProps(BOOL &b, TCHAR*key);
71 /**
72 * Reads the properties from all paths found in a path list.
73 * This method calls ReadProps() for each path .
74 * \param list of paths
76 BOOL ReadPropsPathList(const CTGitPathList& pathList);
78 /**
79 * Searches for the BugID inside a log message. If one is found,
80 * the method returns TRUE. The rich edit control is used to set
81 * the CFE_LINK effect on the BugID's.
82 * \param msg the log message
83 * \param pWnd Pointer to a rich edit control
85 BOOL FindBugID(const CString& msg, CWnd * pWnd);
87 CString FindBugID(const CString& msg);
88 std::set<CString> FindBugIDs(const CString& msg);
89 /**
90 * Searches for the BugID inside a log message. If one is found,
91 * that BugID is returned. If none is found, an empty string is returned.
92 * The \c msg is trimmed off the BugID.
94 CString GetBugIDFromLog(CString& msg);
96 /**
97 * Checks if the bug ID is valid. If bugtraq:number is 'true', then the
98 * functions checks if the bug ID doesn't contain any non-number chars in it.
100 BOOL CheckBugID(const CString& sID);
103 * Checks if the log message \c sMessage contains a bug ID. This is done by
104 * using the bugtraq:checkre property.
106 BOOL HasBugID(const CString& sMessage);
109 * Returns the URL pointing to the Issue in the issue tracker. The URL is
110 * created from the bugtraq:url property and the BugID found in the log message.
111 * \param msg the BugID extracted from the log message
113 CString GetBugIDUrl(const CString& sBugID);
116 * Inserts the tGit:autoprops into the Subversion config section.
117 * Call this before an import or an add operation.
119 //void InsertAutoProps(git_config_t *cfg);
122 * Adds all the project properties to the specified entry
124 bool AddAutoProps(const CTGitPath& path);
127 * Returns the log message summary if the tGit:logsummaryregex property is
128 * set and there are actually some matches.
129 * Otherwise, an empty string is returned.
131 CString GetLogSummary(const CString& sMessage);
134 * Transform the log message using \ref GetLogSummary and post-process it
135 * to be suitable for 1-line controls.
137 CString MakeShortMessage(const CString& message);
140 * Returns the path from which the properties were read.
142 CTGitPath GetPropsPath() {return propsPath;}
143 public:
144 /** The label to show in the commit dialog where the issue number/bug id
145 * is entered. Example: "Bug-ID: " or "Issue-No.:". Default is "Bug-ID :" */
146 CString sLabel;
148 /** The message string to add below the log message the user entered.
149 * It must contain the string "%BUGID%" which gets replaced by the client
150 * with the issue number / bug id the user entered. */
151 CString sMessage;
153 /** If this is set, then the bug-id / issue number must be a number, no text */
154 BOOL bNumber;
156 /** replaces bNumer: a regular expression string to check the validity of
157 * the entered bug ID. */
158 CString sCheckRe;
160 /** used to extract the bug ID from the string matched by sCheckRe */
161 CString sBugIDRe;
163 /** The url pointing to the issue tracker. If the url contains the string
164 * "%BUGID% the client has to replace it with the issue number / bug id
165 * the user entered. */
166 CString sUrl;
168 /** If set to TRUE, show a warning dialog if the user forgot to enter
169 * an issue number in the commit dialog. */
170 BOOL bWarnIfNoIssue;
172 /** If set to FALSE, then the bug tracking entry is inserted at the top of the
173 log message instead of at the bottom. Default is TRUE */
174 BOOL bAppend;
176 /** the COM uuid of the bugtraq provider which implements the IBugTraqProvider
177 interface. */
178 CString sProviderUuid;
180 /** the parameters passed to the COM bugtraq provider which implements the
181 IBugTraqProvider interface */
182 CString sProviderParams;
184 /** The number of chars the width marker should be shown at. If the property
185 * is not set, then this value is 80 by default. */
186 int nLogWidthMarker;
188 /** The template to use for log messages. */
189 CString sLogTemplate;
191 /** Minimum size a log message must have in chars */
192 int nMinLogSize;
194 /** Minimum size a lock message must have in chars */
195 int nMinLockMsgSize;
197 /** TRUE if the file list to be inserted in the commit dialog should be in
198 * English and not in the localized language. Default is TRUE */
199 BOOL bFileListInEnglish;
201 /** The language identifier this project uses for log messages. */
202 LONG lProjectLanguage;
204 /** holds user defined properties for files. */
205 CString sFPPath;
207 /** holds user defined properties for directories. */
208 CString sDPPath;
210 /** The url pointing to the web viewer. The string %REVISION% is replaced
211 * with the revision number, "HEAD", or a date */
212 CString sWebViewerRev;
214 /** The url pointing to the web viewer. The string %REVISION% is replaced
215 * with the revision number, "HEAD", or a date. The string %PATH% is replaced
216 * with the path relative to the repository root, e.g. "/trunk/src/file" */
217 CString sWebViewerPathRev;
220 * The regex string to extract a summary from a log message. The summary
221 * is the first matching regex group.
223 CString sLogSummaryRe;
226 * A regex string to extract revisions from a log message.
228 CString sLogRevRegex;
229 private:
230 CString sAutoProps;
231 CTGitPath propsPath;
232 #ifdef DEBUG
233 friend class PropTest;
234 #endif