Beispiel #1
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 HgPathEncoder(HgPathEncodings encodings, HgEncoder hgEncoder)
        {
            this.encodings = encodings;
            this.hgEncoder = hgEncoder;
            var t = _buildencodefun();
            encodefilename = t.Item1;
            decodefilename = t.Item2;

            foreach(var w in windowsReservedNames)
                auxdecodemap[w.Substring(0, 2) + "~" + BitConverter.ToString(new[] { (byte)w[2] }).ToLowerInvariant()  + w.Substring(3)] = w;

            auxdecodemap["~20"] = " ";
            auxdecodemap["~2e"] = ".";
        }
        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 HgChangelogReader(HgEncoder hgEncoder)
 {
     this.hgEncoder = hgEncoder;
 }
 public HgManifest(HgRevlog hgRevlog, HgRevlogReader revlogReader, HgEncoder hgEncoder) :
     base(hgRevlog, revlogReader)
 {
     this.hgEncoder = hgEncoder;
     hgManifestReader = new HgManifestReader(this.hgEncoder);
 }
        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 HgBundleReader(HgEncoder hgEncoder)
 {
     this.hgEncoder = hgEncoder;
 }
 public HgChangelog(HgRevlog revlog, HgRevlogReader revlogReader, HgEncoder hgEncoder) :
     base(revlog, revlogReader)
 {
     this.hgEncoder = hgEncoder;
     hgChangelogReader = new HgChangelogReader(this.hgEncoder);
 }
 public HgManifestWriter(HgEncoder hgEncoder)
 {
     this.hgEncoder = hgEncoder;
 }
 public HgBundleWriter(HgEncoder hgEncoder)
 {
     this.hgEncoder = hgEncoder;
 }
 public HgManifestReader(HgEncoder hgEncoder)
 {
     this.hgEncoder = hgEncoder;
 }
 public HgBundleBuilder(HgFileSystem fileSystem, HgEncoder hgEncoder, bool performIntegrityChecks = false)
 {
     this.fileSystem = fileSystem;
     this.hgEncoder = hgEncoder;
     this.performIntegrityChecks = performIntegrityChecks;
 }