本文整理汇总了C#中SvnClient.GetInfo方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.GetInfo方法的具体用法?C# SvnClient.GetInfo怎么用?C# SvnClient.GetInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.GetInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComposeForUrl
public string ComposeForUrl(string branchUrl, long revision)
{
// get props
using (_client = new SvnClient())
{
SvnInfoEventArgs info;
_client.GetInfo(new SvnUriTarget(branchUrl, new SvnRevision(revision)), out info);
_cancellationToken.ThrowIfCancellationRequested();
_repoRoot = info.RepositoryRoot;
_requestedMergeMessageForBranch = "/" + info.Path.Trim('/') + "/";
var mergedRevisions = GetMergedRevisions(branchUrl, revision);
LoadLogEntries(mergedRevisions);
return BuildMessage(mergedRevisions);
}
}
示例2: getDiff
public static void getDiff(int lastVersion)
{
using (SvnClient client = new SvnClient())
{
client.Authentication.UserNamePasswordHandlers +=
new EventHandler<SvnUserNamePasswordEventArgs>(
delegate (object s, SvnUserNamePasswordEventArgs e)
{
e.UserName = "yun.bo";
e.Password = "boyun";
});
SvnInfoEventArgs clientInfo;
string path = @"http://test10.svn.7road-inc.com/svn/Mobilephone_SRC/Mobilephone_DDT/trunk/Client/Develop/Resource";
client.GetInfo(path, out clientInfo);
int i = 0;
}
}
示例3: ExecuteCommand
/// <summary>
/// Actual method to be executed for the implementing task
/// </summary>
/// <param name="client">The instance of the SVN client</param>
/// <returns></returns>
public override bool ExecuteCommand(SvnClient client)
{
SvnTarget target = new SvnPathTarget(RepositoryPath);
SvnInfoArgs args = new SvnInfoArgs();
Collection<SvnInfoEventArgs> infoResult = new Collection<SvnInfoEventArgs>();
bool result = client.GetInfo(target, args, out infoResult);
SvnInfoEventArgs info = infoResult[0];
Revision = info.Revision;
RepositoryId = info.RepositoryId;
NodeKind = info.NodeKind.ToString();
Schedule = info.Schedule.ToString();
LastChangedRevision = info.LastChangeRevision;
LastChangedAuthor = info.LastChangeAuthor;
LastChangeDate = info.LastChangeTime;
return result;
}
示例4: Update
public static string Update(string url, Log log, string directory)
{
if (string.IsNullOrWhiteSpace(url))
{
Utility.Log(LogStatus.Skipped, "Updater", string.Format("No Url specified - {0}", url), log);
}
else
{
try
{
var dir = Path.Combine(directory, url.GetHashCode().ToString("X"));
using (var client = new SvnClient())
{
var cleanUp = false;
client.Conflict +=
delegate(object sender, SvnConflictEventArgs eventArgs)
{
eventArgs.Choice = SvnAccept.TheirsFull;
};
client.Status(
dir, new SvnStatusArgs { ThrowOnError = false },
delegate(object sender, SvnStatusEventArgs args)
{
if (args.Wedged)
{
cleanUp = true;
}
});
if (cleanUp)
{
client.CleanUp(dir);
}
try
{
if (Directory.Exists(dir))
{
SvnInfoEventArgs remoteVersion;
var b1 = client.GetInfo(new Uri(url), out remoteVersion);
SvnInfoEventArgs localVersion;
var b2 = client.GetInfo(dir, out localVersion);
if (b1 && b2 && remoteVersion.Revision == localVersion.Revision)
{
Utility.Log(
LogStatus.Ok, "Updater", string.Format("Update not needed - {0}", url), log);
return dir;
}
}
}
catch (Exception ex)
{
Utility.Log(LogStatus.Error, "Updater", string.Format("{0} - {1}", ex, url), log);
}
client.CheckOut(new Uri(url), dir);
client.Update(dir);
Utility.Log(LogStatus.Ok, "Updater", string.Format("Updated - {0}", url), log);
}
return dir;
}
catch (SvnException ex)
{
Utility.Log(LogStatus.Error, "Updater", string.Format("{0} - {1}", ex.RootCause, url), log);
}
catch (Exception ex)
{
Utility.Log(LogStatus.Error, "Updater", string.Format("{0} - {1}", ex.Message, url), log);
}
}
return string.Empty;
}
示例5: ComposeForPath
public string ComposeForPath(string wc)
{
// find root (where .svn reside)
var wcRoot = SvnUtils.FindSvnWC(wc);
if (wcRoot == null)
throw new ApplicationException("Can't find working copy root for " + wc);
using (_client = new SvnClient())
{
var wcTarg = new SvnPathTarget(wcRoot);
SvnInfoEventArgs info;
_client.GetInfo(wcTarg, out info);
_cancellationToken.ThrowIfCancellationRequested();
_repoRoot = info.RepositoryRoot;
_requestedMergeMessageForBranch = "/" + info.Path.Trim('/') + "/";
SvnTargetPropertyCollection mergeInfoPre;
if (!_client.GetProperty(wcTarg, "svn:mergeinfo", new SvnGetPropertyArgs { Revision = SvnRevision.Base }, out mergeInfoPre))
throw new ApplicationException("Error in GetProperty");
string mergeInfoNew;
if (!_client.GetProperty(wcTarg, "svn:mergeinfo", out mergeInfoNew))
throw new ApplicationException("Error in GetProperty");
var baseMergeInfo = new Dictionary<string, RevRangeSet>();
if (mergeInfoPre != null && mergeInfoPre.Count != 0)
{
baseMergeInfo = ParseMegeinfoLines(mergeInfoPre[0].StringValue);
}
var currentMergeInfo = ParseMegeinfoLines(mergeInfoNew);
var newRevs = Subtract(currentMergeInfo, baseMergeInfo);
LoadLogEntries(newRevs);
return BuildMessage(newRevs);
}
}
示例6: SvnDriver
public SvnDriver(string workingCopy, TextWriter log)
{
_log = log;
_wc = workingCopy;
if(!Directory.Exists(_wc))
throw new ApplicationException("Working copy does not exists: " + _wc);
if (!Directory.Exists(Path.Combine(_wc, ".svn")))
throw new ApplicationException("Working copy has no .svn: " + _wc);
using (var svn = new SvnClient())
{
SvnInfoEventArgs info;
svn.GetInfo(new SvnPathTarget(_wc), out info);
_svnUri = info.Uri;
CheckWcStatus(svn);
}
}
示例7: getSVNVersion
private static long getSVNVersion(SvnClient client, SvnUriTarget source)
{
ConsoleLogStartAction(Resources.UILogging.GetSvnVersion);
SvnInfoEventArgs infos;
client.GetInfo(source, out infos);
Console.WriteLine(string.Format(Resources.UILogging.FoundSVNVersion, infos.Revision));
ConsoleEndAction();
return infos.Revision;
}
示例8: GetLastRevision
private long GetLastRevision(SvnClient client, string repoUrl)
{
SvnInfoEventArgs info;
client.GetInfo(repoUrl, out info);
return info.Revision;
}
示例9: ProcessChangedPaths
private void ProcessChangedPaths(SvnLoggingEventArgs svnLogEntry, long revision, LogEntryDto logEntry)
{
svnLogEntry.ChangedPaths.AsParallel().WithDegreeOfParallelism(1).ForAll(changedPath =>
{
Logger.Write(new LogEntry { Message = "Processing path " + changedPath.Path, Categories = { "Plugin.Subversion" } });
using (var parallelSvnClient = new SvnClient())
{
var changedFile = new ChangedFileDto { FileName = changedPath.Path };
var nodeKind = changedPath.NodeKind;
if (nodeKind == SvnNodeKind.Unknown)
{
// Use GetInfo to get the NodeKind
SvnInfoEventArgs svnInfo;
try
{
parallelSvnClient.GetInfo(
new SvnUriTarget(
SettingsXml + changedPath.Path,
// If the file is deleted then using revision causes an exception
(changedPath.Action == SvnChangeAction.Delete ? revision - 1 : revision)
),
out svnInfo);
nodeKind = svnInfo.NodeKind;
}
catch (SvnRepositoryIOException svnRepositoryIoException)
{
Logger.Write(new LogEntry
{
Message = svnRepositoryIoException.ToString(),
Categories = { "Plugin.Subversion" },
Severity = TraceEventType.Warning
});
}
}
if (nodeKind != SvnNodeKind.File)
{
changedFile.OldVersion = new byte[0];
changedFile.NewVersion = new byte[0];
}
else
{
if (changedPath.Action == SvnChangeAction.Modify || changedPath.Action == SvnChangeAction.Delete)
{
// Use GetInfo to get the last change revision
var previousRevisionUri = new SvnUriTarget(SettingsXml + changedPath.Path, revision - 1);
try
{
// For some reason we seem to get an exception with a message stating that
// a previous version doesn't exist for a Modify action. I'm not sure how
// you can have a modify without a previous version (surely everything
// starts with an add..?
SvnInfoEventArgs previousRevisionInfo;
parallelSvnClient.GetInfo(previousRevisionUri, out previousRevisionInfo);
changedFile.OldVersion = ReadFileVersion(
parallelSvnClient, SettingsXml + changedPath.Path,
previousRevisionInfo.LastChangeRevision);
}
catch (SvnRepositoryIOException e)
{
Logger.Write(new LogEntry { Message = "SvnRepositoryIOException: " + e, Categories = { "Plugin.Subversion" }, Severity = TraceEventType.Error });
changedFile.OldVersion = new byte[0];
}
catch (SvnFileSystemException ex)
{
// http://stackoverflow.com/questions/12939642/sharpsvn-getinfo-lastchangerevision-is-wrong
Logger.Write(new LogEntry { Message = "SvnFileSystemException: " + ex, Categories = { "Plugin.Subversion" }, Severity = TraceEventType.Warning });
changedFile.OldVersion = new byte[0];
}
}
else
{
changedFile.OldVersion = new byte[0];
}
if (changedPath.Action == SvnChangeAction.Modify || changedPath.Action == SvnChangeAction.Add)
{
changedFile.NewVersion = ReadFileVersion(parallelSvnClient, SettingsXml + changedPath.Path, revision);
}
else
{
changedFile.NewVersion = new byte[0];
}
}
switch (changedPath.Action)
{
case SvnChangeAction.Add:
changedFile.ChangeType = ChangeType.Added;
break;
case SvnChangeAction.Delete:
changedFile.ChangeType = ChangeType.Deleted;
break;
default:
changedFile.ChangeType = ChangeType.Modified;
break;
}
//.........这里部分代码省略.........
示例10: GetLogs
private static void GetLogs(bool console_mode, string application_path, string repository_location, long last_revision, Output_Type output_type)
{
SvnTarget repository;
SvnClient client = new SvnClient();
long current_revision = -1;
if (SvnTarget.TryParse(repository_location, out repository) == true)
{
try
{
SvnInfoEventArgs info;
client.GetInfo(new Uri(repository_location), out info);
current_revision = info.Revision;
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
if (console_mode == true)
{
Console.WriteLine(ex.Message);
}
}
if (last_revision < current_revision)
{
DataTable datatable = new DataTable("log");
datatable.Columns.Add("Revision", typeof(long));
datatable.Columns.Add("Author", typeof(string));
datatable.Columns.Add("Time", typeof(DateTime));
datatable.Columns.Add("ChangedPaths", typeof(string));
datatable.Columns.Add("LogMessage", typeof(string));
try
{
System.Collections.ObjectModel.Collection<SvnLogEventArgs> logitems = new System.Collections.ObjectModel.Collection<SvnLogEventArgs>();
SvnLogArgs logargs = new SvnLogArgs(new SvnRevisionRange(current_revision, last_revision + 1));
client.GetLog(new Uri(repository_location), logargs, out logitems);
datatable.BeginLoadData();
foreach (SvnLogEventArgs logitem in logitems)
{
StringBuilder ChangedPaths = new StringBuilder();
if (logitem.ChangedPaths != null)
{
foreach (SvnChangeItem path in logitem.ChangedPaths)
{
ChangedPaths.AppendFormat("{1} {2}{0}", Environment.NewLine, path.Action, path.Path);
if (path.CopyFromRevision != -1)
{
ChangedPaths.AppendFormat("{1} -> {2}{0}", Environment.NewLine, path.CopyFromPath, path.CopyFromRevision);
}
}
}
DataRow datarow = datatable.NewRow();
datarow["Revision"] = logitem.Revision;
datarow["Author"] = logitem.Author;
datarow["Time"] = logitem.Time.ToLocalTime();
datarow["ChangedPaths"] = ChangedPaths.ToString();
datarow["LogMessage"] = logitem.LogMessage;
datatable.Rows.Add(datarow);
}
datatable.EndLoadData();
datatable.AcceptChanges();
switch (output_type)
{
case Output_Type.Console:
OutputToConsole(console_mode, application_path, datatable);
break;
case Output_Type.Txt:
OutputToTxt(console_mode, application_path, datatable);
break;
case Output_Type.XML:
OutputToXML(console_mode, application_path, datatable);
break;
case Output_Type.XMLTransform:
OutputToXMLTransform(console_mode, application_path, datatable);
break;
case Output_Type.RSS:
OutputToRSS(console_mode, application_path, datatable);
break;
default:
break;
//.........这里部分代码省略.........
示例11: GetLocalInfo
/// <summary>
/// 执行获取本地项目svn信息的操作
/// </summary>
/// <param name="projectInfo">传入想要获取信息的projectInfo实例对象</param>
/// <returns>获取完信息的projectInfo的实例对象</returns>
public ProjectInfo GetLocalInfo(ProjectInfo projectInfo)
{
using (SvnClient svnClient = new SvnClient())
{
try
{
SvnInfoEventArgs clientInfo;
SvnPathTarget local = new SvnPathTarget(projectInfo.Workdirectory);
svnClient.GetInfo(local, out clientInfo);
//string revision =
// Regex.Match(string.Format("clientInfo revision of {0} is {1}", local, clientInfo.Revision),
// @"\d+").Value;
string author = clientInfo.LastChangeAuthor;
string changeTime = clientInfo.LastChangeTime.ToLocalTime().ToString();
projectInfo.Author = author;
//projectInfo.Revision = revision;
//projectInfo.Changetime = changeTime;
return projectInfo;
}
catch (Exception exception)
{
return projectInfo;
}
}
}
示例12: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
lbInfo.Content = "一切正常";
String curDir = Directory.GetCurrentDirectory();
String curExe = System.Reflection.Assembly.GetExecutingAssembly().Location;
SvnClient = new SvnClient();
SvnTarget svnTargetCurDir = SvnTarget.FromString(curDir);
SvnTarget snvTargetCurExe = SvnTarget.FromString(curExe);
// 未使用 - 获取目录下的文件状态
Collection<SvnStatusEventArgs> svnStatusEventArgsCollection;
SvnClient.GetStatus(Directory.GetCurrentDirectory(), out svnStatusEventArgsCollection);
// 未使用 - 空的
Collection<SvnPropertyListEventArgs> svnPropertyListEventArgsCollection;
SvnClient.GetPropertyList(Directory.GetCurrentDirectory(), out svnPropertyListEventArgsCollection);
// 未使用 - 获取一个文件的状态
Collection<SvnFileVersionEventArgs> svnFileVersionEventArgsCollection;
try
{
SvnClient.GetFileVersions(snvTargetCurExe, out svnFileVersionEventArgsCollection);
}
catch(SvnWorkingCopyPathNotFoundException ex)
{
// 如果查询的文件未加入Repo,会抛此异常
}
// 未使用 - 一个好像没什么用的信息列表,目录是第一个项,没有版本号
Collection<SvnListEventArgs> svnListEventArgsCollection;
SvnClient.GetList(svnTargetCurDir, out svnListEventArgsCollection);
// 未使用 - 工作目录全路径
String workingCopyRoot = SvnClient.GetWorkingCopyRoot(Directory.GetCurrentDirectory());
// 未使用 - 整个仓库的最新版本
long revision = 0;
SvnClient.Youngest(Directory.GetCurrentDirectory(), out revision);
// 此目录的相关变更 和 GUI中的ShowLog一样 是此目录的相关变更
Collection<SvnLogEventArgs> logList;
try
{
SvnClient.GetLog(Directory.GetCurrentDirectory(), out logList);
}
catch(SvnInvalidNodeKindException ex)
{
lbInfo.Content = "当前目录不是SVN目录,停用更新检查功能";
btnUpdateAndLaunch.Visibility = Visibility.Hidden;
return;
}
// 获取本地目录信息,当前版本和修改版本都是本地的
SvnInfoEventArgs svnInfoEventArgs;
SvnClient.GetInfo(svnTargetCurDir, out svnInfoEventArgs);
long curRevision = svnInfoEventArgs.Revision; // 当前的SVN版本
long changeRevision = logList[0].Revision; // 当前目录的最新远程变更版本
lbVersionChange.Content = changeRevision;
lbVersionCur.Content = svnInfoEventArgs.Revision;
if (curRevision < changeRevision)
{
btnUpdateAndLaunch.Visibility = Visibility.Visible;
lbInfo.Content = "发现新版本";
}
else
{
btnUpdateAndLaunch.Visibility = Visibility.Hidden;
lbInfo.Content = "已经是最新版";
}
// --------------------------------------------------------
// SvnWorkingCopyClient
// --------------------------------------------------------
SvnWorkingCopyClient svnWorkingCopyClient = new SvnWorkingCopyClient();
// 未使用 只有一个值IsText 没看出有什么用处
SvnWorkingCopyState svnWorkingCopyState;
svnWorkingCopyClient.GetState(Directory.GetCurrentDirectory(), out svnWorkingCopyState);
// 未使用 返回仅本地存在的所有修改版本
SvnWorkingCopyVersion svnWorkingCopyVersion;
svnWorkingCopyClient.GetVersion(curDir, out svnWorkingCopyVersion);
// --------------------------------------------------------
// SvnTools
// --------------------------------------------------------
// 未使用 传入正确的目录却返回false????
bool isCurDirInWorkingCopy = SvnTools.IsManagedPath(curDir);
}
示例13: Main
//.........这里部分代码省略.........
}
if (namespaceName != null && className != null) GenerateCode(namespaceName, className, target.Hash, outputFilename);
if (webVersionFile != null)
{
using (var writer = new StreamWriter(webVersionFile))
{
writer.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
writer.WriteLine("<product>");
if (productName != null)
{
writer.WriteLine(" <name>{0}</name>", productName);
}
if (installer32 != null)
{
writer.WriteLine(" <x86>");
writer.WriteLine(GenerateWebVersionXml(installer32));
writer.WriteLine(" </x86>");
}
if (installer64 != null)
{
writer.WriteLine(" <x64>");
writer.WriteLine(GenerateWebVersionXml(installer64));
writer.WriteLine(" </x64>");
}
writer.WriteLine("</product>");
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Usage();
return -1;
}
#if false
try
{
string svnVersionString;
using (var client = new SvnClient())
{
if (string.IsNullOrEmpty(outputFilename)) outputFilename = assemblyVersionFile;
SvnInfoEventArgs svnInfo;
client.GetInfo(new SvnUriTarget(client.GetUriFromWorkingCopy(Path.GetDirectoryName(outputFilename))), out svnInfo);
svnVersionString = svnInfo.Revision.ToString(CultureInfo.InvariantCulture);
}
if (versionFile != null)
{
var inputLines = File.ReadAllLines(versionFile);
foreach (var inputLine in inputLines)
{
var curLine = inputLine.Trim();
if (string.IsNullOrEmpty(curLine) || curLine.StartsWith("//")) continue;
var versionFields = curLine.Split('.');
switch (versionFields.Length)
{
case 4:
case 3:
int major, minor, build;
if (!int.TryParse(versionFields[0], out major) || !int.TryParse(versionFields[1], out minor) || !int.TryParse(versionFields[2], out build) || major < 0 || minor < 0 || build < 0) throw new FormatException(string.Format("Version file not in expected format. There should be only one line that does not begin with a comment mark ('//') and that line should contain a version number template in the form 1.2.3 where 1 is the Major version number of this application, 2 is the Minor version number and 3 is the Build number. A fourth field, taken from the Subversion revision number of the output directory, will be appended to this and used for assembly and installer version numbers later in the build process."));
versionNumber = string.Format("{0}.{1}.{2}.{3}", versionFields[0], versionFields[1], versionFields[2], svnVersionString);
break;
default:
throw new FormatException(string.Format("Version file not in expected format. There should be only one line that does not begin with a comment mark ('//') and that line should contain a version number template in the form 1.2.3 where 1 is the Major version number of this application, 2 is the Minor version number and 3 is the Build number. A fourth field, taken from the Subversion revision number of the output directory, will be appended to this and used for assembly and installer version numbers later in the build process."));
}
}
}
if (assemblyVersionFile != null)
{
if (versionNumber == null) throw new ApplicationException("if -assemblyversion is specified, -version must also be specified");
using (var writer = new StreamWriter(assemblyVersionFile))
{
writer.WriteLine("using System.Reflection;");
writer.WriteLine();
writer.WriteLine("[assembly: AssemblyVersion(\"{0}\")]", versionNumber);
writer.WriteLine("[assembly: AssemblyFileVersion(\"{0}\")]", versionNumber);
}
}
if (wixVersionFile != null)
{
if (versionNumber == null) throw new ApplicationException("if -wixversion is specified, -version must also be specified");
using (var writer = new StreamWriter(wixVersionFile))
{
writer.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
writer.WriteLine("<Include>");
writer.WriteLine(" <?define ProductFullVersion = \"{0}\" ?>", versionNumber);
writer.WriteLine("</Include>");
}
}
if (namespaceName != null && className != null) GenerateCode(namespaceName, className, svnVersionString, outputFilename);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Usage();
return -1;
}
#endif
return 0;
}
示例14: checkSVN
/// <summary>
/// Checks the SVN.
/// </summary>
private void checkSVN()
{
SvnClient __svnClient = new SvnClient();
SvnInfoEventArgs __sieaInfo;
bool __getInfo;
//MessageBox.Show(__versionFilePath);
if (__versionFilePath != "")
{
try
{
__getInfo = __svnClient.GetInfo(SvnPathTarget.FromString(GetSourcePath() + __versionFilePath + settingObject.ClassName + ".as"), out __sieaInfo);
//MessageBox.Show(__sieaInfo.ToString());
pluginUI.Revision.Text = __sieaInfo.LastChangeRevision.ToString();
__vRevision = (int)__sieaInfo.LastChangeRevision;
}
catch (SvnException e)
{
try
{
//MessageBox.Show(">" + e.Message);
__getInfo = __svnClient.GetInfo(SvnPathTarget.FromString(GetSourcePath() + __versionFilePath), out __sieaInfo);
pluginUI.Revision.Text = __sieaInfo.LastChangeRevision.ToString();
__vRevision = (int)__sieaInfo.LastChangeRevision;
}
catch (SvnException ex)
{
__vRevision = 0;
pluginUI.Revision.Text = "";
}
}
}
else
{
__vRevision = 0;
pluginUI.Revision.Text = "";
}
}
示例15: LoadRevisions
void LoadRevisions()
{
int limit;
Int32.TryParse(textBoxLoadBunch.Text, out limit);
var cts = new CancellationTokenSource();
Task.Factory
.StartNew(() => {
using (var client = new SvnClient())
{
client.Authentication.SslServerTrustHandlers += (sender, e) => { e.AcceptedFailures = SvnCertificateTrustFailures.MaskAllFailures; };
client.Authentication.DefaultCredentials = CredentialCache.DefaultNetworkCredentials;
SvnInfoEventArgs info;
client.GetInfo(_url != null ? (SvnTarget)new SvnUriTarget(_url) : new SvnPathTarget(_path), out info);
_repoUri = info.RepositoryRoot;
var args = new SvnLogArgs { Limit = limit };
var url = _url;
if (_lastLoaded != null)
{
args.OperationalRevision = _lastLoaded.Revision - 1;
}
Collection<SvnLogEventArgs> entries;
if (url != null)
client.GetLog(url, args, out entries);
else
client.GetLog(_path, args, out entries);
return entries;
}
}, cts.Token)
.TrackProgress(loadingOperation, cts)
.LockControls(textBoxUrl, buttonLoad, buttonLoadNext, textBoxLoadBunch)
.ContinueWith(t => {
if (t.IsFaulted || t.IsCanceled)
{
// if error occured - strat from scratch: can be load first N entries, can't continue
_lastLoaded = null;
buttonLoad.Enabled = true;
buttonLoadNext.Enabled = false;
}
cts.Token.ThrowIfCancellationRequested();
var entries = t.Result;
if (entries.Count < limit)
{
// nothing to load next - all revisions loaded
buttonLoadNext.Enabled = false;
_lastLoaded = null;
}
else
{
_lastLoaded = entries.Last();
}
try
{
listViewLog.BeginUpdate();
foreach (var entry in entries)
{
var lvi = new ListViewItem(new[] { entry.Revision.ToString(CultureInfo.InvariantCulture), entry.Author, entry.LogMessage })
{
Tag = entry
};
listViewLog.Items.Add(lvi);
}
}
finally
{
listViewLog.EndUpdate();
}
}, TaskScheduler.FromCurrentSynchronizationContext())
//.TrackProgress(loadingOperation)
.WithDisposeWeak(cts)
;
}