Beispiel #1
0
		public override void Select(StoredObjectRepresentation @ref)
		{
			LocalObjectRepresentation ptr = (LocalObjectRepresentation)@ref;
			this.pack = ptr.pack;
			this.offset = ptr.offset;
			this.length = ptr.length;
		}
Beispiel #2
0
 /// <summary>Determine if this pack contains the object representation given.</summary>
 /// <remarks>
 /// Determine if this pack contains the object representation given.
 /// <p>
 /// PackWriter uses this method during the finding sources phase to prune
 /// away any objects from the leading thin-pack that already appear within
 /// this pack and should not be sent twice.
 /// <p>
 /// Implementors are strongly encouraged to rely on looking at
 /// <code>rep</code>
 /// only and using its internal state to decide if this object is within this
 /// pack. Implementors should ensure a representation from this cached pack
 /// is tested as part of
 /// <see cref="ObjectReuseAsIs.SelectObjectRepresentation(PackWriter, NGit.ProgressMonitor, Sharpen.Iterable{T})
 ///     ">ObjectReuseAsIs.SelectObjectRepresentation(PackWriter, NGit.ProgressMonitor, Sharpen.Iterable&lt;T&gt;)
 ///     </see>
 /// , ensuring this method would eventually return true if the object would
 /// be included by this cached pack.
 /// </remarks>
 /// <param name="obj">the object being packed. Can be used as an ObjectId.</param>
 /// <param name="rep">
 /// representation from the
 /// <see cref="ObjectReuseAsIs">ObjectReuseAsIs</see>
 /// instance that
 /// originally supplied this CachedPack.
 /// </param>
 /// <returns>true if this pack contains this object.</returns>
 public abstract bool HasObject(ObjectToPack obj, StoredObjectRepresentation rep);
 /// <summary>Remember a specific representation for reuse at a later time.</summary>
 /// <remarks>
 /// Remember a specific representation for reuse at a later time.
 /// <p>
 /// Implementers should remember the representation chosen, so it can be
 /// reused at a later time.
 /// <see cref="PackWriter">PackWriter</see>
 /// may invoke this method
 /// multiple times for the same object, each time saving the current best
 /// representation found.
 /// </remarks>
 /// <param name="ref">the object representation.</param>
 public virtual void Select(StoredObjectRepresentation @ref)
 {
 }
Beispiel #4
0
		/// <summary>Determine if this pack contains the object representation given.</summary>
		/// <remarks>
		/// Determine if this pack contains the object representation given.
		/// <p>
		/// PackWriter uses this method during the finding sources phase to prune
		/// away any objects from the leading thin-pack that already appear within
		/// this pack and should not be sent twice.
		/// <p>
		/// Implementors are strongly encouraged to rely on looking at
		/// <code>rep</code>
		/// only and using its internal state to decide if this object is within this
		/// pack. Implementors should ensure a representation from this cached pack
		/// is tested as part of
		/// <see cref="ObjectReuseAsIs.SelectObjectRepresentation(PackWriter, NGit.ProgressMonitor, Sharpen.Iterable{T})
		/// 	">ObjectReuseAsIs.SelectObjectRepresentation(PackWriter, NGit.ProgressMonitor, Sharpen.Iterable&lt;T&gt;)
		/// 	</see>
		/// , ensuring this method would eventually return true if the object would
		/// be included by this cached pack.
		/// </remarks>
		/// <param name="obj">the object being packed. Can be used as an ObjectId.</param>
		/// <param name="rep">
		/// representation from the
		/// <see cref="ObjectReuseAsIs">ObjectReuseAsIs</see>
		/// instance that
		/// originally supplied this CachedPack.
		/// </param>
		/// <returns>true if this pack contains this object.</returns>
		public abstract bool HasObject(ObjectToPack obj, StoredObjectRepresentation rep);
Beispiel #5
0
		/// <summary>Remember a specific representation for reuse at a later time.</summary>
		/// <remarks>
		/// Remember a specific representation for reuse at a later time.
		/// <p>
		/// Implementers should remember the representation chosen, so it can be
		/// reused at a later time.
		/// <see cref="PackWriter">PackWriter</see>
		/// may invoke this method
		/// multiple times for the same object, each time saving the current best
		/// representation found.
		/// </remarks>
		/// <param name="ref">the object representation.</param>
		public virtual void Select(StoredObjectRepresentation @ref)
		{
		}
Beispiel #6
0
		public override bool HasObject(ObjectToPack obj, StoredObjectRepresentation rep)
		{
			try
			{
				LocalObjectRepresentation local = (LocalObjectRepresentation)rep;
				foreach (PackFile pack in GetPacks())
				{
					if (local.pack == pack)
					{
						return true;
					}
				}
				return false;
			}
			catch (FileNotFoundException)
			{
				return false;
			}
		}