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


C# IGitTfsRemote.InitBranch方法代码示例

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


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

示例1: InitBranchSupportingRename

        private IGitTfsRemote InitBranchSupportingRename(string tfsBranchPath, string gitBranchNameExpected, IList<RootBranch> creationBranchData, IGitTfsRemote defaultRemote, out IFetchResult fetchResult)
        {
            fetchResult = null;

            RemoveAlreadyFetchedBranches(creationBranchData, defaultRemote);

            _stdout.WriteLine("Branches to Initialize successively :");
            foreach (var branch in creationBranchData)
                _stdout.WriteLine("-" + branch.TfsBranchPath + " (" + branch.RootChangeset + ")");

            IGitTfsRemote tfsRemote = null;
            var remoteToDelete = new List<IGitTfsRemote>();
            foreach (var rootBranch in creationBranchData)
            {
                Trace.WriteLine("Processing " + (rootBranch.IsRenamedBranch ? "renamed " : string.Empty) + "branch :"
                    + rootBranch.TfsBranchPath + " (" + rootBranch.RootChangeset + ")");
                var cbd = new BranchCreationDatas() {RootChangesetId = rootBranch.RootChangeset, TfsRepositoryPath = rootBranch.TfsBranchPath};
                if (cbd.TfsRepositoryPath == tfsBranchPath)
                    cbd.GitBranchNameExpected = gitBranchNameExpected;

                tfsRemote = defaultRemote.InitBranch(_remoteOptions, cbd.TfsRepositoryPath, cbd.RootChangesetId, !NoFetch, cbd.GitBranchNameExpected, fetchResult);
                if (tfsRemote == null)
                {
                    throw new GitTfsException("error: Couldn't fetch parent branch\n");
                }
                if (rootBranch.IsRenamedBranch || !NoFetch)
                {
                    fetchResult = FetchRemote(tfsRemote, false, !DontCreateGitBranch && !rootBranch.IsRenamedBranch, fetchResult);
                    if(fetchResult.IsSuccess && rootBranch.IsRenamedBranch)
                        remoteToDelete.Add(tfsRemote);
                }
                else
                    Trace.WriteLine("Not fetching changesets, --no-fetch option specified");
            }
            foreach (var gitTfsRemote in remoteToDelete)
            {
                _globals.Repository.DeleteTfsRemote(gitTfsRemote);
            }
            return RemoteCreated = tfsRemote;
        }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:40,代码来源:InitBranch.cs

示例2: InitBranchSupportingRename

        private IGitTfsRemote InitBranchSupportingRename(string tfsBranchPath, string gitBranchNameExpected, IList<RootBranch> creationBranchData, IGitTfsRemote defaultRemote, out IFetchResult fetchResult)
        {
            fetchResult = null;

            RemoveAlreadyFetchedBranches(creationBranchData, defaultRemote);

            Trace.TraceInformation("Branches to Initialize successively :");
            foreach (var branch in creationBranchData)
                Trace.TraceInformation("-" + branch.TfsBranchPath + " (" + branch.SourceBranchChangesetId + ")");

            IGitTfsRemote branchTfsRemote = null;
            var remoteToDelete = new List<IGitTfsRemote>();
            foreach (var rootBranch in creationBranchData)
            {
                Trace.WriteLine("Processing " + (rootBranch.IsRenamedBranch ? "renamed " : string.Empty) + "branch :"
                    + rootBranch.TfsBranchPath + " (" + rootBranch.SourceBranchChangesetId + ")");
                var cbd = new BranchCreationDatas() { RootChangesetId = rootBranch.SourceBranchChangesetId, TfsRepositoryPath = rootBranch.TfsBranchPath };
                if (cbd.TfsRepositoryPath == tfsBranchPath)
                    cbd.GitBranchNameExpected = gitBranchNameExpected;

                branchTfsRemote = defaultRemote.InitBranch(_remoteOptions, cbd.TfsRepositoryPath, cbd.RootChangesetId, !NoFetch, cbd.GitBranchNameExpected, fetchResult);
                if (branchTfsRemote == null)
                {
                    throw new GitTfsException("error: Couldn't fetch parent branch\n");
                }

                // If this branch's branch point is past the first commit, indicate this so Fetch can start from that point
                if (rootBranch.TargetBranchChangesetId > -1)
                {
                    branchTfsRemote.SetInitialChangeset(rootBranch.TargetBranchChangesetId);
                }

                if (rootBranch.IsRenamedBranch || !NoFetch)
                {
                    fetchResult = FetchRemote(branchTfsRemote, false, !DontCreateGitBranch && !rootBranch.IsRenamedBranch, fetchResult, rootBranch.TargetBranchChangesetId);
                    if (fetchResult.IsSuccess && rootBranch.IsRenamedBranch)
                        remoteToDelete.Add(branchTfsRemote);
                }
                else
                    Trace.WriteLine("Not fetching changesets, --no-fetch option specified");
            }
            foreach (var gitTfsRemote in remoteToDelete)
            {
                _globals.Repository.DeleteTfsRemote(gitTfsRemote);
            }
            return RemoteCreated = branchTfsRemote;
        }
开发者ID:pmiossec,项目名称:git-tfs,代码行数:47,代码来源:InitBranch.cs


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