OSDN Git Service

Add bugtraq to support commit dialog bug track.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / ProjectProperties.cpp
index 4510fdf..75d6687 100644 (file)
@@ -23,6 +23,7 @@
 //#include "GitProperties.h"\r
 #include "TGitPath.h"\r
 #include <regex>\r
 //#include "GitProperties.h"\r
 #include "TGitPath.h"\r
 #include <regex>\r
+#include "git.h"\r
 \r
 using namespace std;\r
 \r
 \r
 using namespace std;\r
 \r
@@ -56,8 +57,68 @@ BOOL ProjectProperties::ReadPropsPathList(const CTGitPathList& pathList)
        return FALSE;\r
 }\r
 \r
        return FALSE;\r
 }\r
 \r
+BOOL ProjectProperties::GetStringProps(CString &prop,TCHAR *key,bool bRemoveCR)\r
+{\r
+       CString cmd,output;\r
+       output.Empty();\r
+\r
+       cmd.Format(_T("git.exe config %s"),key);\r
+       int start = 0;\r
+       if(g_Git.Run(cmd,&output,CP_ACP))\r
+       {\r
+               return FALSE;\r
+       }\r
+       if(bRemoveCR)\r
+               prop = output.Tokenize(_T("\n"),start); \r
+       else\r
+               prop = output;\r
+\r
+       return TRUE;\r
+\r
+}\r
+\r
+BOOL ProjectProperties::GetBOOLProps(BOOL &b,TCHAR *key)\r
+{\r
+       CString str,low;\r
+       if(!GetStringProps(str,key))\r
+               return FALSE;\r
+\r
+       low=str.MakeLower();\r
+       if(low == _T("true"))\r
+               b=true;\r
+       else\r
+               b=false;\r
+\r
+       return true;\r
+\r
+}\r
 BOOL ProjectProperties::ReadProps(CTGitPath path)\r
 {\r
 BOOL ProjectProperties::ReadProps(CTGitPath path)\r
 {\r
+       CString sPropVal;\r
+\r
+       GetStringProps(this->sLabel,BUGTRAQPROPNAME_LABEL);\r
+       GetStringProps(this->sMessage,BUGTRAQPROPNAME_MESSAGE);\r
+\r
+       GetBOOLProps(this->bWarnIfNoIssue,BUGTRAQPROPNAME_WARNIFNOISSUE);\r
+       GetBOOLProps(this->bNumber,BUGTRAQPROPNAME_NUMBER);\r
+       GetBOOLProps(this->bAppend,BUGTRAQPROPNAME_APPEND);\r
+\r
+       GetStringProps(sPropVal,BUGTRAQPROPNAME_LOGREGEX,false);\r
+\r
+       sCheckRe = sPropVal;\r
+       if (sCheckRe.Find('\n')>=0)\r
+       {\r
+               sBugIDRe = sCheckRe.Mid(sCheckRe.Find('\n')).Trim();\r
+               sCheckRe = sCheckRe.Left(sCheckRe.Find('\n')).Trim();\r
+       }\r
+       if (!sCheckRe.IsEmpty())\r
+       {\r
+               sCheckRe = sCheckRe.Trim();\r
+       }\r
+       return TRUE;\r
+\r
+\r
+#if 0\r
        BOOL bFoundBugtraqLabel = FALSE;\r
        BOOL bFoundBugtraqMessage = FALSE;\r
        BOOL bFoundBugtraqNumber = FALSE;\r
        BOOL bFoundBugtraqLabel = FALSE;\r
        BOOL bFoundBugtraqMessage = FALSE;\r
        BOOL bFoundBugtraqNumber = FALSE;\r
@@ -80,7 +141,7 @@ BOOL ProjectProperties::ReadProps(CTGitPath path)
 \r
        if (!path.IsDirectory())\r
                path = path.GetContainingDirectory();\r
 \r
        if (!path.IsDirectory())\r
                path = path.GetContainingDirectory();\r
-#if 0          \r
+               \r
        for (;;)\r
        {\r
                GitProperties props(path, GitRev::REV_WC, false);\r
        for (;;)\r
        {\r
                GitProperties props(path, GitRev::REV_WC, false);\r