public OpenBlob ( ObjectId id ) : ObjectLoader | ||
id | ObjectId | SHA'1 of a blob |
리턴 | ObjectLoader |
/// <summary> * The constructor from object identifier /// </summary> /// <param name="base">the base configuration file </param> /// <param name="r">the repository</param> /// <param name="objectid">the object identifier</param> /// <exception cref="IOException"> /// the blob cannot be read from the repository. </exception> /// <exception cref="ConfigInvalidException"> /// the blob is not a valid configuration format. /// </exception> public BlobBasedConfig(Config @base, Repository r, ObjectId objectid) : base(@base) { ObjectLoader loader = r.OpenBlob(objectid); if (loader == null) { throw new IOException("Blob not found: " + objectid); } fromText(RawParseUtils.decode(loader.Bytes)); }
/// <summary> * The constructor from object identifier /// </summary> /// <param name="base">the base configuration file </param> /// <param name="r">the repository</param> /// <param name="objectid">the object identifier</param> /// <exception cref="IOException"> /// the blob cannot be read from the repository. </exception> /// <exception cref="ConfigInvalidException"> /// the blob is not a valid configuration format. /// </exception> public BlobBasedConfig(Config @base, Repository r, ObjectId objectid) : base(@base) { ObjectLoader loader = r.OpenBlob(objectid); if (loader == null) { throw new IOException("Blob not found: " + objectid); } fromText(RawParseUtils.decode(loader.Bytes)); }
/// <summary> * The constructor from object identifier /// </summary> /// <param name="base">the base configuration file </param> /// <param name="repo">the repository</param> /// <param name="objectid">the object identifier</param> /// <exception cref="IOException"> /// the blob cannot be read from the repository. </exception> /// <exception cref="ConfigInvalidException"> /// the blob is not a valid configuration format. /// </exception> public BlobBasedConfig(Config @base, Repository repo, ObjectId objectid) : base(@base) { if (repo == null) { throw new System.ArgumentNullException("repo"); } ObjectLoader loader = repo.OpenBlob(objectid); if (loader == null) { throw new IOException("Blob not found: " + objectid); } fromText(RawParseUtils.decode(loader.Bytes)); }
/// <summary> * The constructor from object identifier /// </summary> /// <param name="base">the base configuration file </param> /// <param name="repo">the repository</param> /// <param name="objectid">the object identifier</param> /// <exception cref="IOException"> /// the blob cannot be read from the repository. </exception> /// <exception cref="ConfigInvalidException"> /// the blob is not a valid configuration format. /// </exception> public BlobBasedConfig(Config @base, Repository repo, ObjectId objectid) : base(@base) { if (repo == null) { throw new System.ArgumentNullException("repo"); } ObjectLoader loader = repo.OpenBlob(objectid); if (loader == null) { throw new IOException("Blob not found: " + objectid); } fromText(RawParseUtils.decode(loader.Bytes)); }
/// <summary> /// Check out content of the specified index entry /// </summary> /// <param name="workDir">workdir</param> /// <param name="e">index entry</param> /// <exception cref="IOException"></exception> public void checkoutEntry(FileSystemInfo workDir, Entry e) { ObjectLoader ol = Repository.OpenBlob(e.ObjectId); byte[] bytes = ol.Bytes; var file = new FileInfo(Path.Combine(workDir.DirectoryName(), e.Name)); if (file.Exists) { file.Delete(); } file.Directory.Mkdirs(); using (var fs = new FileStream(file.FullName, System.IO.FileMode.CreateNew)) { var ms = new MemoryStream(bytes); ms.WriteTo(fs); } if (ConfigFilemode(Repository) && FileHasExecute()) { if (FileMode.ExecutableFile.Equals(e.Mode)) { if (!FileCanExecute(file)) { FileSetExecute(file, true); } } else if (FileCanExecute(file)) { FileSetExecute(file, false); } } e.Mtime = file.lastModified() * 1000000L; e.Ctime = e.Mtime; }
internal Entry(Repository repository, TreeEntry f, int stage) : this(repository) { Ctime = -1; // hmm Mtime = -1; _dev = -1; _ino = -1; Mode = f.Mode.Bits; _uid = -1; _gid = -1; try { _size = (int)Repository.OpenBlob(f.Id).Size; } catch (IOException e) { e.printStackTrace(); _size = -1; } ObjectId = f.Id; _name = Constants.encode(f.FullName); _flags = (short)((stage << 12) | _name.Length); // TODO: fix _flags }