Exemple #1
0
        public Result <string> saveSVNLog(SVNLog log)
        {
            Result <string> result = new Result <string>();

            result.status = 1;
            result.msg    = Plugin.lang.getText("OperateSucess");
            result.data   = "";

            RequestType type = getRequestType();
            string      name = "index.php?m=svn&f=ajaxSaveLog&t=json";

            if (type == RequestType.PATH_INFO)
            {
                name = "svn-ajaxSaveLog.json";
            }


            string updateUrl = getAPIUrl(name);

            string data = "repoUrl=" + Uri.EscapeDataString(log.repoUrl) + "&repoRoot=" + Uri.EscapeDataString(log.repoRoot)
                          + "&message=" + Uri.EscapeDataString(log.message) + "&revision=" + log.revision;

            foreach (string path in log.files)
            {
                data += "&files[]=" + Uri.EscapeDataString(path);
            }

            string body = HttpClient.post(updateUrl, Encoding.UTF8.GetBytes(data));

            //TODO
            return(result);
        }
Exemple #2
0
        public string OnCommitFinished(
            IntPtr hParentWnd,
            string commonRoot,
            string[] pathList,
            string logMessage,
            int revision)
        {
            SVNLog log = new SVNLog();

            log.files    = pathList;
            log.repoRoot = repoRoot;
            log.repoUrl  = repoUrl;
            log.revision = Convert.ToString(revision);
            log.message  = logMessage;
            bool isMatched = false;

            string          bugReg  = "(Fix\\s+)?[Bb]ug#(\\d+)";
            MatchCollection matches = Regex.Matches(logMessage, bugReg);
            string          resText = "";

            foreach (Match match in matches)
            {
                string operate = match.Groups[1].Value;
                string bugId   = match.Groups[2].Value;

                //任务完成
                if (match.Groups[1].Success)
                {
                    resText += "Bug#" + bugId + "已解决\r\n";
                    zenTaoManage.updateBug(bugId, "");

                    isMatched = true;
                }
            }

            string taskReg = "(Finish\\s+)?[Tt]ask#(\\d+).*?,\\s*[Cc]ost:(\\d+)\\s*left:(\\d+)";

            matches = Regex.Matches(logMessage, taskReg);
            foreach (Match match in matches)
            {
                string operate  = match.Groups[1].Value;
                string taskId   = match.Groups[2].Value;
                string consumed = match.Groups[3].Value;
                string left     = match.Groups[4].Value;

                TaskInfo task = issForm.queryTaskById(taskId);

                zenTaoManage.updateTask(task);
                isMatched = true;
                if (match.Groups[1].Success)
                {
                    resText += "Task#" + taskId + "," + taskId + ", " + consumed + ", " + left + "已完成\r\n";
                }
            }

            if (isMatched)
            {
                zenTaoManage.saveSVNLog(log);
            }


            return(resText);
        }