Exemplo n.º 1
0
        public static void Push(GitRepository repo)
        {
            var dlg = new PushDialog(repo);

            try {
                if (MessageService.RunCustomDialog(dlg) != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                string remote = dlg.SelectedRemote;
                string branch = dlg.SelectedRemoteBranch;

                IProgressMonitor monitor = VersionControlService.GetProgressMonitor(GettextCatalog.GetString("Pushing changes..."));
                System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        repo.Push(monitor, remote, branch);
                    } catch (Exception ex) {
                        monitor.ReportError(ex.Message, ex);
                    } finally {
                        monitor.Dispose();
                    }
                });
            } finally {
                dlg.Destroy();
            }
        }
Exemplo n.º 2
0
		public static void Push (GitRepository repo)
		{
			var dlg = new PushDialog (repo);
			try {
				if (MessageService.RunCustomDialog (dlg) != (int) Gtk.ResponseType.Ok)
					return;

				string remote = dlg.SelectedRemote;
				string branch = dlg.SelectedRemoteBranch ?? repo.GetCurrentBranch ();

				ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."), VersionControlOperationType.Push);
				ThreadPool.QueueUserWorkItem (delegate {
					try {
						repo.Push (monitor, remote, branch);
					} catch (Exception ex) {
						monitor.ReportError (ex.Message, ex);
					} finally {
						monitor.Dispose ();
					}
				});
			} finally {
				dlg.Destroy ();
				dlg.Dispose ();
			}
		}
Exemplo n.º 3
0
		public static void Push (GitRepository repo)
		{
			PushDialog dlg = new PushDialog (repo);
			if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
				string remote = dlg.SelectedRemote;
				string branch = dlg.SelectedRemoteBranch;
				dlg.Destroy ();
				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("Version Control", "md-version-control", false, true);
				System.Threading.ThreadPool.QueueUserWorkItem (delegate {
					try {
						repo.Push (monitor, remote, branch);
					} catch (Exception ex) {
						monitor.ReportError (ex.Message, ex);
					} finally {
						monitor.Dispose ();
					}
				});
			} else
				dlg.Destroy ();
		}
Exemplo n.º 4
0
		public static void Push (GitRepository repo)
		{
			PushDialog dlg = new PushDialog (repo);
			if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
				string remote = dlg.SelectedRemote;
				string branch = dlg.SelectedRemoteBranch;
				dlg.Destroy ();
				IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."));
				System.Threading.ThreadPool.QueueUserWorkItem (delegate {
					try {
						repo.Push (monitor, remote, branch);
					} catch (Exception ex) {
						monitor.ReportError (ex.Message, ex);
					} finally {
						monitor.Dispose ();
					}
				});
			} else
				dlg.Destroy ();
		}
Exemplo n.º 5
0
        public static void Push(GitRepository repo)
        {
            bool hasCommits = false;

            using (var RootRepository = new LibGit2Sharp.Repository(repo.RootPath))
                hasCommits = RootRepository.Commits.Any();
            if (!hasCommits)
            {
                MessageService.ShowMessage(
                    GettextCatalog.GetString("There are no changes to push."),
                    GettextCatalog.GetString("Create an initial commit first.")
                    );
                return;
            }

            var dlg = new PushDialog(repo);

            try {
                if (MessageService.RunCustomDialog(dlg) != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                string remote = dlg.SelectedRemote;
                string branch = dlg.SelectedRemoteBranch ?? repo.GetCurrentBranch();

                ProgressMonitor monitor = VersionControlService.GetProgressMonitor(GettextCatalog.GetString("Pushing changes..."), VersionControlOperationType.Push);
                Task.Run(async() => {
                    try {
                        await repo.PushAsync(monitor, remote, branch);
                    } catch (Exception ex) {
                        monitor.ReportError(ex.Message, ex);
                    } finally {
                        monitor.Dispose();
                    }
                });
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }