Пример #1
0
        /// <summary>
        /// Commit the requested changes for any related issues
        /// </summary>
        public string CommitChanges(IntPtr hParentWnd, string originalMessage, int revision, string[] files)
        {
            if (Canceled)
            {
                return(originalMessage);
            }
            if (_service == null || _issues == null)
            {
                throw new UnauthorizedAccessException();
            }

            _issues.SyncComments(originalMessage);

            StringBuilder sbResponse = new StringBuilder();

            sbResponse.AppendFormat("{0}", originalMessage);

            if (GetAppSetting("addRevisionComment") == "false")
            {
                revision = -1;
            }
            if (GetAppSetting("addFilesComment") == "false")
            {
                files = new string[0];
            }

            foreach (Exception e in _issues.CommitChanges(revision, files))
            {
                sbResponse.AppendLine();
                sbResponse.AppendFormat("ERROR: {0}", e.Message);
            }

            return(sbResponse.ToString());
        }
Пример #2
0
        /// <summary>
        /// Commit the requested changes for any related issues
        /// </summary>
        public string CommitChanges(IntPtr hParentWnd, string rootUrl, string originalMessage, int revision, string commonRoot,
                                    string[] files)
        {
            if (Canceled)
            {
                return(originalMessage);
            }
            if (_service == null || _issues == null)
            {
                throw new UnauthorizedAccessException();
            }

            _issues.SyncComments(originalMessage);

            var sbResponse = new StringBuilder();

            sbResponse.AppendFormat("{0}", originalMessage);

            if (GetSetting("jira:addRevisionComment", commonRoot) == "false")
            {
                revision = -1;
            }
            if (GetSetting("jira:addFilesComment", commonRoot) == "false")
            {
                files = new string[0];
            }
            else
            {
                //replace the commonRoot to rootUrl. This will also let us know of the branch/trunk...
                for (var i = 0; i < files.Length; i++)
                {
                    files[i] = files[i].Replace(commonRoot.Replace('\\', '/'), rootUrl);
                }
            }

            foreach (Exception e in _issues.CommitChanges(revision, files))
            {
                sbResponse.AppendLine();
                sbResponse.AppendFormat("ERROR: {0}", e.Message);
            }

            return(sbResponse.ToString());
        }