Beispiel #1
0
        public static GuiCommandStatus SyncSubmodules(IWin32Window parent, SubmodulesCollection submodules)
        {
            Verify.Argument.IsNotNull(submodules, nameof(submodules));

            if (parent == null)
            {
                parent = GitterApplication.MainForm;
            }
            try
            {
                ProgressForm.MonitorTaskAsModalWindow(parent, Resources.StrSync,
                                                      progress => submodules.SyncAsync(recursive: true, progress: progress));
                return(GuiCommandStatus.Completed);
            }
            catch (OperationCanceledException)
            {
                return(GuiCommandStatus.Canceled);
            }
            catch (GitException exc)
            {
                GitterApplication.MessageBoxService.Show(
                    parent,
                    exc.Message,
                    Resources.ErrFailedToSyncSubmodule,
                    MessageBoxButton.Close,
                    MessageBoxIcon.Error);
                return(GuiCommandStatus.Faulted);
            }
        }
Beispiel #2
0
 public SubmoduleListBinding(CustomListBoxItemsCollection itemHost, SubmodulesCollection submodules)
     : base(itemHost, submodules)
 {
 }
Beispiel #3
0
        /// <summary>Create <see cref="Repository"/>.</summary>
        /// <param name="gitAccessor">Git repository access provider.</param>
        /// <param name="workingDirectory">Repository working directory.</param>
        /// <param name="load"><c>true</c> to load repository; <c>false</c> otherwise.</param>
        private Repository(IGitAccessor gitAccessor, string workingDirectory, bool load)
        {
            Verify.Argument.IsNotNull(gitAccessor, "gitAccessor");
            Verify.Argument.IsNotNull(workingDirectory, "workingDirectory");

            _workingDirectory     = GetWorkingDirectory(workingDirectory);
            _gitDirectory         = GetGitDirectory(_workingDirectory);
            _configurationManager = GetConfigurationManager(_gitDirectory);

            _accessor      = gitAccessor.CreateRepositoryAccessor(this);
            _revisionCache = new RevisionCache(this);
            _configuration = new ConfigParametersCollection(this);
            _status        = new Status(this);
            _stash         = new StashedStatesCollection(this);
            _refs          = new RefsCollection(this);
            _notes         = new NotesCollection(this);
            _remotes       = new RemotesCollection(this);
            _submodules    = new SubmodulesCollection(this);
            _users         = new UsersCollection(this);
            _hooks         = new HooksCollection(this);

            if(load)
            {
                try
                {
                    LoadCore(this, null, CancellationToken.None);
                }
                catch
                {
                    Dispose();
                    throw;
                }
            }
        }