/// <summary> /// Create a factory /// Throws ArgumentException if passed ParentFolder does not exist and cannot be created /// </summary> public LocalCommitStorageFactory( string parentFolder, ISynchronizeInvoke synchronizeInvoke, ProjectAccessor projectAccessor, IFileStorageProperties properties) { if (!Directory.Exists(parentFolder)) { try { Directory.CreateDirectory(parentFolder); } catch (Exception ex) // Any exception from Directory.CreateDirectory() { throw new ArgumentException(String.Format("Cannot create folder \"{0}\"", parentFolder), ex); } } ParentFolder = parentFolder; _synchronizeInvoke = synchronizeInvoke ?? throw new ArgumentException("synchronizeInvoke argument cannot be null"); _projectAccessor = projectAccessor ?? throw new ArgumentException("projectAccessor argument cannot be null"); _properties = properties; Trace.TraceInformation(String.Format( "[LocalCommitStorageFactory] Created a factory for parentFolder {0}", parentFolder)); }
/// <summary> /// </summary> internal FileStorageUpdater( ISynchronizeInvoke synchronizeInvoke, IFileStorage fileStorage, RepositoryAccessor repositoryAccessor, IFileStorageProperties properties) { _synchronizeInvoke = synchronizeInvoke; _fileStorage = fileStorage; _repositoryAccessor = repositoryAccessor; _properties = properties; }
// @} IFileStorage /// <summary> /// </summary> internal FileStorage(string parentFolder, ProjectKey projectKey, ISynchronizeInvoke synchronizeInvoke, RepositoryAccessor repositoryAccessor, IFileStorageProperties properties) { Path = LocalCommitStoragePathFinder.FindPath(parentFolder, projectKey, LocalCommitStorageType.FileStorage); ProjectKey = projectKey; FileStorageUtils.InitalizeFileStorage(Path, ProjectKey); ComparisonCache = new FileStorageComparisonCache(Path, properties.GetComparisonCountToKeep()); FileCache = new FileStorageRevisionCache(Path, properties.GetRevisionCountToKeep()); DiffCache = new FileStorageDiffCache(Path, this); _updater = new FileStorageUpdater(synchronizeInvoke, this, repositoryAccessor, properties); _processManager = new GitProcessManager(synchronizeInvoke, Path); _commandService = new FileStorageGitCommandService(_processManager, Path, this); Trace.TraceInformation(String.Format( "[FileStorage] Created FileStorage at Path {0} for host {1}, project {2}, ", Path, projectKey.HostName, projectKey.ProjectName)); }