Ejemplo n.º 1
0
        /// <summary>
        /// Create new branch for repository
        /// </summary>
        /// <param name="project">VBProject</param>
        public void CreateBranch(VBProject project)
        {
            try
            {
                EnableFileSystemWatcher = false;

                var repo = GetVBProjectRepository(project);
                using (var gitCommand = new CommandCreateBranch(project, repo))
                {
                    gitCommand.Execute();
                }
            }
            finally
            {
                EnableFileSystemWatcher = true;
            }
        }
Ejemplo n.º 2
0
        public CreateBranchForm(CommandCreateBranch gitCommand)
        {
            InitializeComponent();

            _gitCommand = gitCommand;
            _options    = new CreateBranchOptions();

            GroupName.Text   = VBAGitUI.CreateBranchForm_Name;
            LabelBranch.Text = VBAGitUI.CreateBranchForm_Branch;

            GroupBaseOn.Text  = VBAGitUI.CreateBranchForm_BaseOn;
            BaseOnHead.Text   = string.Format(VBAGitUI.CreateBranchForm_Head, _gitCommand.CurrentBranch);
            BaseOnBranch.Text = VBAGitUI.CreateBranchForm_Branch;
            BaseOnTag.Text    = VBAGitUI.CreateBranchForm_Tag;
            BaseOnCommit.Text = VBAGitUI.CreateBranchForm_Commit;

            GroupOptions.Text = VBAGitUI.CreateBranchForm_Options;
            TrackOption.Text  = VBAGitUI.CreateBranchForm_Track;
            ForceOption.Text  = VBAGitUI.CreateBranchForm_Force;
            SwitchOption.Text = VBAGitUI.CreateBranchForm_Switch;

            GroupDescription.Text = VBAGitUI.CreateBranchForm_Description;

            Ok.Text     = VBAGitUI.OK;
            Cancel.Text = VBAGitUI.Cancel;

            // populate combobox with branches
            var branches = _gitCommand.Provider.Branches;

            Branches.Items.AddRange(branches.Where(b => !b.IsRemote).Select(b => b.FriendlyName).ToArray());
            Branches.SelectedIndex = Branches.Items.Count > 0 ? 0 : -1;

            // populate combobox with tags
            Tags.Items.AddRange(_gitCommand.Provider.Tags.Select(t => t.FriendlyName).ToArray());

            Application.Idle += Application_Idle;
        }