当前位置: 首页>>代码示例>>C#>>正文


C# Repository.CheckoutAllRemoteBranches方法代码示例

本文整理汇总了C#中LibGit2Sharp.Repository.CheckoutAllRemoteBranches方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.CheckoutAllRemoteBranches方法的具体用法?C# Repository.CheckoutAllRemoteBranches怎么用?C# Repository.CheckoutAllRemoteBranches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibGit2Sharp.Repository的用法示例。


在下文中一共展示了Repository.CheckoutAllRemoteBranches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestLibGit2Extensions_CheckoutAllRemoteBranches

        public void TestLibGit2Extensions_CheckoutAllRemoteBranches()
        {
            var otherRepositoryRootFolder = new DirectoryInfo(@"C:\dev1\GitReposTest\Repo3");

            using (var otherRepository = new Repository(otherRepositoryRootFolder.FullName))
            {
                otherRepository.CheckoutAllRemoteBranches();
            }
        }
开发者ID:Bhaal22,项目名称:Msbuild.GitCloneTask,代码行数:9,代码来源:LibGit2ExtensionsTests.cs

示例2: HandleFixedVersioning

        protected virtual void HandleFixedVersioning(Dependency dependency, CloneOptions cloneOptions)
        {
            if (!string.IsNullOrEmpty(dependency.Branch) && !string.IsNullOrEmpty(dependency.Commit))
                throw new InvalidOperationException($"Dependency {dependency}: fixed versioning: definition is incoherent: Branch = '{dependency.Branch}' != '' and Commit = '{dependency.Commit}' != '' => you can't have both set!");

            if (!Directory.Exists(dependency.OutputFolder))
            {
                Log($"Dependency {dependency}: fixed versioning: cloning fixed branch '{dependency.Branch}' of '{dependency.Remote}' into '{dependency.OutputFolder}'...");
                cloneOptions.BranchName = dependency.Branch;
                Repository.Clone(dependency.Remote, dependency.OutputFolder, cloneOptions);
            }
            else if (Pull)
            {
                Log($"Dependency {dependency}: fixed versioning: repository '{dependency.Remote}' already cloned in '{dependency.OutputFolder}'");

                try
                {
                    IndentLevel++;

                    using (var otherRepository = new Repository(dependency.OutputFolder))
                    {
                        otherRepository.CheckoutAllRemoteBranches();

                        if (!string.IsNullOrEmpty(dependency.Commit))
                            HandleFixedVersioning_Commit(dependency, otherRepository);
                        else
                            HandleFixedVersioning_Branch(dependency, otherRepository);
                    }
                }
                finally
                {
                    IndentLevel--; 
                }
            }
        }
开发者ID:Bhaal22,项目名称:Msbuild.GitCloneTask,代码行数:35,代码来源:GitCloneTask.cs

示例3: HandleAutoVersioning

        protected virtual void HandleAutoVersioning(Repository myRepository, string myShortName, Dependency dependency, CloneOptions cloneOptions)
        {
            if (!string.IsNullOrEmpty(dependency.Commit))
                throw new InvalidOperationException($"Dependency {dependency}: autoversioning: definition is incoherent: Branch = '{dependency.Branch}' and a Commit = '{dependency.Commit}' => you can't have both set!");

            if (Directory.Exists(dependency.OutputFolder))
            {
                Log($"Dependency {dependency}: autoversioning: output folder already exists: removing...");
                new DirectoryInfo(dependency.OutputFolder).ForceDelete();
            }

            Log($"Dependency {dependency}: autoversioning: cloning default branch of '{dependency.Remote}' into '{dependency.OutputFolder}'");
            Repository.Clone(dependency.Remote, dependency.OutputFolder, cloneOptions);

            try
            {
                IndentLevel++;

                using (var otherRepository = new Repository(dependency.OutputFolder))
                {
                    otherRepository.CheckoutAllRemoteBranches();
                    VersionResolver.CheckoutBranchInDependencyRepository(otherRepository, myRepository, myShortName, this);
                }
            }
            finally
            {
                IndentLevel--; 
            }
        }
开发者ID:Bhaal22,项目名称:Msbuild.GitCloneTask,代码行数:29,代码来源:GitCloneTask.cs


注:本文中的LibGit2Sharp.Repository.CheckoutAllRemoteBranches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。