public HgBookmarkManager(HgRepository repository, HgFileSystem fileSystem)
        {
            this.repository = repository;
            this.fileSystem = fileSystem;

            bookmarksPath = Alphaleonis.Win32.Filesystem.Path.Combine(repository.BasePath, "bookmarks");
        }
        public HgRevlogWriter(HgRevlog revlog, HgFileSystem fileSystem)
        {
            this.revlog = revlog;
            this.fileSystem = fileSystem;

            revlogReader = new HgRevlogReader(revlog, fileSystem);
        }
Example #3
0
        public HgStore(HgEncoder hgEncoder, string storeBasePath, HgFileSystem fileSystem)
        {
            Encoder = hgEncoder;
            
            this.storeBasePath = storeBasePath;
            this.fileSystem = fileSystem;

            hgPathEncoder = new HgPathEncoder(HgPathEncodings.None, hgEncoder);
        }
        public HgStore CreateInstance(string storeBasePath, HgRequirements hgRequirements, HgFileSystem hgFileSystem, HgEncoder hgEncoder)
        {
            var hgStore = CreateInstanceInternal(storeBasePath, hgRequirements, hgFileSystem, hgEncoder);
            
            if(hgRequirements.Requires(HgRequirements.Largefiles))
                hgStore = new HgLargefileEnabledStore(hgStore);

            return hgStore;
        }
        public HgFnCacheStore(HgPathEncodings encodings, HgEncoder hgEncoder, string storeBasePath, HgFileSystem fileSystem) :
            base(hgEncoder, storeBasePath, fileSystem)
        {
            fnCacheFilePath = Path.Combine(StoreBasePath, "fncache");
            hgPathEncoder = new HgPathEncoder(encodings, hgEncoder);

            if(File.Exists(fnCacheFilePath))
            {
                var fnCacheEntries =
                    File.ReadAllText(fnCacheFilePath, hgEncoder.Local).
                        Split('\n').
                        Select(n => HgPathEncoder.DecodeDirectory(n.Trim()));

                fnCache = new List<string>(fnCacheEntries);
            } // if
            else
                fnCache = new List<string>();
        }
        private HgStore CreateInstanceInternal(string storeBasePath, HgRequirements hgRequirements, HgFileSystem hgFileSystem, HgEncoder hgEncoder)
        {
            log.Trace("creating HgStore with requirements '{0}' for repository at '{1}'", string.Join("', '", hgRequirements.Requirements), storeBasePath);

            if(hgRequirements.Requires(HgRequirements.Store))
            {
                if(hgRequirements.Requires(HgRequirements.FnCache))
                {
                    log.Trace("creating HgFnCacheStore");

                    var encodings = HgPathEncodings.FnCache;
                    if(hgRequirements.Requires(HgRequirements.DotEncode))
                        encodings |= HgPathEncodings.DotEncode;

                    return new HgFnCacheStore(encodings, hgEncoder, storeBasePath, hgFileSystem);
                } // if

                log.Trace("creating HgEncodedStore");
                return new HgEncodedStore(hgEncoder, storeBasePath, hgFileSystem);
            }
            
            log.Trace("creating HgBasicStore");
            return new HgBasicStore(hgEncoder, storeBasePath, hgFileSystem);
        }
        public HgRepository(string path, HgEncoder hgEncoder)
        {
            Encoder = hgEncoder;

            basePath = path.ToLowerInvariant().EndsWith(".hg") ? 
                path : 
                Path.Combine(path, ".hg");
            var storeBasePath = Path.Combine(basePath, "store");
            FullPath = new Alphaleonis.Win32.Filesystem.DirectoryInfo(basePath).Parent.FullName;

            fileSystem = new HgFileSystem();
            atomicFileSystem = new HgTransactionalFileSystem();

            Requirements = new HgRequirementsReader(fileSystem).ReadRequirements(Path.Combine(basePath, "requires"));

            store = new HgStoreFactory().CreateInstance(storeBasePath, Requirements, fileSystem, Encoder);
            branchManager = new HgBranchManager(this, fileSystem);
            bookmarkManager = new HgBookmarkManager(this, fileSystem);

            //
            // Make sure it looks more or less like a repository.
            if(!Directory.Exists(basePath)) throw new IOException(basePath);

            var hgRcReader = new HgRcReader();
            var hgRc = hgRcReader.ReadHgRc(Path.Combine(basePath, "hgrc"));
            Rc = hgRc;

            tagManager = new HgTagManager(this, fileSystem);
        }
 public HgRequirementsReader(HgFileSystem fileSystem)
 {
     this.fileSystem = fileSystem;
 }
 public HgTagManager(HgRepository repository, HgFileSystem fileSystem)
 {
     this.repository = repository;
     this.fileSystem = fileSystem;
 }
 public HgBundleBuilder(HgFileSystem fileSystem, HgEncoder hgEncoder, bool performIntegrityChecks = false)
 {
     this.fileSystem = fileSystem;
     this.hgEncoder = hgEncoder;
     this.performIntegrityChecks = performIntegrityChecks;
 }