Exemple #1
0
        /// <summary>
        /// Fetch from one or more remote repositories.
        /// If the number of *selected* repos is 2 or more, this function will operate on
        /// those selected repos irrespective of the current one. Otherwise, fetch the
        /// current repo. Stops if a repo operation fails.
        /// </summary>
        private void MenuRepoFetch(object sender, EventArgs e)
        {
            List <ClassRepo> repos = PanelRepos.GetSelectedRepos();

            if (repos.Count <= 1)   // Disregard selected repos and use the current one
            {
                repos = new List <ClassRepo> {
                    App.Repos.Current
                }
            }
            ;
            // By default, fetch command will fetch from a currently selected remote repo
            // If the user holds down the Control key, it will fetch from all remote repos while trying to merge them
            bool allRemotes = Control.ModifierKeys == Keys.Control;

            foreach (var r in repos)
            {
                foreach (var remote in r.Remotes.GetListNames())
                {
                    if (allRemotes || remote == r.Remotes.Current)
                    {
                        string args = remote + " " + r.Branches.Current;
                        PrintStatus("Fetch from a remote repo \"" + args + "\" into \"" + r.Path + "\"", MessageType.General);
                        if (!r.RunCmd("fetch " + args).Success())
                        {
                            goto Done;
                        }
                    }
                }
            }
            Done : App.DoRefresh();
        }
Exemple #2
0
        /// <summary>
        /// Fetch from one or more remote repositories.
        /// If the number of *selected* repos is 2 or more, this function will operate on
        /// those selected repos irrespective of the current one. Otherwise, fetch the
        /// current repo. Stops if a repo operation fails.
        /// </summary>
        private void MenuRepoFetch(object sender, EventArgs e)
        {
            List <ClassRepo> repos = PanelRepos.GetSelectedRepos();

            if (repos.Count <= 1)   // Disregard selected repos and use the current one
            {
                repos = new List <ClassRepo> {
                    App.Repos.Current
                }
            }
            ;
            foreach (var r in repos)
            {
                string args = r.Remotes.Current + " " + r.Branches.Current;
                PrintStatus("Fetch from a remote repo \"" + args + "\" into \"" + r.Root + "\"", MessageType.General);
                if (!r.RunCmd("fetch " + args).Success())
                {
                    break;
                }
            }
            App.DoRefresh();
        }