public Module(ISourceControlRepository sourceControlRepository) { this.repository = sourceControlRepository; this.Initialize(); if (string.IsNullOrEmpty(this.repository.CurrentCommit)) { return; } string branchVersion = this.repository.CurrentBranch; if (string.IsNullOrEmpty(branchVersion)) { branchVersion = "master"; } else if (branchVersion == "(no branch)") { branchVersion = this.repository.GetNearestTagFromCommit(this.repository.CurrentCommit); } this.CurrentBranchVersion = new BranchVersion(branchVersion); if (Directory.Exists(this.Path)) { this.fileSystemWatcher = new FileSystemWatcher(this.Path); this.fileSystemWatcher.NotifyFilter = NotifyFilters.Size; this.fileSystemWatcher.Changed += this.OnFileSystemUpdated; this.fileSystemWatcher.Created += this.OnFileSystemUpdated; this.fileSystemWatcher.Deleted += this.OnFileSystemUpdated; this.fileSystemWatcher.Renamed += this.OnFileSystemUpdated; this.fileSystemWatcher.EnableRaisingEvents = true; } }
public Task <IEnumerable <ISourceControlRepository> > GetRepositories() { return(Task.Factory.StartNew <IEnumerable <ISourceControlRepository> >(() => { string[] repositoriesPaths = Directory.GetDirectories(this.settings.folderPath, "*.git", SearchOption.TopDirectoryOnly); ISourceControlRepository[] repositories = new ISourceControlRepository[repositoriesPaths.Length]; for (int i = 0; i < repositoriesPaths.Length; i++) { repositories[i] = new GitRepository(repositoriesPaths[i]); } return repositories; })); }
void DiscoverProjectModules() { this.projectModules = new List <IModule>(); string[] gitFiles = Directory.GetFiles(Application.dataPath, ".git", SearchOption.AllDirectories); string repositoryDirectory; foreach (string gitFile in gitFiles) { repositoryDirectory = new FileInfo(gitFile).Directory.FullName; if (Directory.GetFileSystemEntries(repositoryDirectory).Any((string file) => file.Contains(Module.ModuleMetadataFilename))) { ISourceControlRepository sourceControlRepository = this.repositoryFactory.CreateRepository(repositoryDirectory); this.projectModules.Add(this.moduleFactory.CreateModuleFromRepository(sourceControlRepository)); } } }
public Task DeleteRepository(ISourceControlRepository repositoryToDelete) { return(Task.Factory.StartNew(() => { IRestRequest restRequest = new RestRequest("/rest/api/1.0/projects/" + this.settings.projectKey + "/repos/" + repositoryToDelete.Name, Method.DELETE); IRestResponse restResponse = this.restClient.Execute(restRequest); switch (restResponse.ResponseStatus) { case ResponseStatus.Completed: return; case ResponseStatus.Error: throw new Exception(restResponse.StatusCode.ToString() + ": " + restResponse.ErrorMessage); } return; })); }
public ArhiveResult Archive(int sourceControlVersionId) { AspNetDeployEntities entities = new AspNetDeployEntities(); SourceControlVersion sourceControlVersion = entities.SourceControlVersion .Include("Properties") .First(sc => sc.Id == sourceControlVersionId); ISourceControlRepository repository = this.sourceControlRepositoryFactory.Create(sourceControlVersion.SourceControl.Type); string sourcesFolder = this.pathServices.GetSourceControlVersionPath(sourceControlVersion.SourceControlId, sourceControlVersion.Id); repository.Archive(sourceControlVersion, sourcesFolder); sourceControlVersion.ArchiveState = SourceControlVersionArchiveState.Archived; entities.SaveChanges(); return(new ArhiveResult() { IsSuccess = true }); }
public TestSourceResult TestConnection(SourceControlVersion sourceControlVersion) { ISourceControlRepository repository = this.sourceControlRepositoryFactory.Create(sourceControlVersion.SourceControl.Type); return(repository.TestConnection(sourceControlVersion)); /*string sourcesFolder = this.pathServices.GetSourceControlVersionPath(sourceControlVersion.SourceControl.Id, sourceControlVersion.Id); * string revisionId = null; * string exceptionMessage = null; * * ISourceControlRepository repository = this.sourceControlRepositoryFactory.Create(sourceControlVersion.SourceControl.Type); * repository.Archive(sourceControlVersion, sourcesFolder); * * Task.Run(() => * { * try * { * LoadSourcesResult loadSourcesResult = this.LoadSources(sourceControlVersion, sourcesFolder); * revisionId = loadSourcesResult.RevisionId; * } * catch (AspNetDeployException e) * { * exceptionMessage = e.InnerException.Message; * } * }).Wait(1000); * * * * * return new TestSourceResult() * { * IsSuccess = revisionId != null, * ErrorMessage = exceptionMessage * };*/ return(new TestSourceResult { IsSuccess = true }); }
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 TextAdornment(IWpfTextView view) { SourceControlRepo = TeamCodingPackage.Current.SourceControlRepo; OpenFilesFilter = of => of.Repository.Equals(RepoDocument.RepoUrl, StringComparison.OrdinalIgnoreCase) && of.RelativePath.Equals(RepoDocument.RelativePath, StringComparison.OrdinalIgnoreCase) && (TeamCodingPackage.Current.Settings.UserSettings.ShowAllBranches || of.RepositoryBranch == RepoDocument.RepoBranch) && of.CaretPositionInfo != null; View = view ?? throw new ArgumentNullException(nameof(view)); Layer = view.GetAdornmentLayer("TextAdornment"); RepoDocument = SourceControlRepo.GetRepoDocInfo(View.TextBuffer.GetTextDocumentFilePath()); TeamCodingPackage.Current.RemoteModelChangeManager.RemoteModelReceived += RefreshAdornmentsAsync; TeamCodingPackage.Current.Settings.UserSettings.UserCodeDisplayChanged += UserSettings_UserCodeDisplayChangedAsync; View.LayoutChanged += OnLayoutChanged; var penBrush = new SolidColorBrush(Colors.Red); penBrush.Freeze(); CaretPen = new Pen(penBrush, 1); CaretPen.Freeze(); }
/// <summary> /// Creates a clone of the source control repository that this module uses at the path specified in the argument. /// </summary> /// <returns>The clone of the module's repository.</returns> /// <param name="pathToWorkingDirectory">The path to the working directory where the repository should be cloned.</param> public ISourceControlRepository CloneRepository(string pathToWorkingDirectory) { ISourceControlRepository clonedRepository = this.repository.InitOrCloneRepository(pathToWorkingDirectory); return(clonedRepository); }
private LoadSourcesInfoResult LoadSourcesInfo(SourceControlVersion sourceControlVersion, string sourcesFolder) { ISourceControlRepository repository = this.sourceControlRepositoryFactory.Create(sourceControlVersion.SourceControl.Type); return(repository.LoadSourcesInfo(sourceControlVersion, sourcesFolder)); }
public Task DeleteRepository(ISourceControlRepository repositoryToDelete) { throw new NotImplementedException(); }
public IModule CreateModuleFromRepository(ISourceControlRepository sourceControlRepository) { IModule module = new Module(sourceControlRepository); return(module); }
void DiscoverSourceControlProjectRepository() { this.projectRepository = this.repositoryFactory.DiscoverRepository(Application.dataPath); }