using System;
using System.Collections.Generic;
using System.Text;
namespace P4API
{
///
/// Each P4Revision object holds details about a particular revision
/// of a file. It may also contain the history of any integrations
/// to/from the file
///
public class P4Revision
{
internal P4Revision(string depotFile, int rev, int change, string action,
string type, DateTime time, string user, string client, string desc, string digest, int filesize)
{
_depotFile = depotFile;
_rev = rev;
_change = change;
_action = action;
_type = type;
_time = time;
_user = user;
_client = client;
_desc = desc;
_digest = digest;
_filesize = filesize;
_integrations = new List();
}
internal void addIntegration(P4Integration integ)
{
_integrations.Add(integ);
}
private List _integrations;
///
/// Returns the list of P4Integration objects for this revision.
///
public IList Integrations
{
get
{
return _integrations;
}
}
private string _depotFile;
///
/// Returns the name of the depot file to which this object refers.
///
public string DepotFile
{
get
{
return _depotFile;
}
}
private string _action;
///
/// Returns the name of the action which gave rise to this revision of the file.
///
public string Action
{
get
{
return _action;
}
}
private string _type;
///
/// Returns this revision's Perforce filetype.
///
public string FileType
{
get
{
return _type;
}
}
private string _user;
///
/// Returns the name of the user who created this revision.
///
public string User
{
get
{
return _user;
}
}
private string _client;
///
/// Returns the name of the client from which this revision was submitted.
///
public string Client
{
get
{
return _client;
}
}
private string _digest;
///
/// Returns the MD5 checksum of this revision.
///
public string Digest
{
get
{
return _digest;
}
}
private string _desc;
///
/// Returns the description of the change which created this revision.
///
///
/// Note that only the first 31 characters are returned unless you use p4 filelog -L for the first 250 characters, or p4 filelog -l for the full text.
///
public string Description
{
get
{
return _desc;
}
}
private int _rev;
///
/// Returns the number of this revision of the file.
///
public int Rev
{
get
{
return _rev;
}
}
private int _change;
///
/// Returns the change number that gave rise to this revision of the file.
///
public int Change
{
get
{
return _change;
}
}
private int _filesize;
///
/// Returns this revision's size in bytes.
///
public int FileSize
{
get
{
return _filesize;
}
}
private DateTime _time;
///
/// Returns the date/time that this revision was created.
///
public DateTime Time
{
get
{
return _time;
}
}
///
/// Representation of the P4Revision
///
/// String representation of the revision record.
public override string ToString()
{
return string.Format("Revision (depotFile = {0} rev = {1} change = {2} action = {3} type = {4} time = {5} user = {6} client = {7})",
_depotFile, _rev, _change, _action, _type, _time, _user, _client);
}
}
}