protected override void OnTestRepositoryDeployed() { base.OnTestRepositoryDeployed(); if (Directory.Exists(ClonedRepoFolder)) { Directory.Delete(ClonedRepoFolder, true); } Directory.CreateDirectory(ClonedRepoFolder); _repositiory = new MercurialSDK.Repository(ClonedRepoFolder); _repositiory.Clone(LocalRepositoryPath, new CloneCommand()); }
private Repository GetClient(ISourceControlConnectionSettingsSource settings) { var repositoryFolder = GetLocalRepository(settings); if (IsRepositoryUriChanged(repositoryFolder, settings)) { repositoryFolder.Delete(); repositoryFolder = MercurialRepositoryFolder.Create(settings.Uri); _folder.ReplaceWith(repositoryFolder); } Repository repository; try { if (repositoryFolder.Exists()) { string path = repositoryFolder.GetAbsolutePath(); repository = new Repository(path, new NonPersistentClientFactory()); repository.Pull(settings.Uri); } else { string path = repositoryFolder.GetAbsolutePath(); Directory.CreateDirectory(path); CloneCommand cloneCommand = new CloneCommand().WithUpdate(false); repository = new Repository(path, new NonPersistentClientFactory()); repository.Clone(settings.Uri, cloneCommand); } } catch (ArgumentNullException e) { throw new ArgumentException( MercurialCheckConnectionErrorResolver.INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE, e); } catch (FileNotFoundException e) { throw new ArgumentException( MercurialCheckConnectionErrorResolver.INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE, e); } catch (MercurialMissingException e) { throw new ArgumentException( MercurialCheckConnectionErrorResolver.MERCURIAL_IS_NOT_INSTALLED_ERROR_MESSAGE, e); } return(repository); }
public MercurialClient(ISourceControlConnectionSettingsSource settings, IStorage<MercurialRepositoryFolder> folder) { _settings = settings; _folder = folder; _repository = GetClient(settings); }
private Repository GetClient(ISourceControlConnectionSettingsSource settings) { var repositoryFolder = GetLocalRepository(settings); if (IsRepositoryUriChanged(repositoryFolder, settings)) { repositoryFolder.Delete(); repositoryFolder = MercurialRepositoryFolder.Create(settings.Uri); _folder.ReplaceWith(repositoryFolder); } Repository repository; try { if (repositoryFolder.Exists()) { string path = repositoryFolder.GetAbsolutePath(); repository = new Repository(path, new NonPersistentClientFactory()); repository.Pull(settings.Uri); } else { string path = repositoryFolder.GetAbsolutePath(); Directory.CreateDirectory(path); CloneCommand cloneCommand = new CloneCommand().WithUpdate(false); repository = new Repository(path, new NonPersistentClientFactory()); repository.Clone(settings.Uri, cloneCommand); } } catch (ArgumentNullException e) { throw new ArgumentException( MercurialCheckConnectionErrorResolver.INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE, e); } catch (FileNotFoundException e) { throw new ArgumentException( MercurialCheckConnectionErrorResolver.INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE, e); } catch (MercurialMissingException e) { throw new ArgumentException( MercurialCheckConnectionErrorResolver.MERCURIAL_IS_NOT_INSTALLED_ERROR_MESSAGE, e); } return repository; }
public MercurialClient(ISourceControlConnectionSettingsSource settings) { _settings = settings; _repository = GetClient(settings); }
public MercurialClient(ISourceControlConnectionSettingsSource settings, IStorage <MercurialRepositoryFolder> folder) { _settings = settings; _folder = folder; _repository = GetClient(settings); }