Exemplo n.º 1
0
        /// <summary>Update this snapshot when the content hasn't changed.</summary>
        /// <remarks>
        /// Update this snapshot when the content hasn't changed.
        /// <p>
        /// If the caller gets true from
        /// <see cref="IsModified(Sharpen.FilePath)">IsModified(Sharpen.FilePath)</see>
        /// , re-reads the
        /// content, discovers the content is identical, and
        /// <see cref="Equals(FileSnapshot)">Equals(FileSnapshot)</see>
        /// is true, it can use
        /// <see cref="SetClean(FileSnapshot)">SetClean(FileSnapshot)</see>
        /// to make a future
        /// <see cref="IsModified(Sharpen.FilePath)">IsModified(Sharpen.FilePath)</see>
        /// return false. The logic goes something like
        /// this:
        /// <pre>
        /// if (snapshot.isModified(path)) {
        /// FileSnapshot other = FileSnapshot.save(path);
        /// Content newContent = ...;
        /// if (oldContent.equals(newContent) &amp;&amp; snapshot.equals(other))
        /// snapshot.setClean(other);
        /// }
        /// </pre>
        /// </remarks>
        /// <param name="other">the other snapshot.</param>
        public virtual void SetClean(NGit.Storage.File.FileSnapshot other)
        {
            long now = other.lastRead;

            if (NotRacyClean(now))
            {
                cannotBeRacilyClean = true;
            }
            lastRead = now;
        }
Exemplo n.º 2
0
 /// <summary>Compare two snapshots to see if they cache the same information.</summary>
 /// <remarks>Compare two snapshots to see if they cache the same information.</remarks>
 /// <param name="other">the other snapshot.</param>
 /// <returns>true if the two snapshots share the same information.</returns>
 public virtual bool Equals(NGit.Storage.File.FileSnapshot other)
 {
     return(lastModified == other.lastModified);
 }