Skip to content

Commit

Permalink
Reviewing transport related code against JGit commit 046198cf5f21e5a6…
Browse files Browse the repository at this point in the history
…3e8ec0ecde2ef3fe21db2eae.
  • Loading branch information
nulltoken committed Mar 14, 2010
1 parent 25bfcd7 commit 07d632c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 35 deletions.
52 changes: 26 additions & 26 deletions GitSharp.Core/Transport/TcpTransport.cs
Expand Up @@ -34,30 +34,30 @@
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

namespace GitSharp.Core.Transport
{
/// <summary>
/// The base class for transports based on TCP sockets. This class
/// holds settings common for all TCP based transports.
/// </summary>
public abstract class TcpTransport : Transport
{
/// <summary>
/// Create a new transport instance.
/// </summary>
/// <param name="local">
/// The repository this instance will fetch into, or push out of.
/// This must be the repository passed to <see cref="Transport.open(Repository, URIish)"/>.
/// </param>
/// <param name="uri">
/// the URI used to access the remote repository. This must be the
/// URI passed to <see cref="Transport.open(Repository, URIish)"/>.
/// </param>
protected TcpTransport(Repository local, URIish uri)
: base(local, uri)
{
}
}
*/

namespace GitSharp.Core.Transport
{
/// <summary>
/// The base class for transports based on TCP sockets. This class
/// holds settings common for all TCP based transports.
/// </summary>
public abstract class TcpTransport : Transport
{
/// <summary>
/// Create a new transport instance.
/// </summary>
/// <param name="local">
/// The repository this instance will fetch into, or push out of.
/// This must be the repository passed to <see cref="Transport.open(Repository, URIish)"/>.
/// </param>
/// <param name="uri">
/// the URI used to access the remote repository. This must be the
/// URI passed to <see cref="Transport.open(Repository, URIish)"/>.
/// </param>
protected TcpTransport(Repository local, URIish uri)
: base(local, uri)
{
}
}
}
47 changes: 38 additions & 9 deletions GitSharp.Core/Transport/TrackingRefUpdate.cs
Expand Up @@ -38,32 +38,45 @@

namespace GitSharp.Core.Transport
{

/// <summary>
/// Update of a locally stored tracking branch.
/// </summary>
public class TrackingRefUpdate
{
public string RemoteName { get; private set; }
private readonly RefUpdate update;

public TrackingRefUpdate(Repository db, RefSpec spec, AnyObjectId nv, string msg)
: this(db, spec.Destination, spec.Source, spec.Force, nv, msg)
{
if (spec == null)
throw new System.ArgumentNullException ("spec");
if (spec == null)
throw new System.ArgumentNullException("spec");
}

public TrackingRefUpdate(Repository db, string localName, string remoteName, bool forceUpdate, AnyObjectId nv, string msg)
{
if (db == null)
throw new System.ArgumentNullException ("db");
if (nv == null)
throw new System.ArgumentNullException ("nv");
if (db == null)
throw new System.ArgumentNullException("db");
if (nv == null)
throw new System.ArgumentNullException("nv");
RemoteName = remoteName;
update = db.UpdateRef(localName);
update.IsForceUpdate = forceUpdate;
update.NewObjectId = nv.Copy();
update.setRefLogMessage(msg, true);
}

/// <summary>
/// the name of the remote ref.
/// <para/>
/// Usually this is of the form "refs/heads/master".
/// </summary>
public string RemoteName { get; private set; }

/// <summary>
/// Get the name of the local tracking ref.
/// <para/>
/// Usually this is of the form "refs/remotes/origin/master".
/// </summary>
public string LocalName
{
get
Expand All @@ -72,6 +85,9 @@ public string LocalName
}
}

/// <summary>
/// Get the new value the ref will be (or was) updated to. Null if the caller has not configured it.
/// </summary>
public ObjectId NewObjectId
{
get
Expand All @@ -80,6 +96,17 @@ public ObjectId NewObjectId
}
}

/// <summary>
/// The old value of the ref, prior to the update being attempted.
/// <para/>
/// This value may differ before and after the update method. Initially it is
/// populated with the value of the ref before the lock is taken, but the old
/// value may change if someone else modified the ref between the time we
/// last read it and when the ref was locked for update.
/// <para/>
/// Returns the value of the ref prior to the update being attempted; null if
/// the updated has not been attempted yet.
/// </summary>
public ObjectId OldObjectId
{
get
Expand All @@ -88,6 +115,9 @@ public ObjectId OldObjectId
}
}

/// <summary>
/// the status of this update.
/// </summary>
public RefUpdate.RefUpdateResult Result
{
get
Expand All @@ -106,5 +136,4 @@ public void Delete(RevWalk.RevWalk walk)
update.delete(walk);
}
}

}

0 comments on commit 07d632c

Please sign in to comment.