clone: verify if tfs path exists
This commit is contained in:
@@ -653,5 +653,9 @@ namespace Sep.Git.Tfs.VsCommon
|
||||
|
||||
}
|
||||
|
||||
public bool IsExistingInTfs(string path)
|
||||
{
|
||||
return VersionControl.ServerItemExists(path, ItemType.Any);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +375,11 @@ namespace Sep.Git.Tfs.VsFake
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsExistingInTfs(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,11 @@ namespace Sep.Git.Tfs.Commands
|
||||
if (initBranch != null)
|
||||
{
|
||||
var remote = globals.Repository.ReadTfsRemote(GitTfsConstants.DefaultRepositoryId);
|
||||
|
||||
if (!remote.Tfs.IsExistingInTfs(tfsRepositoryPath))
|
||||
throw new GitTfsException("error: the path " + tfsRepositoryPath + " you want to clone doesn't exist!")
|
||||
.WithRecommendation("To discover which branch to clone, you could use the command :\ngit tfs list-remote-branches " + remote.TfsUrl);
|
||||
|
||||
if (!remote.Tfs.CanGetBranchInformation)
|
||||
return;
|
||||
var tfsTrunkRepository = remote.Tfs.GetRootTfsBranchForRemotePath(tfsRepositoryPath, false);
|
||||
|
||||
@@ -33,5 +33,6 @@ namespace Sep.Git.Tfs.Core.TfsInterop
|
||||
IEnumerable<IBranchObject> GetBranches();
|
||||
void EnsureAuthenticated();
|
||||
void CreateBranch(string sourcePath, string targetPath, int changesetId, string comment = null);
|
||||
bool IsExistingInTfs(string path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user