本文整理汇总了C#中SourceRepository.GetDiskPath方法的典型用法代码示例。如果您正苦于以下问题:C# SourceRepository.GetDiskPath方法的具体用法?C# SourceRepository.GetDiskPath怎么用?C# SourceRepository.GetDiskPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceRepository
的用法示例。
在下文中一共展示了SourceRepository.GetDiskPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TfsSourceControlContext
public TfsSourceControlContext(TfsSourceControlProvider provider, string sourcePath, string label)
{
this.Label = label;
if (string.IsNullOrEmpty(sourcePath))
this.SourcePath = EmptyPathString;
else
this.SourcePath = sourcePath.TrimStart(provider.DirectorySeparator);
this.SplitPath = SplitPathParts(this.SourcePath);
this.LastSubDirectoryName = this.SplitPath.LastOrDefault() ?? string.Empty;
var tmpRepo = new SourceRepository() { RemoteUrl = BuildAbsoluteDiskPath(provider.BaseUrl, this.SplitPath) };
this.WorkspaceDiskPath = tmpRepo.GetDiskPath(provider.Agent.GetService<IFileOperationsExecuter>());
//this.RepositoryRelativePath = this.SourcePath.TrimStart(EmptyPathString.ToCharArray());
//this.AbsoluteDiskPath = BuildAbsoluteDiskPath(this.WorkspaceDiskPath, this.SplitPath);
this.WorkspaceName = BuildWorkspaceName(this.WorkspaceDiskPath);
}
示例2: CreateAndCloneRepoIfNecessary
private void CreateAndCloneRepoIfNecessary(SourceRepository repo)
{
string repoDiskPath = repo.GetDiskPath(this.Agent);
if (!this.Agent.DirectoryExists(repoDiskPath))
{
this.Agent.CreateDirectory(repoDiskPath);
this.GitClient.CloneRepo(repo);
}
else
{
var entry = this.Agent.GetDirectoryEntry(new GetDirectoryEntryCommand() { IncludeRootPath = false, Path = repoDiskPath, Recurse = false }).Entry;
if (entry.FlattenWithFiles().Take(2).Count() < 2)
this.GitClient.CloneRepo(repo);
}
}