示例#1
0
        public static SubmoduleInfoResult UpdateSubmoduleStructureAndWaitForResult(ISubmoduleStatusProvider provider, GitModule module, bool updateStatus = false)
        {
            SubmoduleInfoResult result = null;

            provider.StatusUpdated += ProviderStatusUpdated;
            try
            {
                provider.UpdateSubmodulesStructure(
                    workingDirectory: module.WorkingDir,
                    noBranchText: string.Empty,
                    updateStatus: updateStatus);

                AsyncTestHelper.WaitForPendingOperations(AsyncTestHelper.UnexpectedTimeout);
            }
            finally
            {
                provider.StatusUpdated -= ProviderStatusUpdated;
            }

            return(result);

            void ProviderStatusUpdated(object sender, SubmoduleStatusEventArgs e)
            {
                result = e.Info;
            }
        }
        public void SetUp()
        {
            _repo1 = new GitModuleTestHelper("repo1");
            _repo2 = new GitModuleTestHelper("repo2");
            _repo3 = new GitModuleTestHelper("repo3");

            _repo2.AddSubmodule(_repo3, "repo3");
            _repo1.AddSubmodule(_repo2, "repo2");
            var submodules = _repo1.GetSubmodulesRecursive();

            _repo1Module = _repo1.Module;
            _repo2Module = submodules.ElementAt(0);
            _repo3Module = submodules.ElementAt(1);

            // Use the singleton provider, which is also used by the left panel, so we can synchronize on updates
            _provider = SubmoduleStatusProvider.Default;

            _commands = new GitUICommands(_repo1Module);

            var composition = TestComposition.Empty
                              .AddParts(typeof(MockWindowsJumpListManager))
                              .AddParts(typeof(MockRepositoryDescriptionProvider))
                              .AddParts(typeof(MockAppTitleGenerator));
            ExportProvider mefExportProvider = composition.ExportProviderFactory.CreateExportProvider();

            ManagedExtensibility.SetTestExportProvider(mefExportProvider);
        }
        public void SetUp()
        {
            _repo1 = new GitModuleTestHelper("repo1");
            _repo2 = new GitModuleTestHelper("repo2");
            _repo3 = new GitModuleTestHelper("repo3");

            _repo2.AddSubmodule(_repo3, "repo3");
            _repo1.AddSubmodule(_repo2, "repo2");
            var submodules = _repo1.GetSubmodulesRecursive();

            _repo1Module = _repo1.Module;
            _repo2Module = submodules.ElementAt(0);
            _repo3Module = submodules.ElementAt(1);

            _provider = new SubmoduleStatusProvider();
        }
        public void SetUp()
        {
            _repo1 = new GitModuleTestHelper("repo1");
            _repo2 = new GitModuleTestHelper("repo2");
            _repo3 = new GitModuleTestHelper("repo3");

            _repo2.AddSubmodule(_repo3, "repo3");
            _repo1.AddSubmodule(_repo2, "repo2");
            var submodules = _repo1.GetSubmodulesRecursive();

            _repo1Module = _repo1.Module;
            _repo2Module = submodules.ElementAt(0);
            _repo3Module = submodules.ElementAt(1);

            // Use the singleton provider, which is also used by the left panel, so we can synchronize on updates
            _provider = SubmoduleStatusProvider.Default;

            _commands = new GitUICommands(_repo1Module);
        }
        public static async Task UpdateSubmoduleStatusAndWaitForResultAsync(ISubmoduleStatusProvider provider, GitModule module, IReadOnlyList <GitItemStatus> gitStatus, bool forceUpdate = true)
        {
            provider.StatusUpdated += Provider_StatusUpdated;

            await provider.UpdateSubmodulesStatusAsync(
                workingDirectory : module.WorkingDir,
                gitStatus : gitStatus,
                forceUpdate : forceUpdate);

            await AsyncTestHelper.JoinPendingOperationsAsync(AsyncTestHelper.UnexpectedTimeout);

            provider.StatusUpdated -= Provider_StatusUpdated;

            return;

            void Provider_StatusUpdated(object sender, SubmoduleStatusEventArgs e)
            {
            }
        }
            private static SubmoduleInfoResult UpdateSubmoduleStatusAndWaitForResult(ISubmoduleStatusProvider provider, GitModule module)
            {
                SubmoduleInfoResult result = null;
                SemaphoreSlim       onUpdateCompleteSignal = new SemaphoreSlim(0, 1);

                provider.UpdateSubmodulesStatus(
                    updateStatus: false,
                    workingDirectory: module.WorkingDir,
                    noBranchText: string.Empty,
                    onUpdateBegin: () => { },
                    onUpdateCompleteAsync: async(SubmoduleInfoResult submoduleInfoResult, CancellationToken token) =>
                {
                    await TaskScheduler.Default;
                    result = submoduleInfoResult;
                    onUpdateCompleteSignal.Release();
                });

                onUpdateCompleteSignal.Wait();
                return(result);
            }
        public static void UpdateSubmoduleStatusAndWaitForResult(ISubmoduleStatusProvider provider, GitModule module, IReadOnlyList <GitItemStatus> gitStatus)
        {
            List <DetailedSubmoduleInfo> result = new List <DetailedSubmoduleInfo>();

            provider.StatusUpdated += Provider_StatusUpdated;

            provider.UpdateSubmodulesStatus(
                workingDirectory: module.WorkingDir,
                gitStatus: gitStatus);

            AsyncTestHelper.WaitForPendingOperations();

            provider.StatusUpdated -= Provider_StatusUpdated;

            return;

            void Provider_StatusUpdated(object sender, SubmoduleStatusEventArgs e)
            {
            }
        }
        public static SubmoduleInfoResult UpdateSubmoduleStatusAndWaitForResult(ISubmoduleStatusProvider provider, GitModule module, bool updateStatus = false)
        {
            SubmoduleInfoResult result = null;

            provider.StatusUpdated += Provider_StatusUpdated;

            provider.UpdateSubmodulesStatus(
                updateStatus: updateStatus,
                workingDirectory: module.WorkingDir,
                noBranchText: string.Empty);

            AsyncTestHelper.WaitForPendingOperations();

            provider.StatusUpdated -= Provider_StatusUpdated;

            return(result);

            void Provider_StatusUpdated(object sender, SubmoduleStatusEventArgs e)
            {
                result = e.Info;
            }
        }
示例#9
0
        public void SetUp()
        {
            _repo1 = new GitModuleTestHelper("repo1");
            _repo2 = new GitModuleTestHelper("repo2");
            _repo3 = new GitModuleTestHelper("repo3");

            _repo2.AddSubmodule(_repo3, "repo3");
            _repo1.AddSubmodule(_repo2, "repo2");
            var submodules = _repo1.GetSubmodulesRecursive();

            _repo1Module = _repo1.Module;
            _repo2Module = submodules.ElementAt(0);
            _repo3Module = submodules.ElementAt(1);

            // Use the singleton provider, which is also used by the left panel, so we can synchronize on updates
            _provider = SubmoduleStatusProvider.Default;

            _commands = new GitUICommands(_repo1Module);

            ExportProvider mefExportProvider = _composition.ExportProviderFactory.CreateExportProvider();

            ManagedExtensibility.SetTestExportProvider(mefExportProvider);
        }
示例#10
0
        public static async Task UpdateSubmoduleStatusAndWaitForResultAsync(ISubmoduleStatusProvider provider, VsrModule module, IReadOnlyList <GitItemStatus> gitStatus)
        {
            provider.UpdateSubmodulesStatus(workingDirectory: module.WorkingDir, gitStatus: gitStatus, forceUpdate: true);

            await AsyncTestHelper.JoinPendingOperationsAsync(AsyncTestHelper.UnexpectedTimeout);
        }
示例#11
0
        public static void UpdateSubmoduleStatusAndWaitForResult(ISubmoduleStatusProvider provider, GitModule module, IReadOnlyList <GitItemStatus> gitStatus)
        {
            provider.UpdateSubmodulesStatus(workingDirectory: module.WorkingDir, gitStatus: gitStatus, forceUpdate: true);

            AsyncTestHelper.WaitForPendingOperations(AsyncTestHelper.UnexpectedTimeout);
        }