本文整理汇总了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;
}
示例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;
}