Esempio n. 1
0
        protected void OnButtonBranchClicked(object sender, System.EventArgs e)
        {
            Stash s = GetSelected();

            if (s != null)
            {
                var dlg = new EditBranchDialog(repository, null, true);
                try {
                    if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                    {
                        ObjectId  commit = repository.RootRepository.Resolve(s.CommitId);
                        var       rw     = new RevWalk(repository.RootRepository);
                        RevCommit c      = rw.ParseCommit(commit);
                        RevCommit old    = c.GetParent(0);
                        rw.ParseHeaders(old);
                        repository.CreateBranchFromCommit(dlg.BranchName, old);
                        GitService.SwitchToBranch(repository, dlg.BranchName);
                        ApplyStashAndRemove(s);
                    }
                } finally {
                    dlg.Destroy();
                }
                Respond(ResponseType.Ok);
            }
        }
Esempio n. 2
0
        protected virtual void OnButtonEditBranchClicked(object sender, System.EventArgs e)
        {
            TreeIter it;

            if (!listBranches.Selection.GetSelected(out it))
            {
                return;
            }
            Branch b   = (Branch)storeBranches.GetValue(it, 0);
            var    dlg = new EditBranchDialog(repo, b, false);

            try
            {
                if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                {
                    if (dlg.BranchName != b.Name)
                    {
                        try
                        {
                            repo.RenameBranch(b.Name, dlg.BranchName);
                        }
                        catch (Exception ex)
                        {
                            MessageService.ShowException(ex, GettextCatalog.GetString("The branch could not be renamed"));
                        }
                    }
                    repo.SetBranchTrackSource(dlg.BranchName, dlg.TrackSource);
                    FillBranches();
                }
            }
            finally
            {
                dlg.Destroy();
            }
        }
Esempio n. 3
0
        protected virtual void OnButtonEditBranchClicked(object sender, EventArgs e)
        {
            TreeIter it;

            if (!listBranches.Selection.GetSelected(out it))
            {
                return;
            }
            var b   = (Branch)storeBranches.GetValue(it, 0);
            var dlg = new EditBranchDialog(repo, b.FriendlyName, b.IsTracking ? b.TrackedBranch.FriendlyName : String.Empty);

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                {
                    if (dlg.BranchName != b.FriendlyName)
                    {
                        try {
                            repo.RenameBranch(b.FriendlyName, dlg.BranchName);
                        } catch (Exception ex) {
                            MessageService.ShowError(GettextCatalog.GetString("The branch could not be renamed"), ex);
                        }
                    }
                    repo.SetBranchTrackRef(dlg.BranchName, dlg.TrackSource, dlg.TrackRef);
                    FillBranches();
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
Esempio n. 4
0
        protected virtual void OnButtonTrackRemoteClicked(object sender, EventArgs e)
        {
            TreeIter it;

            if (!treeRemotes.Selection.GetSelected(out it))
            {
                return;
            }
            string branchName = (string)storeRemotes.GetValue(it, 3);

            if (branchName == null)
            {
                return;
            }

            storeRemotes.IterParent(out it, it);
            var remote = (Remote)storeRemotes.GetValue(it, 0);

            var dlg = new EditBranchDialog(repo, branchName, remote.Name + "/" + branchName);

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                {
                    repo.CreateBranch(dlg.BranchName, dlg.TrackSource, dlg.TrackRef);
                    FillBranches();
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
Esempio n. 5
0
        protected async void OnButtonBranchClicked(object sender, System.EventArgs e)
        {
            Stash s          = GetSelected();
            int   stashIndex = GetSelectedIndex();

            if (s != null)
            {
                var dlg = new EditBranchDialog(repository);
                try {
                    if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                    {
                        await repository.CreateBranchFromCommitAsync(dlg.BranchName, s.Base);

                        if (await GitService.SwitchToBranchAsync(repository, dlg.BranchName))
                        {
                            await ApplyStashAndRemove(stashIndex);
                        }
                    }
                } finally {
                    dlg.Destroy();
                    dlg.Dispose();
                }
                Respond(ResponseType.Ok);
            }
        }
Esempio n. 6
0
        protected virtual void OnButtonAddBranchClicked(object sender, EventArgs e)
        {
            var dlg = new EditBranchDialog(repo, null, true);

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                {
                    repo.CreateBranch(dlg.BranchName, dlg.TrackSource);
                    FillBranches();
                }
            } finally {
                dlg.Destroy();
            }
        }
Esempio n. 7
0
        protected virtual void OnButtonAddBranchClicked(object sender, EventArgs e)
        {
            var dlg = new EditBranchDialog(repo);

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                {
                    repo.CreateBranch(dlg.BranchName, dlg.TrackSource, dlg.TrackRef);
                    FillBranches();
                }
            } catch (Exception ex) {
                MessageService.ShowError(GettextCatalog.GetString("The branch could not be created"), ex);
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }
		protected virtual void OnButtonTrackRemoteClicked (object sender, System.EventArgs e)
		{
			TreeIter it;
			if (!treeRemotes.Selection.GetSelected (out it))
				return;
			string branchName = (string) storeRemotes.GetValue (it, 3);
			if (branchName == null)
				return;
			
			storeRemotes.IterParent (out it, it);
			RemoteSource remote = (RemoteSource) storeRemotes.GetValue (it, 0);
			
			Branch b = new Branch ();
			b.Name = branchName;
			b.Tracking = remote.Name + "/" + branchName;
			
			var dlg = new EditBranchDialog (repo, b, true);
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
					repo.CreateBranch (dlg.BranchName, dlg.TrackSource);
					FillBranches ();
				}
			} finally {
				dlg.Destroy ();
			}
		}
		protected virtual void OnButtonEditBranchClicked (object sender, System.EventArgs e)
		{
			TreeIter it;
			if (!listBranches.Selection.GetSelected (out it))
				return;
			Branch b = (Branch) storeBranches.GetValue (it, 0);
			var dlg = new EditBranchDialog (repo, b, false);
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
					if (dlg.BranchName != b.Name) {
						try {
							repo.RenameBranch (b.Name, dlg.BranchName);
						} catch (Exception ex) {
							MessageService.ShowException (ex, GettextCatalog.GetString ("The branch could not be renamed"));
						}
					}
					repo.SetBranchTrackSource (dlg.BranchName, dlg.TrackSource);
					FillBranches ();
				}
			} finally {
				dlg.Destroy ();
			}
		}
Esempio n. 10
0
		protected virtual void OnButtonAddBranchClicked (object sender, System.EventArgs e)
		{
			var dlg = new EditBranchDialog (repo, null, true);
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
					repo.CreateBranch (dlg.BranchName, dlg.TrackSource);
					FillBranches ();
				}
			} finally {
				dlg.Destroy ();
			}
		}
Esempio n. 11
0
		protected async void OnButtonBranchClicked (object sender, System.EventArgs e)
		{
			Stash s = GetSelected ();
			int stashIndex = GetSelectedIndex ();
			if (s != null) {
				var dlg = new EditBranchDialog (repository);
				try {
					if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
						repository.CreateBranchFromCommit (dlg.BranchName, s.Base);
						if (await GitService.SwitchToBranch (repository, dlg.BranchName))
							await ApplyStashAndRemove (stashIndex);
					}
				} finally {
					dlg.Destroy ();
					dlg.Dispose ();
				}
				Respond (ResponseType.Ok);
			}
		}
		protected virtual void OnButtonEditBranchClicked (object sender, EventArgs e)
		{
			TreeIter it;
			if (!listBranches.Selection.GetSelected (out it))
				return;
			var b = (Branch) storeBranches.GetValue (it, 0);
			var dlg = new EditBranchDialog (repo, b.FriendlyName, b.IsTracking ? b.TrackedBranch.FriendlyName : String.Empty);
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
					if (dlg.BranchName != b.FriendlyName) {
						try {
							repo.RenameBranch (b.FriendlyName, dlg.BranchName);
						} catch (Exception ex) {
							MessageService.ShowError (GettextCatalog.GetString ("The branch could not be renamed"), ex);
						}
					}
					repo.SetBranchTrackRef (dlg.BranchName, dlg.TrackSource, dlg.TrackRef);
					FillBranches ();
				}
			} finally {
				dlg.Destroy ();
				dlg.Dispose ();
			}
		}
		protected virtual void OnButtonEditBranchClicked (object sender, System.EventArgs e)
		{
			TreeIter it;
			if (!listBranches.Selection.GetSelected (out it))
				return;
			Branch b = (Branch) storeBranches.GetValue (it, 0);
			var dlg = new EditBranchDialog (repo, b, false);
			try {
				if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
					if (dlg.BranchName != b.Name)
						repo.RenameBranch (b.Name, dlg.BranchName);
					repo.SetBranchTrackSource (dlg.BranchName, dlg.TrackSource);
					FillBranches ();
				}
			} finally {
				dlg.Destroy ();
			}
		}
Esempio n. 14
0
		protected void OnButtonBranchClicked (object sender, System.EventArgs e)
		{
			Stash s = GetSelected ();
			if (s != null) {
				var dlg = new EditBranchDialog (repository, null, true);
				try {
					if (MessageService.RunCustomDialog (dlg) == (int) ResponseType.Ok) {
						ObjectId commit = repository.RootRepository.Resolve (s.CommitId);
						var rw = new RevWalk (repository.RootRepository);
						RevCommit c = rw.ParseCommit (commit);
						RevCommit old = c.GetParent (0);
						rw.ParseHeaders (old);
						repository.CreateBranchFromCommit (dlg.BranchName, old);
						GitService.SwitchToBranch (repository, dlg.BranchName);
						ApplyStashAndRemove (s);
					}
				} finally {
					dlg.Destroy ();
				}
				Respond (ResponseType.Ok);
			}
		}