我希望检测到文件不同版本的行更改,我的问题是,当我尝试获取文件的不同版本时,我总是得到最后一个版本,我该如何继续获取不同的版本
String password = "*****";
String ws_client = "****";
Repository rep;
P4Server ps = new P4Server(conStr, user, password, ws_client);
Server server = new Server(new ServerAddress(conStr));
rep = new Repository(server);
rep.Connection.UserName = user;
Options options = new Options();
Console.WriteLine(options.ToString());
Client c = new Client();
options["Password"] = password;
rep.Connection.Client = new Client();
rep.Connection.Connect(options);
rep.Connection.Login(password, options);
Console.WriteLine(rep.ToString());
string text1="";
string text2="";
P4Command cmd = new P4Command(ps);
string[]cmdargs= new string[1];
cmdargs[0] = "";
Console.WriteLine(cmd.ToString());
Console.WriteLine(ps.ToString());
Console.WriteLine(server.ToString());
// *********************************************************************
#region mrigla2 using filehistory class
FileSpec filespecs = new FileSpec(FileSpec.DepotSpec("//obms/Dot-NET/Main/FixDepthSource/SLC_FDS/clsFixEventsSource.vb").DepotPath, Revision.Head);
Options opt = new Options();
opt.Add("-m", "");
IList<FileHistory> filehistories = new List<FileHistory>();
filehistories = rep.GetFileHistory(new Options(), filespecs);
if (filehistories != null)
{
foreach (FileHistory fh in filehistories)
{
string p = fh.DepotPath.Path;
string dpath = "//obms/Dot-NET/Main/FixDepthSource/SLC_FDS/clsFixEventsSource.vb";
if (p==dpath)
{
Console.WriteLine("Client name:" + fh.ClientName);
Console.WriteLine("Description:" + fh.Description);
Console.WriteLine("username:" + fh.UserName);
Console.WriteLine("Date:" + fh.Date);
Console.WriteLine("changelist:" + fh.ChangelistId);
directoriesfile.Filedirectory fsd = Program.getpaths(p, ps);
Console.BackgroundColor = ConsoleColor.Red;
Console.WriteLine("******************revision:" + fh.Revision+"**********************");
if (fh.Revision == 6)
{ text1 = System.IO.File.ReadAllText(fsd.localPath); }
if (fh.Revision == 5)
{text2 = System.IO.File.ReadAllText(fsd.localPath); }
Console.BackgroundColor = ConsoleColor.Black;
affichcontentFile(fsd.depotPath, ps, fsd.localPath);
Console.WriteLine("Action:" + fh.Action);
}
}
}