Exemplo n.º 1
0
 public FormAddFiles(GitUICommands aCommands, string addFile)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     Filter.Text = addFile ?? ".";
 }
 public FormCleanupRepository(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent(); Translate();
     PreviewOutput.ReadOnly = true;
     checkBoxPathFilter_CheckedChanged(null, null);
 }
Exemplo n.º 3
0
 public FormCommitCount(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     this.Loading.Image = global::GitUI.Properties.Resources.loadingpanel;
     Translate();
 }
Exemplo n.º 4
0
 public FormSubmodules(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     gitSubmoduleBindingSource.DataSource = modules;
 }
Exemplo n.º 5
0
 public FormDeleteBranch(GitUICommands aCommands, IEnumerable<string> defaultBranches)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     _defaultBranches = defaultBranches;
 }
 public FormSparseWorkingCopyViewModel([NotNull] GitUICommands gitcommands)
 {
     _gitcommands = gitcommands;
     if(gitcommands == null)
         throw new ArgumentNullException("gitcommands");
     _isSparseCheckoutEnabled = _isSparseCheckoutEnabledAsSaved = GetCurrentSparseEnabledState();
 }
Exemplo n.º 7
0
 public FormApplyPatch(GitUICommands aCommands)
     : base(true, aCommands)
 {
     InitializeComponent(); Translate();
     if (aCommands != null)
         EnableButtons();
 }
Exemplo n.º 8
0
        internal FormFileHistory(GitUICommands aCommands)
            : base(aCommands)
        {
            InitializeComponent();
            _asyncLoader = new AsyncLoader();
            // set tab page images
            {
                var imageList = new ImageList();
                tabControl1.ImageList = imageList;
                imageList.ColorDepth = ColorDepth.Depth8Bit;
                imageList.Images.Add(global::GitUI.Properties.Resources.IconViewFile);
                imageList.Images.Add(global::GitUI.Properties.Resources.IconDiff);
                imageList.Images.Add(global::GitUI.Properties.Resources.IconBlame);
                tabControl1.TabPages[0].ImageIndex = 0;
                tabControl1.TabPages[1].ImageIndex = 1;
                tabControl1.TabPages[2].ImageIndex = 2;
            }

            _filterBranchHelper = new FilterBranchHelper(toolStripBranchFilterComboBox, toolStripBranchFilterDropDownButton, FileChanges);
            _filterRevisionsHelper = new FilterRevisionsHelper(toolStripRevisionFilterTextBox, toolStripRevisionFilterDropDownButton, FileChanges, toolStripRevisionFilterLabel, ShowFirstParent, form: this);

            _formBrowseMenus = new FormBrowseMenus(FileHistoryContextMenu);
            _formBrowseMenus.ResetMenuCommandSets();
            _formBrowseMenus.AddMenuCommandSet(MainMenuItem.NavigateMenu, FileChanges.MenuCommands.GetNavigateMenuCommands());
            _formBrowseMenus.AddMenuCommandSet(MainMenuItem.ViewMenu, FileChanges.MenuCommands.GetViewMenuCommands());
            _formBrowseMenus.InsertAdditionalMainMenuItems(toolStripSeparator4);
        }
Exemplo n.º 9
0
        public FormDiff(GitUICommands aCommands, RevisionGrid revisionGrid, string baseCommitSha,
            string headCommitSha, string baseCommitDisplayStr, string headCommitDisplayStr) : base(aCommands)
        {
            RevisionGrid = revisionGrid;
            _baseCommitDisplayStr = baseCommitDisplayStr;
            _headCommitDisplayStr = headCommitDisplayStr;

            InitializeComponent();
            Translate();

            _toolTipControl.SetToolTip(btnAnotherBaseBranch, anotherBranchTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherHeadBranch, anotherBranchTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherBaseCommit, anotherCommitTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherHeadCommit, anotherCommitTooltip.Text);
            _toolTipControl.SetToolTip(btnSwap, btnSwapTooltip.Text);

            if (!IsUICommandsInitialized)
            {// UICommands is not initialized in translation unit test.
                return;
            }

            _baseRevision = new GitRevision(Module, baseCommitSha);
            _headRevision = new GitRevision(Module, headCommitSha);
            _mergeBase = new GitRevision(Module, Module.GetMergeBase(_baseRevision.Guid, _headRevision.Guid));

            lblBaseCommit.BackColor = AppSettings.DiffRemovedColor;
            lblHeadCommit.BackColor = AppSettings.DiffAddedColor;

            DiffFiles.SelectedIndexChanged += DiffFiles_SelectedIndexChanged;

            DiffFiles.ContextMenuStrip = DiffContextMenu;

            this.Load += (sender, args) => PopulateDiffFiles();
        }
Exemplo n.º 10
0
 internal FormCheckoutBranch(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     _rbResetBranchDefaultText = rbResetBranch.Text;
 }
Exemplo n.º 11
0
        public FormViewPatch(GitUICommands aCommands)
            : base(aCommands)
        {
            InitializeComponent(); Translate();

            PatchManager = new PatchManager();
        }
Exemplo n.º 12
0
        public FormPush(GitUICommands aCommands)
            : base(aCommands)
        {
            InitializeComponent();
            Translate();

            if (!GitCommandHelpers.VersionInUse.SupportPushForceWithLease)
            {
                ckForceWithLease.Visible = false;
                ForcePushTags.DataBindings.Add("Checked", ForcePushBranches, "Checked",
                    formattingEnabled: false, updateMode: DataSourceUpdateMode.OnPropertyChanged);
            }
            else
            {
                ForcePushTags.DataBindings.Add("Checked", ckForceWithLease, "Checked",
                    formattingEnabled: false, updateMode: DataSourceUpdateMode.OnPropertyChanged);
                toolTip1.SetToolTip(ckForceWithLease, _forceWithLeaseTooltips.Text);
            }

            //can't be set in OnLoad, because after PushAndShowDialogWhenFailed()
            //they are reset to false
            if (aCommands != null)
            {
                _gitRemoteController = new GitRemoteController(Module);
                Init();
            }
        }
Exemplo n.º 13
0
 public FormFormatPatch(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     MailFrom.Text = Module.GetEffectiveSetting("user.email");
 }
Exemplo n.º 14
0
 private FormRebase(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     helpImageDisplayUserControl1.Visible = !AppSettings.DontShowHelpImages;
 }
Exemplo n.º 15
0
 public FormSvnClone(GitUICommands aCommands, EventHandler<GitModuleEventArgs> GitModuleChanged)
     : base(aCommands)
 {
     this.GitModuleChanged = GitModuleChanged;
     InitializeComponent();
     this.Translate();
 }
        public FormResetCurrentBranch(GitUICommands aCommands, GitRevision Revision)
            : base(aCommands)
        {
            this.Revision = Revision;

            InitializeComponent(); Translate();
        }
Exemplo n.º 17
0
 public FormDeleteBranch(GitUICommands aCommands, string defaultBranch)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     _defaultBranch = defaultBranch;
 }
Exemplo n.º 18
0
 public FormMergeSubmodule(GitUICommands aCommands, string filename)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     lbSubmodule.Text = filename;
     this._filename = filename;
 }
Exemplo n.º 19
0
        public FormLog(GitUICommands aCommands)
            : base(true, aCommands)
        {
            InitializeComponent();
            Translate();

            diffViewer.ExtraDiffArgumentsChanged += DiffViewerExtraDiffArgumentsChanged;
        }
Exemplo n.º 20
0
 public FormFormatPatch(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     if (aCommands != null)
         MailFrom.Text = Module.GetEffectiveSetting(SettingKeyString.UserEmail);
 }
Exemplo n.º 21
0
 public FormRenameBranch(GitUICommands aCommands, string defaultBranch)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     Branches.Text = defaultBranch;
     oldName = defaultBranch;
 }
Exemplo n.º 22
0
 public FormStash(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Loading.Image = global::GitUI.Properties.Resources.loadingpanel;
     Translate();
     View.ExtraDiffArgumentsChanged += ViewExtraDiffArgumentsChanged;
 }
Exemplo n.º 23
0
 public FormGoToCommit(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     _tagsLoader = new AsyncLoader();
     _branchesLoader = new AsyncLoader();
 }
Exemplo n.º 24
0
        public FormRevertCommit(GitUICommands aCommands, GitRevision Revision)
            : base(aCommands)
        {
            this.Revision = Revision;

            InitializeComponent();
            Translate();
        }
Exemplo n.º 25
0
 public FormAddToGitIgnore(GitUICommands aCommands, params string[] filePatterns)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     if (filePatterns != null)
         FilePattern.Text = string.Join(Environment.NewLine, filePatterns);
 }
        public FormResetCurrentBranch(GitUICommands aCommands, GitRevision Revision)
            : base(aCommands)
        {
            this.Revision = Revision;

            InitializeComponent(); Translate();
            this.checkNoAsk.Checked = false;    // default
        }
Exemplo n.º 27
0
        public FormTag(GitUICommands aCommands)
            : base(aCommands)
        {
            InitializeComponent();
            Translate();

            tagMessage.MistakeFont = new Font(SystemFonts.MessageBoxFont, FontStyle.Underline);
        }
Exemplo n.º 28
0
        public FormCherryPick(GitUICommands aCommands, GitRevision revision)
            : base(aCommands)
        {
            Revision = revision;
            InitializeComponent();

            Translate();
        }
Exemplo n.º 29
0
 private FormCommitDiff(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
     DiffText.ExtraDiffArgumentsChanged += DiffText_ExtraDiffArgumentsChanged;
     DiffFiles.Focus();
     DiffFiles.GitItemStatuses = null;
 }
Exemplo n.º 30
0
        public FormVerify(GitUICommands aCommands)
            : base(aCommands)
        {
            InitializeComponent();
            selectedItemsHeader.AttachTo(columnIsLostObjectSelected);

            Translate();
            Warnings.AutoGenerateColumns = false;
        }
Exemplo n.º 31
0
        public FormCreateBranch(GitUICommands commands, ObjectId objectId, string newBranchNamePrefix = null)
            : base(commands)
        {
            InitializeComponent();
            InitializeComplete();

            groupBox1.AutoSize = true;

            if (objectId != null && objectId.IsArtificial)
            {
                objectId = null;
            }

            objectId = objectId ?? Module.GetCurrentCheckout();
            if (objectId != null)
            {
                commitPickerSmallControl1.SetSelectedCommitHash(objectId.ToString());
            }

            if (newBranchNamePrefix.IsNotNullOrWhitespace())
            {
                BranchNameTextBox.Text = newBranchNamePrefix;
            }
        }
Exemplo n.º 32
0
        /// <summary>Initializes <see cref="FormMergeBranch"/>.</summary>
        /// <param name="defaultBranch">Branch to merge into the current branch.</param>
        public FormMergeBranch(GitUICommands commands, string defaultBranch)
            : base(commands)
        {
            InitializeComponent();
            helpImageDisplayUserControl1.Image1 = Properties.Images.HelpCommandMerge.AdaptLightness();
            helpImageDisplayUserControl1.Image2 = Properties.Images.HelpCommandMergeFastForward.AdaptLightness();
            InitializeComplete();

            currentBranchLabel.Font = new Font(currentBranchLabel.Font, FontStyle.Bold);
            noCommit.Checked        = AppSettings.DontCommitMerge;

            helpImageDisplayUserControl1.IsOnHoverShowImage2NoticeText = _formMergeBranchHoverShowImageLabelText.Text;
            helpImageDisplayUserControl1.Visible = !AppSettings.DontShowHelpImages;
            _defaultBranch = defaultBranch;

            noFastForward.Checked  = Module.EffectiveSettings.NoFastForwardMerge;
            addLogMessages.Checked = Module.EffectiveSettings.Detailed.AddMergeLogMessages.ValueOrDefault;
            nbMessages.Value       = Module.EffectiveSettings.Detailed.MergeLogMessagesCount.ValueOrDefault;

            advanced.Checked = AppSettings.AlwaysShowAdvOpt;
            advanced_CheckedChanged(null, null);

            Branches.Select();
        }
Exemplo n.º 33
0
        public FormDiff(GitUICommands aCommands, RevisionGrid revisionGrid, string baseCommitSha,
                        string headCommitSha, string baseCommitDisplayStr, string headCommitDisplayStr) : base(aCommands)
        {
            RevisionGrid          = revisionGrid;
            _baseCommitDisplayStr = baseCommitDisplayStr;
            _headCommitDisplayStr = headCommitDisplayStr;

            InitializeComponent();
            Translate();

            _toolTipControl.SetToolTip(btnAnotherBaseBranch, anotherBranchTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherHeadBranch, anotherBranchTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherBaseCommit, anotherCommitTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherHeadCommit, anotherCommitTooltip.Text);
            _toolTipControl.SetToolTip(btnSwap, btnSwapTooltip.Text);

            if (!IsUICommandsInitialized)
            {// UICommands is not initialized in translation unit test.
                return;
            }

            _baseRevision = new GitRevision(baseCommitSha);
            _headRevision = new GitRevision(headCommitSha);
            _mergeBase    = new GitRevision(Module.GetMergeBase(_baseRevision.Guid, _headRevision.Guid));
            _findFilePredicateProvider = new FindFilePredicateProvider();

            lblBaseCommit.BackColor = AppSettings.DiffRemovedColor;
            lblHeadCommit.BackColor = AppSettings.DiffAddedColor;

            DiffFiles.SelectedIndexChanged += DiffFiles_SelectedIndexChanged;

            DiffFiles.ContextMenuStrip = DiffContextMenu;

            this.Load += (sender, args) => PopulateDiffFiles();
            DiffText.ExtraDiffArgumentsChanged += DiffTextOnExtraDiffArgumentsChanged;
        }
Exemplo n.º 34
0
        public FormCreateTag([NotNull] GitUICommands commands, [CanBeNull] ObjectId objectId)
            : base(commands)
        {
            InitializeComponent();
            InitializeComplete();

            annotate.Items.AddRange(new object[] { _trsLightweight.Text, _trsAnnotated.Text, _trsSignDefault.Text, _trsSignSpecificKey.Text });
            annotate.SelectedIndex = 0;

            tagMessage.MistakeFont = new Font(tagMessage.MistakeFont, FontStyle.Underline);

            if (objectId is not null && objectId.IsArtificial)
            {
                objectId = null;
            }

            objectId ??= Module.GetCurrentCheckout();
            if (objectId is not null)
            {
                commitPickerSmallControl1.SetSelectedCommitHash(objectId.ToString());
            }

            _gitTagController = new GitTagController(commands);
        }
Exemplo n.º 35
0
        public FormRemotes(GitUICommands commands)
            : base(commands)
        {
            InitializeComponent();
            Translate();

            // remove text from 'new' and 'delete' buttons because now they are represented by icons
            New.Text    = string.Empty;
            Delete.Text = string.Empty;
            toolTip1.SetToolTip(New, _btnNewTooltip.Text);
            toolTip1.SetToolTip(Delete, _btnDeleteTooltip.Text);

            _lvgEnabled  = new ListViewGroup(_lvgEnabledHeader.Text, HorizontalAlignment.Left);
            _lvgDisabled = new ListViewGroup(_lvgDisabledHeader.Text, HorizontalAlignment.Left);
            Remotes.Groups.AddRange(new[] { _lvgEnabled, _lvgDisabled });

            Application.Idle += application_Idle;

            BranchName.DataPropertyName  = nameof(IGitRef.LocalName);
            RemoteCombo.DataPropertyName = nameof(IGitRef.TrackingRemote);
            MergeWith.DataPropertyName   = nameof(IGitRef.MergeWith);

            this.AdjustForDpiScaling();
        }
Exemplo n.º 36
0
        public void SetUp()
        {
            _remoteReferenceRepository ??= new ReferenceRepository();

            // we will be modifying .git/config and need to completely reset each time
            _referenceRepository = new ReferenceRepository();

            _referenceRepository.Module.AddRemote(RemoteName, _remoteReferenceRepository.Module.WorkingDir);
            _referenceRepository.Fetch(RemoteName);

            _commands = new GitUICommands(_referenceRepository.Module);

            _referenceRepository.CreateCommit("Commit1", "Commit1");
            _referenceRepository.CreateBranch("Branch1", _referenceRepository.CommitHash);
            _referenceRepository.CreateTag("Branch1", _referenceRepository.CommitHash);
            _referenceRepository.CreateCommit("Commit2", "Commit2");
            _referenceRepository.CreateBranch("Branch2", _referenceRepository.CommitHash);

            _referenceRepository.CreateCommit("head commit");

            ExportProvider mefExportProvider = _composition.ExportProviderFactory.CreateExportProvider();

            ManagedExtensibility.SetTestExportProvider(mefExportProvider);
        }
Exemplo n.º 37
0
        public FormManageWorktree(GitUICommands commands)
            : base(commands)
        {
            InitializeComponent();
            Path.Width      = DpiUtil.Scale(35);
            Type.Width      = DpiUtil.Scale(37);
            Branch.Width    = DpiUtil.Scale(46);
            Sha1.Width      = DpiUtil.Scale(37);
            IsDeleted.Width = DpiUtil.Scale(50);
            Open.Width      = DpiUtil.Scale(39);
            Delete.Width    = DpiUtil.Scale(44);
            Worktrees.AutoGenerateColumns = false;
            InitializeComplete();

            Path.DataPropertyName      = nameof(WorkTree.Path);
            Type.DataPropertyName      = nameof(WorkTree.Type);
            Branch.DataPropertyName    = nameof(WorkTree.Branch);
            Sha1.DataPropertyName      = nameof(WorkTree.Sha1);
            IsDeleted.DataPropertyName = nameof(WorkTree.IsDeleted);

            bool light = ColorHelper.IsLightTheme();

            Delete.Image = light ? Images.Delete : Images.Delete_inv;
        }
Exemplo n.º 38
0
        public FormDiff(
            GitUICommands commands, bool firstParentIsValid,
            ObjectId baseId, ObjectId headId,
            string baseCommitDisplayStr, string headCommitDisplayStr)
            : base(commands)
        {
            _baseCommitDisplayStr = baseCommitDisplayStr;
            _headCommitDisplayStr = headCommitDisplayStr;
            _firstParentIsValid   = firstParentIsValid;

            InitializeComponent();
            InitializeComplete();

            _toolTipControl.SetToolTip(btnAnotherBaseBranch, _anotherBranchTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherHeadBranch, _anotherBranchTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherBaseCommit, _anotherCommitTooltip.Text);
            _toolTipControl.SetToolTip(btnAnotherHeadCommit, _anotherCommitTooltip.Text);
            _toolTipControl.SetToolTip(btnSwap, _btnSwapTooltip.Text);

            _baseRevision                      = new GitRevision(baseId);
            _headRevision                      = new GitRevision(headId);
            _mergeBase                         = new GitRevision(Module.GetMergeBase(_baseRevision.ObjectId, _headRevision.ObjectId));
            ckCompareToMergeBase.Text         += $" ({_mergeBase?.ObjectId.ToShortString()})";
            _fullPathResolver                  = new FullPathResolver(() => Module.WorkingDir);
            _findFilePredicateProvider         = new FindFilePredicateProvider();
            _revisionTester                    = new GitRevisionTester(_fullPathResolver);
            _revisionDiffContextMenuController = new FileStatusListContextMenuController();

            lblBaseCommit.BackColor = AppSettings.DiffRemovedColor;
            lblHeadCommit.BackColor = AppSettings.DiffAddedColor;

            DiffFiles.ContextMenuStrip          = DiffContextMenu;
            DiffFiles.SelectedIndexChanged     += delegate { ShowSelectedFileDiff(); };
            DiffText.ExtraDiffArgumentsChanged += delegate { ShowSelectedFileDiff(); };
            Load += delegate { PopulateDiffFiles(); };
        }
Exemplo n.º 39
0
        public FormFileHistory(GitUICommands aCommands, string fileName, GitRevision revision, bool filterByRevision)
            : this(aCommands)
        {
            FileChanges.SetInitialRevision(revision);
            Translate();

            FileName = fileName;
            SetTitle(string.Empty);

            Diff.ExtraDiffArgumentsChanged += DiffExtraDiffArgumentsChanged;

            FileChanges.SelectionChanged += FileChangesSelectionChanged;
            FileChanges.DisableContextMenu();

            followFileHistoryToolStripMenuItem.Checked = AppSettings.FollowRenamesInFileHistory;
            fullHistoryToolStripMenuItem.Checked       = AppSettings.FullHistoryInFileHistory;
            loadHistoryOnShowToolStripMenuItem.Checked = AppSettings.LoadFileHistoryOnShow;
            loadBlameOnShowToolStripMenuItem.Checked   = AppSettings.LoadBlameOnShow;

            if (filterByRevision && revision != null && revision.Guid != null)
            {
                _filterBranchHelper.SetBranchFilter(revision.Guid, false);
            }
        }
 public void LaunchGitExtensions()
 {
     GitUICommands.LaunchBrowse(workingDir: Info.Path.EnsureTrailingPathSeparator(), ObjectId.WorkTreeId, Info?.Detailed?.RawStatus?.OldCommit);
 }
Exemplo n.º 41
0
 public FormProcess(GitUICommands commands, string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
     : this(commands, outputControl : null, process, arguments, workingDirectory, input, useDialogSettings)
 {
 }
Exemplo n.º 42
0
 public FormRebase(GitUICommands commands, string defaultBranch)
     : this(commands)
 {
     _defaultBranch = defaultBranch;
 }
Exemplo n.º 43
0
        private static void RunApplication()
        {
            string[] args = Environment.GetCommandLineArgs();

            // This form created to obtain UI synchronization context only
            using (new Form())
            {
                // Store the shared JoinableTaskContext
                ThreadHelper.JoinableTaskContext = new JoinableTaskContext();
            }

            AppSettings.LoadSettings();
            if (EnvUtils.RunningOnWindows())
            {
                WebBrowserEmulationMode.SetBrowserFeatureControl();
                FormFixHome.CheckHomePath();
            }

            if (string.IsNullOrEmpty(AppSettings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                // Ensure we can find the git command to execute,
                // unless we are being instructed to uninstall,
                // or AppSettings.CheckSettings is set to false.
                if (!(args.Length >= 2 && args[1] == "uninstall"))
                {
                    if (!CheckSettingsLogic.SolveGitCommand())
                    {
                        if (!LocateMissingGit())
                        {
                            Environment.Exit(-1);
                            return;
                        }
                    }

                    if (AppSettings.CheckSettings)
                    {
                        var uiCommands         = new GitUICommands("");
                        var commonLogic        = new CommonLogic(uiCommands.Module);
                        var checkSettingsLogic = new CheckSettingsLogic(commonLogic);
                        var fakePageHost       = new SettingsPageHostMock(checkSettingsLogic);
                        using (var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(fakePageHost))
                        {
                            if (!checklistSettingsPage.CheckSettings())
                            {
                                if (!checkSettingsLogic.AutoSolveAllSettings())
                                {
                                    uiCommands.StartSettingsDialog();
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            if (EnvUtils.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            var commands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                commands.StartBrowseDialog();
            }
            else
            {
                // if we are here args.Length > 1
                commands.RunCommand(args);
            }

            AppSettings.SaveSettings();
        }
Exemplo n.º 44
0
        public FormPush([NotNull] GitUICommands commands)
            : base(commands)
        {
            InitializeComponent();

            NewColumn.Width    = DpiUtil.Scale(97);
            PushColumn.Width   = DpiUtil.Scale(36);
            ForceColumn.Width  = DpiUtil.Scale(101);
            DeleteColumn.Width = DpiUtil.Scale(108);

            InitializeComplete();

            if (!GitVersion.Current.SupportPushForceWithLease)
            {
                ckForceWithLease.Visible = false;
                ForcePushTags.DataBindings.Add("Checked", ForcePushBranches, "Checked",
                                               formattingEnabled: false, updateMode: DataSourceUpdateMode.OnPropertyChanged);
            }
            else
            {
                ForcePushTags.DataBindings.Add("Checked", ckForceWithLease, "Checked",
                                               formattingEnabled: false, updateMode: DataSourceUpdateMode.OnPropertyChanged);
                toolTip1.SetToolTip(ckForceWithLease, _forceWithLeaseTooltips.Text);
            }

            // can't be set in OnLoad, because after PushAndShowDialogWhenFailed()
            // they are reset to false
            _remoteManager = new GitRemoteManager(() => Module);
            Init();

            void Init()
            {
                _gitRefs = Module.GetRefs();
                if (GitVersion.Current.SupportPushWithRecursiveSubmodulesCheck)
                {
                    RecursiveSubmodules.Enabled       = true;
                    RecursiveSubmodules.SelectedIndex = AppSettings.RecursiveSubmodules;
                    if (!GitVersion.Current.SupportPushWithRecursiveSubmodulesOnDemand)
                    {
                        RecursiveSubmodules.Items.RemoveAt(2);
                    }
                }
                else
                {
                    RecursiveSubmodules.Enabled       = false;
                    RecursiveSubmodules.SelectedIndex = 0;
                }

                _currentBranchName = Module.GetSelectedBranch();

                // refresh registered git remotes
                UserGitRemotes = _remoteManager.LoadRemotes(false).ToList();
                BindRemotesDropDown(null);

                UpdateBranchDropDown();
                UpdateRemoteBranchDropDown();

                Push.Focus();

                if (AppSettings.AlwaysShowAdvOpt)
                {
                    ShowOptions_LinkClicked(null, null);
                }
            }
        }
Exemplo n.º 45
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!EnvUtils.IsMonoRuntime())
            {
                try
                {
                    NBug.Settings.UIMode = NBug.Enums.UIMode.Full;

                    // Uncomment the following after testing to see that NBug is working as configured
                    NBug.Settings.ReleaseMode = true;
                    NBug.Settings.ExitApplicationImmediately = false;
                    NBug.Settings.WriteLogToDisk             = false;
                    NBug.Settings.MaxQueuedReports           = 10;
                    NBug.Settings.StopReportingAfter         = 90;
                    NBug.Settings.SleepBeforeSend            = 30;
                    NBug.Settings.StoragePath = NBug.Enums.StoragePath.WindowsTemp;

                    AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
                    Application.ThreadException += NBug.Handler.ThreadException;
                }
                catch (TypeInitializationException tie)
                {
                    // is this exception caused by the configuration?
                    if (tie.InnerException != null &&
                        tie.InnerException.GetType()
                        .IsSubclassOf(typeof(System.Configuration.ConfigurationException)))
                    {
                        HandleConfigurationException((System.Configuration.ConfigurationException)tie.InnerException);
                    }
                }
            }

            string[] args = Environment.GetCommandLineArgs();
            FormSplash.ShowSplash();
            //Store here SynchronizationContext.Current, because later sometimes it can be null
            //see http://stackoverflow.com/questions/11621372/synchronizationcontext-current-is-null-in-continuation-on-the-main-ui-thread
            GitUIExtensions.UISynchronizationContext     = SynchronizationContext.Current;
            AsyncLoader.DefaultContinuationTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            Application.DoEvents();

            AppSettings.LoadSettings();
            if (EnvUtils.RunningOnWindows())
            {
                WebBrowserEmulationMode.SetBrowserFeatureControl();

                //Quick HOME check:
                FormSplash.SetAction("Checking home path...");
                Application.DoEvents();

                FormFixHome.CheckHomePath();
            }
            //Register plugins
            FormSplash.SetAction("Loading plugins...");
            Application.DoEvents();

            if (string.IsNullOrEmpty(AppSettings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (!(args.Length >= 2 && args[1].Equals("uninstall")) &&
                    (AppSettings.CheckSettings ||
                     string.IsNullOrEmpty(AppSettings.GitCommandValue) ||
                     !File.Exists(AppSettings.GitCommandValue)))
                {
                    FormSplash.SetAction("Checking settings...");
                    Application.DoEvents();

                    GitUICommands     uiCommands         = new GitUICommands(string.Empty);
                    var               commonLogic        = new CommonLogic(uiCommands.Module);
                    var               checkSettingsLogic = new CheckSettingsLogic(commonLogic);
                    ISettingsPageHost fakePageHost       = new SettingsPageHostMock(checkSettingsLogic);
                    using (var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(fakePageHost))
                    {
                        if (!checklistSettingsPage.CheckSettings())
                        {
                            if (!checkSettingsLogic.AutoSolveAllSettings())
                            {
                                uiCommands.StartSettingsDialog();
                            }
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            FormSplash.HideSplash();

            if (EnvUtils.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            GitUICommands uCommands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                uCommands.StartBrowseDialog();
            }
            else  // if we are here args.Length > 1
            {
                uCommands.RunCommand(args);
            }

            AppSettings.SaveSettings();
        }
Exemplo n.º 46
0
 public FormFileHistory(GitUICommands aCommands, string fileName)
     : this(aCommands, fileName, null, false)
 {
 }
Exemplo n.º 47
0
 public ViewPullRequestsForm(GitUICommands aCommands, IRepositoryHostPlugin gitHoster)
     : this(aCommands)
 {
     _gitHoster = gitHoster;
 }
Exemplo n.º 48
0
 public FormGitAttributes(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
 }
Exemplo n.º 49
0
 public StashNode(GitStash stash, GitUICommands uiCommands)
     : base(stash, null, uiCommands)
 {
     IsDraggable = true;
 }
Exemplo n.º 50
0
 private FormChooseCommit(GitUICommands aCommands)
     : base(aCommands)
 {
     InitializeComponent();
     Translate();
 }
Exemplo n.º 51
0
 public FormCheckoutRevision(GitUICommands commands)
     : base(commands)
 {
     InitializeComponent();
     InitializeComplete();
 }
            public void StashSubmodule(IWin32Window owner, SubmoduleNode node)
            {
                var uiCmds = new GitUICommands(new GitModule(node.Info.Path));

                uiCmds.StashSave(owner, AppSettings.IncludeUntrackedFilesInManualStash);
            }
            public void CommitSubmodule(IWin32Window owner, SubmoduleNode node)
            {
                var submodulCommands = new GitUICommands(node.Info.Path.EnsureTrailingPathSeparator());

                submodulCommands.StartCommitDialog(owner);
            }
Exemplo n.º 54
0
        public FormSettings(GitUICommands aCommands, SettingsPageReference initalPage = null)
            : base(aCommands)
        {
            InitializeComponent();
            Translate();

            settingsTreeView.SuspendLayout();

            //if form is created for translation purpose
            if (aCommands == null)
            {
                return;
            }

#if DEBUG
            buttonDiscard.Visible = true;
#endif

            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsGroup(), null);
            SettingsPageReference gitExtPageRef = GitExtensionsSettingsGroup.GetPageReference();

            _commonLogic = new CommonLogic(Module);

            _checkSettingsLogic = new CheckSettingsLogic(_commonLogic, Module);

            var checklistSettingsPage = new ChecklistSettingsPage(_commonLogic, _checkSettingsLogic, Module, this);
            settingsTreeView.AddSettingsPage(checklistSettingsPage, gitExtPageRef, true); // as root

            settingsTreeView.AddSettingsPage(new GitSettingsPage(_checkSettingsLogic, this), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new GitExtensionsSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new AppearanceSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new ColorsSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new StartPageSettingsPage(), gitExtPageRef);

            var globalSettingsSettingsPage = new GlobalSettingsSettingsPage(_commonLogic, _checkSettingsLogic, Module);
            settingsTreeView.AddSettingsPage(globalSettingsSettingsPage, gitExtPageRef);

            var localSettingsSettingsPage = new LocalSettingsSettingsPage(_commonLogic, _checkSettingsLogic, Module);
            settingsTreeView.AddSettingsPage(localSettingsSettingsPage, gitExtPageRef);

            var _sshSettingsPage = new SshSettingsPage(_commonLogic);
            settingsTreeView.AddSettingsPage(_sshSettingsPage, gitExtPageRef);
            checklistSettingsPage.SshSettingsPage = _sshSettingsPage;

            settingsTreeView.AddSettingsPage(new ScriptsSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new HotkeysSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new ShellExtensionSettingsPage(), gitExtPageRef);

            settingsTreeView.AddSettingsPage(new AdvancedSettingsPage(), gitExtPageRef);
            SettingsPageReference advancedPageRef = AdvancedSettingsPage.GetPageReference();

            settingsTreeView.AddSettingsPage(new ConfirmationsSettingsPage(), advancedPageRef);

            settingsTreeView.AddSettingsPage(new PluginsSettingsGroup(), null);
            SettingsPageReference pluginsPageRef = PluginsSettingsGroup.GetPageReference();
            settingsTreeView.AddSettingsPage(new PluginRootIntroductionPage(), pluginsPageRef, true); // as root
            foreach (var gitPlugin in LoadedPlugins.Plugins)
            {
                var settingsPage = PluginSettingsPage.CreateSettingsPageFromPlugin(gitPlugin);
                settingsTreeView.AddSettingsPage(settingsPage, pluginsPageRef);
            }

            settingsTreeView.GotoPage(initalPage);
            settingsTreeView.ResumeLayout();
        }
Exemplo n.º 55
0
 public void TearDown()
 {
     _commands = null;
 }
Exemplo n.º 56
0
        private static void RunApplication()
        {
            string[] args = Environment.GetCommandLineArgs();

            // This form created for obtain UI synchronization context only
            using (new Form())
            {
                // Store here SynchronizationContext.Current, because later sometimes it can be null
                // see http://stackoverflow.com/questions/11621372/synchronizationcontext-current-is-null-in-continuation-on-the-main-ui-thread
                GitUIExtensions.UISynchronizationContext     = SynchronizationContext.Current;
                AsyncLoader.DefaultContinuationTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            }

            AppSettings.LoadSettings();
            if (EnvUtils.RunningOnWindows())
            {
                WebBrowserEmulationMode.SetBrowserFeatureControl();
                FormFixHome.CheckHomePath();
            }

            if (string.IsNullOrEmpty(AppSettings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (!(args.Length >= 2 && args[1].Equals("uninstall")) &&
                    (AppSettings.CheckSettings ||
                     string.IsNullOrEmpty(AppSettings.GitCommandValue) ||
                     !File.Exists(AppSettings.GitCommandValue)))
                {
                    GitUICommands     uiCommands         = new GitUICommands(string.Empty);
                    var               commonLogic        = new CommonLogic(uiCommands.Module);
                    var               checkSettingsLogic = new CheckSettingsLogic(commonLogic);
                    ISettingsPageHost fakePageHost       = new SettingsPageHostMock(checkSettingsLogic);
                    using (var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(fakePageHost))
                    {
                        if (!checklistSettingsPage.CheckSettings())
                        {
                            if (!checkSettingsLogic.AutoSolveAllSettings())
                            {
                                uiCommands.StartSettingsDialog();
                            }
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            if (EnvUtils.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            GitUICommands commands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                commands.StartBrowseDialog();
            }
            else
            {
                // if we are here args.Length > 1
                commands.RunCommand(args);
            }

            AppSettings.SaveSettings();
        }
Exemplo n.º 57
0
 void UICommandsSource_GitUICommandsChanged(IGitUICommandsSource sender, GitUICommands oldCommands)
 {
     Clear();
 }
Exemplo n.º 58
0
 public FormCreateWorktree(GitUICommands commands)
     : base(commands)
 {
     InitializeComponent();
     InitializeComplete();
 }
Exemplo n.º 59
0
 public FormCheckoutRevision(GitUICommands aCommands)
     : base(true, aCommands)
 {
     InitializeComponent();
     Translate();
 }
Exemplo n.º 60
0
 public void SetUp()
 {
     _repo1    = new GitModuleTestHelper("repo1");
     _commands = new GitUICommands(_repo1.Module);
 }