public void APITestChangeSetOpenCloseGet() { // intialize the connection. var apiInstance = new APIConnection("http://api06.dev.openstreetmap.org/", "osmsharp", "osmsharp"); // opens the changeset. long changesetId = apiInstance.ChangeSetOpen("A test changeset!"); // get the changeset. ChangeSetInfo simpleChangesetInfo = apiInstance.ChangeSetGet(changesetId); Assert.IsTrue(simpleChangesetInfo.Open); Assert.IsFalse(simpleChangesetInfo.ClosedAt.HasValue); // closes the current changeset. apiInstance.ChangeSetClose(); // get the same changeset again! simpleChangesetInfo = apiInstance.ChangeSetGet(changesetId); Assert.IsFalse(simpleChangesetInfo.Open); Assert.IsTrue(simpleChangesetInfo.ClosedAt.HasValue); }
public RiskReport ProcessChangeSet(ChangeSetInfo changeSet) { _changeSet = changeSet; _isRunning = true; _mainThread = new Thread(new ThreadStart(ScoreChangeSet)); _mainThread.Start(); MD5 Stopwatch timer = new Stopwatch(); timer.Start(); bool timeout = false; while (_isRunning) { Thread.Sleep(100); if (timer.Elapsed.Seconds > this.ExecutionTimeOut) { _isRunning = false; timeout = true; _mainThread.Join(2000); } } timer.Stop(); MD5 if (_report == null) _report = new RiskReport(); _report.Timeout = timeout; _report.AggregationThreshold = _settings.AggregationThreshold; _report.Date = changeSet.Date; MD5 return _report; }
/// <summary> /// Converts an API v6 xml changeset object to a SimpleChange object. /// </summary> /// <param name="xml_changeset"></param> /// <returns></returns> private ChangeSetInfo Convertv6XmlChangeSet(OsmSharp.Osm.Xml.v0_6.changeset xml_changeset) { ChangeSetInfo simple_changeset = new ChangeSetInfo(); if (xml_changeset.idSpecified) { simple_changeset.Id = xml_changeset.id; } if (xml_changeset.closed_atSpecified) { simple_changeset.ClosedAt = xml_changeset.closed_at; } if (xml_changeset.closed_atSpecified) { simple_changeset.CreatedAt = xml_changeset.created_at; } if (xml_changeset.max_latSpecified) { simple_changeset.MaxLat = xml_changeset.max_lat; } if (xml_changeset.max_lonSpecified) { simple_changeset.MaxLon = xml_changeset.max_lon; } if (xml_changeset.min_latSpecified) { simple_changeset.MinLat = xml_changeset.min_lat; } if (xml_changeset.min_lonSpecified) { simple_changeset.MinLon = xml_changeset.min_lon; } if (xml_changeset.openSpecified) { simple_changeset.Open = xml_changeset.open; } if (xml_changeset.tag != null) { simple_changeset.Tags = new Dictionary <string, string>(); foreach (Osm.Xml.v0_6.tag xml_tag in xml_changeset.tag) { simple_changeset.Tags.Add(xml_tag.k, xml_tag.v); } } if (xml_changeset.uidSpecified) { simple_changeset.UserId = xml_changeset.uid; } simple_changeset.User = xml_changeset.user; return(simple_changeset); }
private ChangeSetInfo Convertv6XmlChangeSet(changeset xml_changeset) { ChangeSetInfo changeSetInfo = new ChangeSetInfo(); if (xml_changeset.idSpecified) { changeSetInfo.Id = new long?(xml_changeset.id); } if (xml_changeset.closed_atSpecified) { changeSetInfo.ClosedAt = new DateTime?(xml_changeset.closed_at); } if (xml_changeset.closed_atSpecified) { changeSetInfo.CreatedAt = xml_changeset.created_at; } if (xml_changeset.max_latSpecified) { changeSetInfo.MaxLat = xml_changeset.max_lat; } if (xml_changeset.max_lonSpecified) { changeSetInfo.MaxLon = xml_changeset.max_lon; } if (xml_changeset.min_latSpecified) { changeSetInfo.MinLat = xml_changeset.min_lat; } if (xml_changeset.min_lonSpecified) { changeSetInfo.MinLon = xml_changeset.min_lon; } if (xml_changeset.openSpecified) { changeSetInfo.Open = xml_changeset.open; } if (xml_changeset.tag != null) { changeSetInfo.Tags = new Dictionary <string, string>(); foreach (tag tag in xml_changeset.tag) { changeSetInfo.Tags.Add(tag.k, tag.v); } } if (xml_changeset.uidSpecified) { changeSetInfo.UserId = xml_changeset.uid; } changeSetInfo.User = xml_changeset.user; return(changeSetInfo); }
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); }
protected virtual void PublishChangeSet(ChangeSetInfo changeSet) { _eventManager.Publish(changeSet); }
/// <summary> /// Converts an API v6 xml changeset object to a SimpleChange object. /// </summary> /// <param name="xml_changeset"></param> /// <returns></returns> private ChangeSetInfo Convertv6XmlChangeSet(OsmSharp.Osm.Xml.v0_6.changeset xml_changeset) { ChangeSetInfo simple_changeset = new ChangeSetInfo(); if (xml_changeset.idSpecified) { simple_changeset.Id = xml_changeset.id; } if (xml_changeset.closed_atSpecified) { simple_changeset.ClosedAt = xml_changeset.closed_at; } if (xml_changeset.closed_atSpecified) { simple_changeset.CreatedAt = xml_changeset.created_at; } if (xml_changeset.max_latSpecified) { simple_changeset.MaxLat = xml_changeset.max_lat; } if (xml_changeset.max_lonSpecified) { simple_changeset.MaxLon = xml_changeset.max_lon; } if (xml_changeset.min_latSpecified) { simple_changeset.MinLat = xml_changeset.min_lat; } if (xml_changeset.min_lonSpecified) { simple_changeset.MinLon = xml_changeset.min_lon; } if (xml_changeset.openSpecified) { simple_changeset.Open = xml_changeset.open; } if (xml_changeset.tag != null) { simple_changeset.Tags = new Dictionary<string, string>(); foreach (Osm.Xml.v0_6.tag xml_tag in xml_changeset.tag) { simple_changeset.Tags.Add(xml_tag.k, xml_tag.v); } } if (xml_changeset.uidSpecified) { simple_changeset.UserId = xml_changeset.uid; } simple_changeset.User = xml_changeset.user; return simple_changeset; }
private static List<ChangeSetInfo> CreateChangeSetInfos(ICollection<CvsChangeSet> changesets) { var result = new List<ChangeSetInfo>(changesets.Count); foreach(var item in changesets) { var info = new ChangeSetInfo(item.Author, item.Message, null, item.ChangesetId, item.ChangeDate, null); result.Add(info); } return result; }