/// <summary> /// Push changes to remote repository /// </summary> /// <param name="project">VBProject</param> public void Push(VBProject project) { try { EnableFileSystemWatcher = false; var repo = GetVBProjectRepository(project); using (var gitCommand = new CommandPush(project, repo)) { gitCommand.Execute(); } } finally { EnableFileSystemWatcher = true; } }
public PushForm(CommandPush gitCommand) { InitializeComponent(); _gitCommand = gitCommand; GroupRef.Text = VBAGitUI.PushForm_GroupRef; PushAllBranches.Text = VBAGitUI.PushForm_PushAllBranches; LabelLocal.Text = VBAGitUI.PushForm_LabelLocal; LabelRemote.Text = VBAGitUI.PushForm_LabelRemote; GroupDestination.Text = VBAGitUI.PushForm_GroupDestinantion; DestinationRemote.Text = VBAGitUI.PushForm_DestinationRemote; DestinationUrl.Text = VBAGitUI.PushForm_DestinationUrl; Manage.Text = VBAGitUI.PushForm_Manage; GroupOptions.Text = VBAGitUI.PushForm_GroupOptions; LabelForce.Text = VBAGitUI.PushForm_LableForce; OptionIncludeTags.Text = VBAGitUI.PushForm_OptionIncludeTags; OptionKnownChanges.Text = VBAGitUI.PushForm_OptionKnownChanges; OptionUnknownChanges.Text = VBAGitUI.PushForm_OptionUnknownChanges; OptionSetUpstream.Text = VBAGitUI.PushForm_OptionSetUpstream; Ok.Text = VBAGitUI.OK; Cancel.Text = VBAGitUI.Cancel; var branches = _gitCommand.Provider.Branches.Where(b => !b.IsRemote); LocalBranches.Items.AddRange(branches.Select(b => new ComboBoxItem(b.FriendlyName, b)).ToArray()); LocalBranches.SelectedItem = LocalBranches.Items.Cast <ComboBoxItem>().FirstOrDefault(i => i.Name == _gitCommand.Repository.Head?.FriendlyName); var remotes = _gitCommand.Repository.Network.Remotes; Remotes.Items.AddRange(remotes.Select(r => r.Name).ToArray()); Remotes.SelectedIndex = Remotes.Items.Count > 0 ? 0 : -1; Application.Idle += Application_Idle; }