Exemplo n.º 1
0
        async private Task submitDiscussionAsync(MergeRequestKey mrk,
                                                 MatchInfo matchInfo, Core.Matching.DiffRefs diffRefs, DiffPosition position, string body, bool includeContext)
        {
            if (body.Length == 0)
            {
                MessageBox.Show("Discussion text cannot be empty", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                return;
            }

            NewDiscussionParameters parameters = new NewDiscussionParameters(
                body, includeContext ? createPositionParameters(position) : new PositionParameters?());

            IDiscussionCreator creator = _shortcuts.GetDiscussionCreator(mrk, _currentUser);

            try
            {
                await creator.CreateDiscussionAsync(parameters, true);
            }
            catch (DiscussionCreatorException ex)
            {
                Trace.TraceInformation(
                    "Additional information about exception:\n" +
                    "Position: {0}\n" +
                    "Include context: {1}\n" +
                    "Snapshot refs: {2}\n" +
                    "MatchInfo: {3}\n" +
                    "Body:\n{4}",
                    position.ToString(),
                    includeContext.ToString(),
                    diffRefs.ToString(),
                    matchInfo.ToString(),
                    body);

                if (!ex.Handled)
                {
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Throws GitOperationException in case of problems with git.
        /// </summary>
        public bool Process(DiffToolInfo source, Core.Matching.DiffRefs refs, out DiffToolInfo dest)
        {
            string currentName;
            string anotherName;
            bool   moved;
            bool   renamed;

            try
            {
                renamed = checkForRenamedFile(refs, source, out currentName, out anotherName, out moved);
            }
            catch (GitOperationException)
            {
                throw; // fatal error
            }

            if (renamed)
            {
                Trace.TraceInformation("Detected file {0}. Git repository path: {1}. DiffRefs: {2}\nDiffToolInfo: {3}",
                                       (moved ? "move" : "rename"), _gitRepository.Path, refs.ToString(), source.ToString());
            }

            dest = source;
            return(!renamed || handleFileRename(source, currentName, anotherName, moved, out dest));
        }