private static void CreateRepositoryOnLocalAreaNetworkFolderIfNeededThrowIfFails(HgRepository repo, string repoProjectName, List<RepositoryAddress> sourcesToTry) { var directorySource = sourcesToTry.FirstOrDefault(s => s is DirectoryRepositorySource); if (directorySource == null) return; if (Directory.Exists(directorySource.URI) && Directory.Exists(Path.Combine(directorySource.URI, ".hg"))) { var otherRepo = new HgRepository(directorySource.URI, new NullProgress()); if (repo.Identifier == otherRepo.Identifier) return; } var actualTarget = repo.CloneLocalWithoutUpdate(directorySource.GetPotentialRepoUri(directorySource.URI, repoProjectName, new NullProgress())); if (directorySource.URI != actualTarget) { // Reset hgrc to new location. var alias = HgRepository.GetAliasFromPath(actualTarget); repo.SetTheOnlyAddressOfThisType(RepositoryAddress.Create(alias, actualTarget)); } }