/// <summary> /// Creates a version control system associated with a directory. /// </summary> /// <param name="root">The root of the version control system relative to the file system.</param> /// <param name="fileSystemAdaptee"> The PieFileSystem to operate on</param> public VersionControlSystem(String root, IPieFileSystem fileSystemAdaptee) : base(root, fileSystemAdaptee) { FileSystemAdaptee = fileSystemAdaptee; // Make sure the cache dir exists var cache = root + FileSystem.CACHE_DIR; if (!Exists(cache)) { CreateDirectory(cache); } _cache = new Cache(this); }
//private static readonly Object StateLock = new object(); /// <summary> /// Initializes the repository by searching for the vcsRoot of the file system in the configuration and initializing /// a FileSystemAdaptee, Cache and Config to keep track of the files under the repository structure. /// </summary> /// <exception cref="KeyNotFoundException">If the root directory could not be found</exception> private Repository() { // Read the config Config = Config.GetInstance(); String root = Config["rootDirectory"]; // Init file system FileSystem = new PieFileSystem(new FileSystem(root), this); // Create .pie folder if it does not exist if (!FileSystem.Exists(InputOutputLayer.FileSystem.META_DIR)) { FileSystem.CreateDirectory(InputOutputLayer.FileSystem.META_DIR); } // Verify cache var vcs = new VersionControlSystem("", FileSystem); var cache = new Cache(vcs); cache.Verify(); }