Stores the binary content of a tracked file.
Inheritance: GitObject
Ejemplo n.º 1
0
 internal ContentChanges(Repository repo, Blob oldBlob, Blob newBlob, GitDiffOptions options)
 {
     Proxy.git_diff_blobs(repo.Handle,
                          oldBlob != null ? oldBlob.Id : null,
                          newBlob != null ? newBlob.Id : null,
                          options, FileCallback, HunkCallback, LineCallback);
 }
Ejemplo n.º 2
0
 /// <summary>
 ///   Show changes between two <see cref = "Blob"/>s.
 /// </summary>
 /// <param name = "oldBlob">The <see cref = "Blob"/> you want to compare from.</param>
 /// <param name = "newBlob">The <see cref = "Blob"/> you want to compare to.</param>
 /// <returns>A <see cref = "ContentChanges"/> containing the changes between the <paramref name = "oldBlob"/> and the <paramref name = "newBlob"/>.</returns>
 public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob)
 {
     using (GitDiffOptions options = BuildOptions(DiffOptions.None))
     {
         return new ContentChanges(repo, oldBlob, newBlob, options);
     }
 }
Ejemplo n.º 3
0
 internal ContentChanges(Repository repo, Blob oldBlob, Blob newBlob, GitDiffOptions options)
 {
     using (var osw1 = new ObjectSafeWrapper(oldBlob.Id, repo))
     using (var osw2 = new ObjectSafeWrapper(newBlob.Id, repo))
     {
         Ensure.Success(NativeMethods.git_diff_blobs(osw1.ObjectPtr, osw2.ObjectPtr, options, IntPtr.Zero, FileCallback, HunkCallback, LineCallback));
     }
 }
Ejemplo n.º 4
0
        private async Task ImportBuildManifestAsync(ProdConTrackerDbContext db, LibGit2Sharp.Blob blob, string branch, Commit commit, HashSet <string> loadedBuilds)
        {
            var orchBuild = BuildXmlLoader.Load(blob.GetContentText(), branch);

            // Check if the build already exists
            if (!loadedBuilds.Contains(orchBuild.OrchestratedBuildId) && !await db.OrchestratedBuilds.AnyAsync(b => b.OrchestratedBuildId == orchBuild.OrchestratedBuildId))
            {
                _logger.LogInformation("Importing build {BuildId} ...", orchBuild.OrchestratedBuildId);

                db.OrchestratedBuilds.Add(orchBuild);
                foreach (var build in orchBuild.Builds)
                {
                    db.Builds.Add(build);
                }

                _logger.LogInformation("Saving to database...");
                await db.SaveChangesAsync();
            }
        }
Ejemplo n.º 5
0
 private void AddBlob(Blob blob)
 {
     var blobVertex = new BlobVertex(blob);
     _contents.AddVertex(blobVertex);
 }
Ejemplo n.º 6
0
 public BlobVertex(Blob blob)
     : base(blob)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Show changes between two <see cref="Blob"/>s.
 /// </summary>
 /// <param name="oldBlob">The <see cref="Blob"/> you want to compare from.</param>
 /// <param name="newBlob">The <see cref="Blob"/> you want to compare to.</param>
 /// <param name="compareOptions">Additional options to define comparison behavior.</param>
 /// <returns>A <see cref="ContentChanges"/> containing the changes between the <paramref name="oldBlob"/> and the <paramref name="newBlob"/>.</returns>
 public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob, CompareOptions compareOptions = null)
 {
     using (GitDiffOptions options = BuildOptions(DiffModifiers.None, compareOptions: compareOptions))
     {
         return new ContentChanges(repo, oldBlob, newBlob, options);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 ///   Show changes between two <see cref = "Blob"/>s.
 /// </summary>
 /// <param name = "oldBlob">The <see cref = "Blob"/> you want to compare from.</param>
 /// <param name = "newBlob">The <see cref = "Blob"/> you want to compare to.</param>
 /// <returns>A <see cref = "ContentChanges"/> containing the changes between the <paramref name = "oldBlob"/> and the <paramref name = "newBlob"/>.</returns>
 public ContentChanges Compare(Blob oldBlob, Blob newBlob)
 {
     return new ContentChanges(repo, oldBlob, newBlob, DefaultOptions);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Show changes between two <see cref="Blob"/>s.
 /// </summary>
 /// <param name="oldBlob">The <see cref="Blob"/> you want to compare from.</param>
 /// <param name="newBlob">The <see cref="Blob"/> you want to compare to.</param>
 /// <returns>A <see cref="ContentChanges"/> containing the changes between the <paramref name="oldBlob"/> and the <paramref name="newBlob"/>.</returns>
 public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob)
 {
     return(Compare(oldBlob, newBlob, null));
 }
Ejemplo n.º 10
0
 internal static TreeEntryDefinition From(Blob blob, Mode mode)
 {
     return new TreeEntryDefinition
                {
                    Mode = mode,
                    Type = GitObjectType.Blob,
                    TargetId = blob.Id,
                    target = new Lazy<GitObject>(() => blob)
                };
 }