private void LogHandler(object sender, SvnLogEventArgs e) { try { List <string> filesChanged = new List <string>(); ChangeSetDictionary changedItems = new ChangeSetDictionary(); if (e.ChangedPaths == null) { return; } foreach (SvnChangeItem item in e.ChangedPaths) { filesChanged.Add(item.Path); changedItems.Add(item.Path, new ChangedPathInfo(item)); } int revision = Convert.ToInt32(e.Revision); OnChangeSet(revision, e.Author, e.Time, e.LogMessage, filesChanged, changedItems); } catch (Exception ex) { OnError(ex); } }
protected override void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList<string> filesChanged, ChangeSetDictionary changedPathInfos) { LogMessage.Log(LogMessage.SeverityType.Debug, string.Format("Processing Revision {0}.", revision), _eventManager); PropertiesCollection toSave = new PropertiesCollection(); foreach (string path in changedPathInfos.Keys) { IChangedPathInfo info = changedPathInfos[path]; //// Only execute if path is a Tag (the Rev is a Copy operation, with destination including "Tags") if ((!path.ToUpper().Contains("/TAGS/")) || (info.Action != SubversionAction.Add) || (info.CopyFromPath == null) || (info.CopyFromRevision < 0)) continue; string pathToUse = FixPath(path); // get any svn:external properties, and update them to specify the revision PropertiesCollection properties = GetProperties(pathToUse, revision, true); foreach (string changedPath in properties.Keys) { if (properties[changedPath].ContainsKey(ExternalsKey)) { string originalValue = properties[changedPath][ExternalsKey]; Dictionary<string, string> updated = new Dictionary<string, string>(); updated.Add(ExternalsKey, UpdateValue(originalValue, info.CopyFromRevision)); // Get the revision of the copy source toSave[changedPath] = updated; LogMessage.Log(LogMessage.SeverityType.Debug, string.Format("Updating property \"{0}\" on \"{1}\" to value \"{2}\".", ExternalsKey, changedPath, updated[ExternalsKey]), _eventManager); } } } SaveProperties(toSave); base.ProcessRevision(revision, author, changeDate, message, filesChanged, changedPathInfos); }
public RevisionArgs(int revision, string author, DateTime time, string message, List <string> changed, ChangeSetDictionary changedPathInfos) { Revision = revision; Author = author; Time = time; Message = message; Changed = changed; ChangePathInfos = changedPathInfos; }
protected override void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList<string> filesChanged, ChangeSetDictionary changedPathInfos) { List<string> references = GetReferences(message); ChangeSetInfo changeSet = new ChangeSetInfo(author, message, filesChanged, revision.ToString(), changeDate, references, ReferenceUrl, ReposName); string[] referenceStrings = new string[changeSet.References.Count]; changeSet.References.CopyTo(referenceStrings, 0); string referenceMessage = (referenceStrings.Length > 0) ? "references: " + string.Join(", ", referenceStrings) : "No References found."; LogMessage.Log(string.Format("Publishing ChangeSet: {0}, \"{1}\"; {2}", changeSet.Revision, changeSet.Message, referenceMessage), _eventManager); PublishChangeSet(changeSet); base.ProcessRevision(revision, author, changeDate, message, filesChanged, changedPathInfos); }
public void FixerUpdatesExternals() { var fixer = new TestableSvnTagFixerHostedService(); IEventManager eventManager = new EventManager(); fixer.Initialize(Config, eventManager, null); const int expectedRevision = 212; PropertiesCollection sourceProperties = SourceProperties(); PropertiesCollection expectedProperties = ExpectedProperties(expectedRevision); fixer.SourceProperties = sourceProperties; var changedPaths = new List<string>(); changedPaths.Add("/repos/Tags/Build/12"); var changeInfos = new ChangeSetDictionary(); changeInfos.Add(changedPaths[0], new HackedChangedPathInfo(SubversionAction.Add, expectedRevision, "/Trunk")); DateTime changedate = DateTime.Now; string expectedMessage = string.Format("Build 12"); // Get the class under test to process the revision fixer.TestProcessRevision(expectedRevision, "ExpectedAuthor", changedate, expectedMessage, changedPaths, changeInfos); PropertiesCollection result = fixer.LastSavedProperties; foreach(string path in expectedProperties.Keys) { Assert.IsTrue(result.ContainsKey(path)); Dictionary<string, string> propertyList = result[path]; Assert.IsTrue(propertyList.ContainsKey("svn:externals")); Assert.AreEqual(expectedProperties[path]["svn:externals"], result[path]["svn:externals"]); } foreach(string path in sourceProperties.Keys) { if(!expectedProperties.ContainsKey(path)) { Assert.IsFalse(result.ContainsKey(path)); } } }
public void TestProcessRevision(int revision, string author, DateTime changeDate, string message, IList<string> filesChanged, ChangeSetDictionary changeInfos) { base.ProcessRevision(revision, author, changeDate, message, filesChanged, changeInfos); }
protected virtual void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList<string> filesChanged, ChangeSetDictionary changedPathInfos) { LastRevision = revision; }
public RevisionArgs(int revision, string author, DateTime time, string message, List<string> changed, ChangeSetDictionary changedPathInfos) { Revision = revision; Author = author; Time = time; Message = message; Changed = changed; ChangePathInfos = changedPathInfos; }
private void OnChangeSet(int revision, string author, DateTime time, string message, List<string> changed, ChangeSetDictionary changedPathInfos) { if (_revision != null) _revision(this, new RevisionArgs(revision, author, time, message, changed, changedPathInfos)); }
private void LogHandler(object sender, SvnLogEventArgs e) { try { List<string> filesChanged = new List<string>(); ChangeSetDictionary changedItems = new ChangeSetDictionary(); if(e.ChangedPaths == null) { return; } foreach (SvnChangeItem item in e.ChangedPaths) { filesChanged.Add(item.Path); changedItems.Add(item.Path, new ChangedPathInfo(item)); } int revision = Convert.ToInt32(e.Revision); OnChangeSet(revision, e.Author, e.Time, e.LogMessage, filesChanged, changedItems); } catch(Exception ex) { OnError(ex); } }
private void OnChangeSet(int revision, string author, DateTime time, string message, List <string> changed, ChangeSetDictionary changedPathInfos) { if (_revision != null) { _revision(this, new RevisionArgs(revision, author, time, message, changed, changedPathInfos)); } }
protected virtual void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList <string> filesChanged, ChangeSetDictionary changedPathInfos) { LastRevision = revision; }
protected override void ProcessRevision(int revision, string author, DateTime changeDate, string message, IList <string> filesChanged, ChangeSetDictionary changedPathInfos) { List <string> references = GetReferences(message); var changeSet = new ChangeSetInfo(author, message, filesChanged, revision, RepositoryUuid, changeDate, references, linkInfo, RepositoryFriendlyName); var referenceStrings = new string[changeSet.References.Count]; changeSet.References.CopyTo(referenceStrings, 0); string referenceMessage = (referenceStrings.Length > 0) ? "references: " + string.Join(", ", referenceStrings) : "No References found."; Logger.Log(string.Format("Publishing ChangeSet: {0}, \"{1}\"; {2}", changeSet.Revision, changeSet.Message, referenceMessage)); PublishChangeSet(changeSet); base.ProcessRevision(revision, author, changeDate, message, filesChanged, changedPathInfos); }