Ejemplo n.º 1
0
        /// <summary>
        /// Make some checks and create a Client
        /// </summary>
        /// <returns>null if could not create a GitClient</returns>
        private GitClient getGitClient(string hostname, string projectname)
        {
            GitClientFactory factory = getGitClientFactory(_settings.LocalGitFolder);

            if (factory == null)
            {
                return(null);
            }

            GitClient client;

            try
            {
                client = factory.GetClient(hostname, projectname);
            }
            catch (ArgumentException ex)
            {
                ExceptionHandlers.Handle(ex, String.Format("Cannot create GitClient"));
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            Debug.Assert(client != null);
            return(client);
        }
Ejemplo n.º 2
0
        public void Handle(Snapshot snapshot)
        {
            using (GitClientFactory factory = new GitClientFactory(snapshot.TempFolder, null))
            {
                IGitRepository gitRepository = factory.GetClient(snapshot.Host, snapshot.Project);

                DiffToolInfoProcessor processor = new DiffToolInfoProcessor(gitRepository);

                DiffToolInfo diffToolInfo;
                if (!processor.Process(_originalDiffToolInfo, snapshot.Refs, out diffToolInfo))
                {
                    return;
                }

                RefToLineMatcher matcher  = new RefToLineMatcher(gitRepository);
                DiffPosition     position = matcher.Match(snapshot.Refs, diffToolInfo);

                NewDiscussionForm form = new NewDiscussionForm(snapshot, diffToolInfo, position, gitRepository);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    submitDiscussion(snapshot, diffToolInfo, position, form.Body, form.IncludeContext);
                }
            }
        }