本文整理汇总了C#中SvnClient.GetLog方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.GetLog方法的具体用法?C# SvnClient.GetLog怎么用?C# SvnClient.GetLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.GetLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChangeSetFromSvn
public static FileChanged[] GetChangeSetFromSvn(DateTime startDateTime, DateTime endDateTime, SvnConfig server)
{
SvnRevisionRange range = new SvnRevisionRange(new SvnRevision(startDateTime), new SvnRevision(endDateTime));
Collection<SvnLogEventArgs> logitems;
var uri = new Uri(server.Url);
FileChanged[] changed;
using (SvnClient client = new SvnClient())
{
client.Authentication.Clear(); // Disable all use of the authentication area
client.Authentication.UserNamePasswordHandlers +=
delegate(object sender, SvnUserNamePasswordEventArgs e)
{
e.UserName = server.UserName;
e.Password = server.Password;
e.Save = true;
};
client.Authentication.SslServerTrustHandlers += delegate(object sender, SvnSslServerTrustEventArgs e)
{
e.AcceptedFailures = e.Failures;
e.Save = true; // Save acceptance to authentication store
};
client.GetLog(uri, new SvnLogArgs(range), out logitems);
foreach (var svnLogEventArgse in logitems)
{
Console.WriteLine((string) WriteString(svnLogEventArgse));
}
changed = logitems.SelectMany<SvnLogEventArgs, FileChanged>(l => GetChangedFiles(l)).ToArray();
}
return changed;
}
示例2: GetSvnLogEntries
/// <summary>
/// Gets the svn log entries from the repository.
/// </summary>
/// <returns>An IEnumerable of the QvxDataRows.</returns>
private IEnumerable<QvxDataRow> GetSvnLogEntries()
{
QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Notice, "GetSvnLogEntries()");
string username, password, server;
this.MParameters.TryGetValue("UserId", out username);
this.MParameters.TryGetValue("Password", out password);
this.MParameters.TryGetValue("Server", out server);
System.Net.NetworkCredential creds = new System.Net.NetworkCredential(username, password);
SvnClient client = new SvnClient();
client.Authentication.DefaultCredentials = creds;
SvnUriTarget target = new SvnUriTarget(server);
Collection<SvnLogEventArgs> logEntries = new Collection<SvnLogEventArgs>();
bool result = client.GetLog(target.Uri, out logEntries);
if(!result)
{
throw new SvnClientException("Retrieving Subversion log failed");
}
foreach(SvnLogEventArgs entry in logEntries)
{
yield return MakeEntry(entry, FindTable("SvnLogEntries", MTables));
}
}
示例3: CheckForNewLogEntriesImpl
protected override void CheckForNewLogEntriesImpl()
{
if (!Monitor.TryEnter(LockObject))
return;
try
{
using (var svnClient = new SvnClient())
{
var uri = new Uri(SettingsXml);
Collection<SvnLogEventArgs> svnLogEntries;
if (svnClient.GetLog(uri, new SvnLogArgs { Limit = 30 }, out svnLogEntries))
{
var q = svnLogEntries
.Where(e => e.Time.PrecisionFix() > MaxDateTimeRetrieved)
.OrderBy(e => e.Time);
foreach (var svnLogEntry in q)
{
var revision = svnLogEntry.Revision;
Logger.Write(new LogEntry
{
Message = "Creating LogEntryDto for revision " + revision,
Categories = { "Plugin." + GetType().Name }
});
var logEntry = new LogEntryDto
{
Author = svnLogEntry.Author,
CommittedDate = svnLogEntry.Time,
Message = svnLogEntry.LogMessage,
Revision = revision.ToString(CultureInfo.InvariantCulture),
ChangedFiles = new List<ChangedFileDto>()
};
ProcessChangedPaths(svnLogEntry, revision, logEntry);
var args = new NewLogEntryEventArgs { LogEntry = logEntry };
OnNewLogEntry(args);
}
MaxDateTimeRetrieved = svnLogEntries.Max(x => x.Time).PrecisionFix();
}
}
}
finally
{
Monitor.Exit(LockObject);
}
}
示例4: TryCredentials
private bool TryCredentials(string url, string username, string password)
{
var client = new SvnClient();
client.Authentication.Clear();
client.Authentication.DefaultCredentials = new NetworkCredential(username, password);
client.Authentication.SslServerTrustHandlers += (o, e) =>
{
e.AcceptedFailures = e.Failures;
e.Save = true;
};
try
{
Collection<SvnLogEventArgs> logs;
client.GetLog(new Uri(url), new SvnLogArgs() { Limit = 1 }, out logs);
return true;
}
catch (SvnAuthorizationException ex)
{
Console.WriteLine(ex.ToString());
return false;
}
}
示例5: GetCommits
private IEnumerable<Commit> GetCommits(SvnClient client, string repoUrl, long endRevision, int count, Func<SvnLogEventArgs, bool> filter)
{
var repoDiscoveryStep = RepoDiscoveryStepCoef * count;
var commits = new List<Commit>();
long discoveredDepth = 0;
while (commits.Count < count && discoveredDepth <= MaxRepositoryDiscoverDepth && endRevision > 1)
{
var startRevision = endRevision > repoDiscoveryStep ? endRevision - repoDiscoveryStep : 1;
var logArguments = new SvnLogArgs { Start = startRevision, End = endRevision };
Collection<SvnLogEventArgs> logEvents;
client.GetLog(new Uri(repoUrl), logArguments, out logEvents);
commits.AddRange(_mapper.Map<SvnLogEventArgs, Commit>(logEvents.Where(filter)));
discoveredDepth += endRevision - startRevision;
endRevision = endRevision - 1 > repoDiscoveryStep ? endRevision - repoDiscoveryStep - 1 : 1;
}
return commits;
}
示例6: RepositoryOperation_SetupRepository
public void RepositoryOperation_SetupRepository()
{
SvnSandBox sbox = new SvnSandBox(this);
Uri uri = sbox.CreateRepository(SandBoxRepository.Empty);
SvnCommitResult cr;
SvnRepositoryOperationArgs oa = new SvnRepositoryOperationArgs();
oa.LogMessage = "Everything in one revision";
using (SvnMultiCommandClient mucc = new SvnMultiCommandClient(uri, oa))
{
mucc.CreateDirectory("trunk");
mucc.CreateDirectory("branches");
mucc.CreateDirectory("tags");
mucc.CreateDirectory("trunk/src");
mucc.SetProperty("", "svn:auto-props", "*.cs = svn:eol-style=native");
mucc.SetProperty("", "svn:global-ignores", "bin obj");
mucc.CreateFile("trunk/README", new MemoryStream(Encoding.UTF8.GetBytes("Welcome to this project")));
mucc.SetProperty("trunk/README", "svn:eol-style", "native");
Assert.That(mucc.Commit(out cr)); // Commit r1
Assert.That(cr, Is.Not.Null);
}
using (SvnClient svn = new SvnClient())
{
Collection<SvnListEventArgs> members;
svn.GetList(uri, out members);
Assert.That(members, Is.Not.Empty);
MemoryStream ms = new MemoryStream();
SvnPropertyCollection props;
svn.Write(new Uri(uri, "trunk/README"), ms, out props);
Assert.That(props, Is.Not.Empty);
Assert.That(Encoding.UTF8.GetString(ms.ToArray()), Is.EqualTo("Welcome to this project"));
Assert.That(props.Contains("svn:eol-style"));
Collection<SvnLogEventArgs> la;
SvnLogArgs ll = new SvnLogArgs();
ll.Start = 1;
svn.GetLog(uri, ll, out la);
Assert.That(la, Is.Not.Empty);
Assert.That(la[0].LogMessage, Is.EqualTo("Everything in one revision"));
}
}
示例7: fetchExec
private void fetchExec()
{
using (SvnClient client = new SvnClient())
{
Collection<SvnLogEventArgs> logItems = new Collection<SvnLogEventArgs>();
client.GetLog(new Uri("http://192.168.1.193/svndata/fivestar/ecommerce/branches/dev2.1"), out logItems);
svn.SvnLogs = logItems;
Console.WriteLine(logItems[0].Author);
SvnChangeItemCollection svnChange = logItems[0].ChangedPaths;
Console.WriteLine(svnChange[0].Path);
SvnTarget tgt = SvnTarget.FromString(svnChange[0].Path);
}
}
示例8: 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;
//.........这里部分代码省略.........
示例9: ChangeInfo_GetInfoCompare
public void ChangeInfo_GetInfoCompare()
{
SvnSandBox sbox = new SvnSandBox(this);
Uri reposUri = sbox.CreateRepository(SandBoxRepository.MergeScenario);
string reposPath = reposUri.LocalPath;
using (SvnClient cl = new SvnClient())
{
SvnSetPropertyArgs sa = new SvnSetPropertyArgs();
sa.BaseRevision = 17;
sa.LogMessage = "Message";
cl.RemoteSetProperty(reposUri, "MyProp", "Value", sa);
}
for (long ii = 1; ii < 19; ii++)
{
using (SvnLookClient lcl = new SvnLookClient())
using (SvnClient cl = new SvnClient())
{
SvnChangeInfoEventArgs r;
SvnChangeInfoArgs ia = new SvnChangeInfoArgs();
SvnLookOrigin origin = new SvnLookOrigin(reposPath, ii);
SvnLogArgs la = new SvnLogArgs();
la.Start = la.End = ii;
Collection<SvnLogEventArgs> lrc;
//ia.RetrieveChangedPaths = false; // Will fail if true
Assert.That(lcl.GetChangeInfo(origin, ia, out r));
Assert.That(cl.GetLog(reposUri, la, out lrc));
Assert.That(r, Is.Not.Null);
Assert.That(lrc.Count, Is.EqualTo(1));
SvnLogEventArgs lr = lrc[0];
Assert.That(r.Author, Is.EqualTo(lr.Author));
Assert.That(r.Revision, Is.EqualTo(lr.Revision));
Assert.That(r.BaseRevision, Is.EqualTo(lr.Revision - 1));
Assert.That(r.LogMessage, Is.EqualTo(lr.LogMessage));
Assert.That(r.Time, Is.EqualTo(lr.Time));
Assert.That(r.ChangedPaths, Is.Not.Null, "r.ChangedPaths({0})", ii);
Assert.That(lr.ChangedPaths, Is.Not.Null, "lr.ChangedPaths({0})", ii);
Assert.That(r.ChangedPaths.Count, Is.EqualTo(lr.ChangedPaths.Count));
for (int i = 0; i < r.ChangedPaths.Count; i++)
{
SvnChangeItem c = r.ChangedPaths[i];
SvnChangeItem lc = lr.ChangedPaths[c.Path];
Assert.That(c.Path, Is.EqualTo(lc.Path));
Assert.That(c.Action, Is.EqualTo(lc.Action));
Assert.That(c.CopyFromPath, Is.EqualTo(lc.CopyFromPath));
Assert.That(c.CopyFromRevision, Is.EqualTo(lc.CopyFromRevision));
}
}
}
}
示例10: 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);
}
示例11: GetLogSince
public static ICollection<SvnLogEventArgs> GetLogSince(string repositoryUri,
string target,
long revision)
{
var svnLogArgs = new SvnLogArgs
{
StrictNodeHistory = true,
End = revision,
BaseUri = new Uri(repositoryUri)
};
Collection<SvnLogEventArgs> logItems;
using (var svnClient = new SvnClient())
{
if (!svnClient.GetLog(new Uri(svnLogArgs.BaseUri,
target),
svnLogArgs,
out logItems))
{
logItems = new Collection<SvnLogEventArgs>();
}
}
return logItems;
}
示例12: GetInitialLogItem
public static SvnLogEventArgs GetInitialLogItem(string repositoryUri,
string target)
{
var svnLogArgs = new SvnLogArgs
{
StrictNodeHistory = true,
BaseUri = new Uri(repositoryUri),
Start = SvnRevision.Zero,
End = SvnRevision.Head,
Limit = 1
};
Collection<SvnLogEventArgs> logItems;
using (var svnClient = new SvnClient())
{
if (!svnClient.GetLog(new Uri(svnLogArgs.BaseUri,
target),
svnLogArgs,
out logItems))
{
logItems = new Collection<SvnLogEventArgs>();
}
}
var logItem = logItems.SingleOrDefault();
return logItem;
}
示例13: Commit_WithAlternateUser
public void Commit_WithAlternateUser()
{
SvnSandBox sbox = new SvnSandBox(this);
sbox.Create(SandBoxRepository.Empty);
string user = Guid.NewGuid().ToString();
string dir = sbox.Wc;
using (SvnClient client = new SvnClient())
{
client.Authentication.Clear();
client.Configuration.LogMessageRequired = false;
client.Authentication.UserNameHandlers +=
delegate(object sender, SvnUserNameEventArgs e)
{
e.UserName = user;
};
client.SetProperty(dir, "a", "b");
SvnCommitResult cr;
client.Commit(dir, out cr);
Collection<SvnLogEventArgs> la;
client.GetLog(dir, out la);
Assert.That(la.Count, Is.EqualTo(2));
Assert.That(la[0].Revision, Is.EqualTo(cr.Revision));
Assert.That(la[0].Author, Is.EqualTo(user));
Assert.That(la[0].LogMessage, Is.EqualTo(""));
}
}
示例14: GetLogs
private bool GetLogs(string path, string changelog)
{
SvnClient client = new SvnClient();
Collection<SvnLogEventArgs> logItems = null;
if (client.GetLog(path, out logItems))
{
DataTable table = new DataTable("log");
table.Columns.Add("time", typeof(DateTime));
table.Columns.Add("message", typeof(string));
table.Columns.Add("author", typeof(string));
foreach (SvnLogEventArgs args in logItems)
{
if (!string.IsNullOrEmpty(args.LogMessage))
{
table.Rows.Add(new object[] { args.Time, args.LogMessage, args.Author });
}
}
if (table.Rows.Count > 0)
{
DataSet set = new DataSet("logs");
set.Tables.Add(table);
set.WriteXml(changelog);
return true;
}
}
return false;
}
示例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)
;
}