void OnReceivedItem(SvnLoggingEventArgs e) { if (!_cancel && ReceivedItem != null) { ReceivedItem(this, e); } }
void OnReceivedItem(object sender, SvnLoggingEventArgs e) { if (sender != _currentRequest || _context == null) { e.Cancel = true; return; } e.Detach(); LogRevisionItem lri = new LogRevisionItem(this, _context, e); bool post; lock (_logItems) { post = (_logItems.Count == 0); _logItems.Enqueue(lri); } if (post) { if (IsHandleCreated) { BeginInvoke(new AnkhAction(OnShowItems)); } } }
private static RevisionInfo SvnRevisionToRevisionInfo(SvnLoggingEventArgs revision, IVersionControlSystem vcs) { var infos = SvnChangeItemCollectionToArrayOfRevisionEntryInfo(revision.ChangedPaths); var entries = infos.ToArray(); _log.InfoFormat("Revision Info ctor: {0},{1},{2},{3},{4}", revision.Revision, revision.Author, revision.LogMessage, revision.Time.ToLocalTime(), entries); return new RevisionInfo { Id = revision.Revision.ToString(), Author = revision.Author, Comment = revision.LogMessage, Time = revision.Time.ToLocalTime(), Entries = entries }; }
private static RevisionInfo SvnRevisionToRevisionInfo(SvnLoggingEventArgs revision, IVersionControlSystem vcs) { var infos = SvnChangeItemCollectionToArrayOfRevisionEntryInfo(revision.ChangedPaths); var entries = infos.ToArray(); _log.InfoFormat("Revision Info ctor: {0},{1},{2},{3},{4}", revision.Revision, revision.Author, revision.LogMessage, revision.Time.ToLocalTime(), entries); return(new RevisionInfo { Id = revision.Revision.ToString(), Author = revision.Author, Comment = revision.LogMessage, Time = revision.Time.ToLocalTime(), Entries = entries }); }
public LogRevisionItem(LogRevisionControl listView, IAnkhServiceProvider context, SvnLoggingEventArgs e) : base(listView) { if (listView == null) { throw new ArgumentNullException("listView"); } else if (context == null) { throw new ArgumentNullException("listView"); } else if (e == null) { throw new ArgumentNullException("e"); } _args = e; _context = context; RefreshText(); UpdateColors(); }
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; } logEntry.ChangedFiles.Add(changedFile); } }); }