public static void EnsureRepository(IRepositoryManager repositoryManager, RepositoryType expectedType) { RepositoryType currentType = repositoryManager.GetRepositoryType(); if (currentType == RepositoryType.None) { repositoryManager.CreateRepository(expectedType); } else if (currentType != expectedType) { throw new InvalidOperationException("Unexpected repository type: " + currentType); } }
public ActionResult Create(RepositoryType type) { try { _repositoryManager.CreateRepository(type); return(Redirect("~/Hubs/SourceControl/index.htm")); } catch (Exception e) { ModelState.AddModelError("_FORM", e.Message); } PopulateRepositoyTypes(); return(View("Index", RepositoryType.None)); }
public void CreateModule(IRepositoryManager repositoryManager, ModuleState moduleState, Moduni.BranchVersion version) { Task <ISourceControlRepository> creationTask = repositoryManager.CreateRepository(moduleState.Name); creationTask.Wait(); ISourceControlRepository remoteRepository = creationTask.Result; ISourceControlRepository projectRepository = remoteRepository.InitOrCloneRepository(moduleState.Path); IModule module = this.moduleFactory.CreateModuleFromRepository(projectRepository); module.CurrentState = moduleState; module.SaveMetadata(); module.PublishChanges("feat(Global): initial commit of the module"); module.PublishVersion(version); module.CreateBaseBranches(); this.projectModules.Add(module); if (this.projectRepository != null) { this.projectRepository.AddSubmodule(module.Path, module.RepositoryURL); this.projectRepository.StageFile(projectRepository.RepositoryURL.Remove(projectRepository.RepositoryURL.Length - 1, 1)); } this.modules.Add(new Tuple <IRepositoryManager, IModule>(repositoryManager, this.moduleFactory.CreateModuleFromRepository(remoteRepository))); module.CheckoutBranchVersion(new BranchVersion("master")); if (this.OnModulesUpdated != null) { this.OnModulesUpdated(this.modules); } if (this.OnProjectModulesUpdated != null) { this.OnProjectModulesUpdated(this.projectModules); } if (this.OnMessageTriggered != null) { this.OnMessageTriggered(new Message(string.Format("Module ({0}) {1} created successfully !", repositoryManager.Name, module.Name), MessageType.Info)); } }
public void Create(RepositoryType type) { _repositoryManager.CreateRepository(type); }