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