public void FullLineByLineGrepFullTestWithTag() { // Set up the repo File.AppendAllText(readmePath, "\nThis is for a fix commit"); repo.Index.Add("README.md"); repo.Commit("feat(Foo): Adding foo feature\n\nFixes #123, #245\nFixed #8000\n\nBREAKING CHANGE: Breaks Mr. Guy!", author, committer); // Set up the repo File.AppendAllText(readmePath, "\nThis is for a fix commit"); repo.Index.Add("README.md"); repo.Commit("fix(Bar): Fixed something in Bar\n\nFixes #200\n\nBREAKING CHANGE: I broke it", author, committer); File.AppendAllText(readmePath, "\nThis is for another commit, which should not show up if Grep does not contain"); repo.Index.Add("README.md"); repo.Commit("chore(Bar): Did a a chore\n\nmessage under chore", author, committer); repo.Tags.Add("v1.0.0", repo.Head.Tip); File.AppendAllText(readmePath, "\nThis is for normal commit, with normal message"); repo.Index.Add("README.md"); repo.Commit("normal message which is Conventional", author, committer); File.AppendAllText(readmePath, "\nThis is the final commit which should go with the first one"); repo.Index.Add("README.md"); repo.Commit("feat(Foo): Extended Foo", author, committer); var changelog = new Changelog(); changelog.Generate(new ChangelogOptions() { Version = "1.0.1", WorkingDirectory = Util.GetFullPath(Util.TEST_REPO_DIR), Grep = ".*" }); var text = File.ReadAllText(TestRepoChangelogPath); var lines = text.Split('\n'); /* * 0 <a name="1.0.1"></a> * 1 ### 1.0.1 (2019-11-15) * 2 * 3 * 4 #### Features * 5 * 6 * **Foo:** Extended Foo ((be8d7e54)) * 7 * 8 * 9 */ Assert.True(lines[0].Contains("1.0.1")); Assert.True(lines[1].StartsWith("### 1.0.1")); Assert.True(lines[4].StartsWith("#### Features")); Assert.True(lines[6].StartsWith("* **Foo:** Extended Foo")); Assert.True(Regex.Match(lines[6], @"\(\w{8}\)").Success); // TODO: Add tests for breaking changes once their formatting is fixed }
private void changelogToolStripMenuItem_Click(object sender, EventArgs e) { Changelog tvInf = new Changelog(); tvInf.ShowDialog(); tvInf.Dispose(); }
/// <inheritdoc /> public async Task <AutoMergeStatus> EvaluateFor(PullRequest pullRequest, CancellationToken cancellationToken) { if (pullRequest == null) { throw new ArgumentNullException(nameof(pullRequest)); } var setRequired = await dataStore.ReadData <RequireChangelogEntry>(pullRequest.Number.ToString(), cancellationToken).ConfigureAwait(false); if (!setRequired.Required.HasValue) { setRequired.Required = generalConfiguration.DefaultChangelogRequired; } var changelog = Changelog.GetChangelog(pullRequest, out bool malformed); var result = new AutoMergeStatus { FailStatusReport = true, RequiredProgress = 2, //setRequired.Required.Value || malformed ? 1 : 0, //TODO:maintainer_can_modify field Progress = (changelog != null ? 1 : 0) }; if (result.Progress < result.RequiredProgress || malformed) { result.Notes.Add(stringLocalizer[malformed ? "ChangelogMalformed" : "NeedsChangelog"]); } return(result); }
private ICollection <Changelog> VgCacheToChaoticOnyx(string text) { text = text.Replace("DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.", ""); text = text.Replace("---", ""); Dictionary <DateTime, Dictionary <string, List <Dictionary <string, string> > > > cache = _deserializer .Deserialize <Dictionary <DateTime, Dictionary <string, List <Dictionary <string, string> > > > >(text); var changelogs = new List <Changelog>(); foreach ((DateTime date, var authors) in cache) { foreach (var(author, changes) in authors) { List <Change> changesList = new(); foreach (var change in changes) { foreach (var(prefix, message) in change) { changesList.Add(new Change(prefix, message)); } } var changelog = new Changelog(author, date, changesList); changelogs.Add(changelog); } } return(changelogs); }
/// <summary> /// Converts this object to a Commit object /// </summary> /// <param name="directory">The directory dependency for proxies</param> /// <param name="loader">The loader object which specifies which objects to load</param> /// <returns></returns> public Commit GetCommit(DirectoryStructure directory, CommitDependencyLoader loader) { Commit[] parents = new Commit[Parents.Length]; for (int i = 0; i < parents.Length; i++) { string p = Parents[i]; if (loader.LoadParents && loader.ShouldLoadParent(p)) { parents[i] = directory.GetCommit(p, loader.GetParent(p)); } else { parents[i] = new CommitProxy(p, directory); } } Changelog changelog = loader.LoadChangelog ? directory.GetChangelog(Changelog) : new ChangelogProxy(Changelog, directory); Version version = loader.LoadVersion ? directory.GetVersion(Hash, loader.LoadVersionData) : new VersionProxy(Version, directory); CommitMetadata metadata = Metadata != null?Metadata.GetMetadata() : throw new FormatException("Commit must contain metadata"); return(new Commit(parents, changelog, version, metadata, Hash)); }
/// <summary> /// Loads the Version from the file directory, using VersionData.Hash as its hash /// </summary> /// <param name="filepath">The absolute path to this Version file</param> /// <param name="directory">The directory from which to load dependencies</param> /// <param name="loadData">Whether or not to read the files into VersionData</param> /// <param name="changelog">An optional Changelog to load the hashes of VersionData</param> /// <returns></returns> public static Version LoadVersion(string filepath, DirectoryStructure directory, bool loadData, Changelog changelog = null) { VersionData data = VersionDataFileManager.LoadTopLevelVD(filepath, "", loadData, directory, changelog); return(new Version(data, data.Hash)); }
public override void DeserializationTest() { var client = new Mock <IRestClient>(); var restParameters = new Mock <IRestParameters>(); IIssuesChangelogService service = new IssuesChangelogService(client.Object, restParameters.Object); string response = @"{ ""changelog"":[{""user"":""stevpet"", ""userName"":""Stevens, Peter"", ""email"":""*****@*****.**"", ""creationDate"":""2017-01-28T08:33:09+0100"", ""diffs"":[{""key"":""resolution"",""newValue"":""WONTFIX""},{""key"":""assignee""},{""key"":""status"",""newValue"":""RESOLVED"",""oldValue"":""OPEN""}]}]}"; client.Setup(p => p.SetPath(It.IsAny <string>())).Returns(client.Object); client.Setup(p => p.Get(It.IsAny <IRestParameters>())).Returns(response); IList <Changelog> changelogs = service.Execute(); Assert.IsNotNull(changelogs, "should be valid list"); Assert.AreEqual(1, changelogs.Count); Changelog changelog = changelogs[0]; Assert.AreEqual("stevpet", changelog.User); Assert.AreEqual("Stevens, Peter", changelog.UserName); Assert.AreEqual("*****@*****.**", changelog.Email); var expected = DateTime.Parse("2017-01-28T08:33:09+0100"); Assert.AreEqual(expected, changelog.CreationDate); Assert.AreEqual(3, changelog.Diffs.Count); }
/// <summary> /// Loads the VersionData that contains all child elements; i.e. the root node /// </summary> /// <param name="dirPath">The absolute path to the version directory in which all files are contained</param> /// <param name="rootName">The filename of the root VersionData</param> /// <param name="loadData">Whether or not to read the files</param> /// <param name="directory">The content directory from which to read</param> /// <param name="changelog">An optional Changelog parameter to fill in hashes</param> /// <returns></returns> public static VersionData LoadTopLevelVD(string dirPath, string rootName, bool loadData, DirectoryStructure directory, Changelog changelog = null) { VDKeyedCollection datas = GetVersionDatas(dirPath, "", loadData, directory, changelog); return(new VersionData(rootName, datas)); }
/// <summary> /// Loads a folder from the file directory into a VersionData /// </summary> /// <param name="dirPath">The absolute path to the version directory in which all files are contained</param> /// <param name="filepath">The relative path to a file or directory from dirpath</param> /// <param name="loadData">Whether or not to read the files</param> /// <param name="directory">The content directory from which to read</param> /// <param name="changelog">An optional Changelog parameter to fill in hashes</param> /// <returns></returns> private static VersionData LoadFile(string dirPath, string filepath, bool loadData, DirectoryStructure directory, Changelog changelog) { string path = Path.Combine(dirPath, filepath); string filename = Path.GetFileName(path); if (loadData) { FileStream fs = new FileStream(path, FileMode.Open); if (changelog == null) { return(new VersionData(filename, fs)); } else { string hash = changelog.GetCachedHash(filepath); return(new VersionData(filename, fs, hash)); } } else { string versionHash = Path.GetFileName(dirPath); if (changelog == null) { return(VersionDataProxy.Create(versionHash, filepath, filename, directory)); } else { string hash = changelog.GetCachedHash(filepath); return(VersionDataProxy.Create(versionHash, filepath, filename, directory, hash)); } } }
/// <summary> /// Metoda vrátí generaci se zadaným pořadovým číslem, které obdrží. Zároveň vymaže všechny budoucí záznamy. /// </summary> /// <param name="number">pořadové číslo generace</param> /// <returns>Metoda vrací generaci s požadovaným pořadovým číslem.</returns> public Generation LoadRecord(int number) { Generation wantedGeneration = Changelog[0].Generation; //generace s požadovaným pořadovým číslem Generation loadedRecord = Changelog[0].Generation; //záznam načtený z Changelogu for (int i = 0; i < Changelog.Count; i++) { //získání generace, která předchází požadované generaci //generaace jsou řazeny chronologicky if (Changelog[i].Generation.GenerationNumber < number) { loadedRecord = Changelog[i].Generation; } } int difference = number - loadedRecord.GenerationNumber; //počet generací mezi načteným záznamem a požadovanou generací wantedGeneration = loadedRecord; //dopočítání požadované generace for (int i = 0; i < difference; i++) { wantedGeneration = new Generation(wantedGeneration.GenerationNumber + 1, wantedGeneration.NextGeneration()); } int serialNumber = Changelog.IndexOf(loadedRecord); //pořadové číslo záznamu v Changelogu, který předchází požadované generaci //vymazání všech generací, které následují Changelog.RemoveRange(serialNumber + 1, Changelog.Count - serialNumber - 1); CurrentGeneration = wantedGeneration.GenerationNumber; //aktuální číslo vykreslené generace return(wantedGeneration); }
public void ShouldAppendToExistingChangelog() { var parser = new ConventionalCommitParser(); var plainLinkBuilder = new PlainLinkBuilder(); var changelog = Changelog.Discover(_testDirectory); changelog.Write(new Version(1, 0, 0), new DateTimeOffset(), plainLinkBuilder, new List <ConventionalCommit> { parser.Parse(new TestCommit("a360d6a307909c6e571b29d4a329fd786c5d4543", "fix: a fix in version 1.0.0")), }); changelog.Write(new Version(1, 1, 0), new DateTimeOffset(), plainLinkBuilder, new List <ConventionalCommit> { parser.Parse(new TestCommit("b360d6a307909c6e571b29d4a329fd786c5d4543", "fix: a fix in version 1.1.0")), }); var changelogContents = File.ReadAllText(changelog.FilePath); changelogContents.ShouldContain("<a name=\"1.0.0\"></a>"); changelogContents.ShouldContain("a fix in version 1.0.0"); changelogContents.ShouldContain("<a name=\"1.1.0\"></a>"); changelogContents.ShouldContain("a fix in version 1.1.0"); }
public void WriteChangeLog(Changelog action) { string filename = Settings.GetUserDataDirectory() + Path.GetFileNameWithoutExtension(Settings.FileName) + "_" + MainV2.comPort.MAV.param["BRD_SERIAL_NUM"].Value.ToString() + ".changelog"; using (StreamWriter sw = new StreamWriter(File.Open(filename, FileMode.Append))) { if (action == Changelog.NewVaultFile) { sw.WriteLine(">>> New Vault file created for " + vehicle_configuration + "/" + vehicle_name + " on " + System.DateTime.Now.ToString() + " by " + operator_name); foreach (KeyValuePair <string, double> entry in _vault_parameters) { sw.WriteLine(entry.Key + "," + entry.Value.ToString()); } } else if (action == Changelog.UpdateVehicle) { sw.WriteLine(">>> Vehicle parameters updated " + vehicle_configuration + "/" + vehicle_name + " on " + System.DateTime.Now.ToString() + " by " + operator_name); foreach (KeyValuePair <string, ParamPair> entry in _diff) { sw.WriteLine(entry.Key + " value on Vehicle (" + entry.Value.inVehicle.ToString() + ") <- updated to " + entry.Value.inVault.ToString()); } } else if (action == Changelog.UpdateVault) { sw.WriteLine(">>> Vault parameters updated " + vehicle_configuration + "/" + vehicle_name + " on " + System.DateTime.Now.ToString() + " by " + operator_name); foreach (KeyValuePair <string, ParamPair> entry in _diff) { sw.WriteLine(entry.Key + " value in Vault (" + entry.Value.inVault.ToString() + ") <- changed to " + entry.Value.inVehicle.ToString()); } } sw.WriteLine("<<< End entry " + System.DateTime.Now.ToString()); } }
public async stt::Task GetChangelogRequestObjectAsync() { moq::Mock <Changelogs.ChangelogsClient> mockGrpcClient = new moq::Mock <Changelogs.ChangelogsClient>(moq::MockBehavior.Strict); GetChangelogRequest request = new GetChangelogRequest { ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"), }; Changelog expectedResponse = new Changelog { ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"), UserEmail = "user_emaildc7bc240", Resource = "resource164eab96", CreateTime = new wkt::Timestamp(), DisplayName = "display_name137f65c2", Type = "typee2cc9d59", Action = "action09558c41", }; mockGrpcClient.Setup(x => x.GetChangelogAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Changelog>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ChangelogsClient client = new ChangelogsClientImpl(mockGrpcClient.Object, null); Changelog responseCallSettings = await client.GetChangelogAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Changelog responseCancellationToken = await client.GetChangelogAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
private bool IsChangelogNeedRecorded(Changelog curChangelog, Changelog startChangelog, Changelog endChangelog) { // 所有分支必须相同 Changelog lastChangelog = null; foreach (Changelog changelog in mPickupInfo.changelogList) { if (curChangelog.oldVersionStr.Equals(changelog.newVersionStr, StringComparison.OrdinalIgnoreCase) && curChangelog.svnBranch.Equals(changelog.svnBranch, StringComparison.OrdinalIgnoreCase)) { lastChangelog = changelog; break; } } if (null == lastChangelog) { return(false); } if (!IsRevisionInside(lastChangelog.svnRevision, startChangelog.svnRevision, endChangelog.svnRevision)) { return(false); } if (!IsRevisionInside(curChangelog.svnRevision, startChangelog.svnRevision, endChangelog.svnRevision)) { return(false); } return(true); }
protected override void InitBindings() { Bindings.Add(this.SetBinding(() => ViewModel.Parameter).WhenSourceChanges(() => { Header.Text = $"{AppResources.Dialog_Changelog_Changelog} v{VersionTracking.CurrentVersion} {ViewModel.Parameter.Date}"; Changelog.SetAdapter(new RecyclerViewAdapterBuilder <string, ChangelogItemHolder>() .WithItems(ViewModel.Parameter.Changelog) .WithContentStretching() .WithResourceId(LayoutInflater, Resource.Layout.item_changelog) .WithDataTemplate(ChangelogDataTemplate) .Build()); if (string.IsNullOrEmpty(ViewModel.Parameter.Note)) { Note.Visibility = ViewStates.Gone; } else { Note.Text = ViewModel.Parameter.Note; } })); Changelog.SetLayoutManager(new LinearLayoutManager(Activity)); Dialog.Window.SetBackgroundDrawableResource(global::Android.Resource.Color.Transparent); }
public async Task <IActionResult> AddNewChangelog([FromBody] NewChangelogEntryModel model) { var user = await TokenHelper.GetUser(User, _userManager); if (user == null) { return(RequestHandler.Unauthorized()); } var category = await _websiteContext.ChangelogCategories.AnyAsync(x => x.Id == model.Category); if (!category) { return(RequestHandler.BadRequest($"No category with id {model.Category} exists")); } var newChange = new Changelog { CategoryId = model.Category, Realm = model.Realm, Content = model.Content, Author = model.Author }; await _websiteContext.Changelogs.AddAsync(newChange); await _websiteContext.SaveChangesAsync(); return(Ok(new { NewId = newChange.Id })); }
private Changelog BuildPickupDiffVersion(int[] startVersions, int[] endVersions, string oemName) { Changelog startChangelog = null, endChangelog = null; foreach (Changelog changelog in mPickupInfo.changelogList) { // 起始Changelog找最先出现的, 终止Changelog找最后出现的 if (null == startChangelog && changelog.newVersionInt[2] == startVersions[0] && changelog.newVersionInt[3] == startVersions[1] && changelog.oemList.Contains(oemName)) { startChangelog = changelog; continue; } if (changelog.newVersionInt[2] == endVersions[0] && changelog.newVersionInt[3] == endVersions[1] && changelog.oemList.Contains(oemName)) { endChangelog = changelog; } } if (null == startChangelog || null == endChangelog) { return(null); } return(BuildPickupChangelog(startChangelog, endChangelog)); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() : base(Gtk.WindowType.Toplevel) { // Initialize the GTK UI Build(); // Bind the handler events this.Game.ProgressChanged += OnModuleInstallationProgressChanged; this.Game.DownloadFinished += OnGameDownloadFinished; this.Game.DownloadFailed += OnGameDownloadFailed; this.Game.LaunchFailed += OnGameLaunchFailed; this.Game.GameExited += OnGameExited; this.Launcher.LauncherDownloadProgressChanged += OnModuleInstallationProgressChanged; this.Launcher.LauncherDownloadFinished += OnLauncherDownloadFinished; this.Launcher.ChangelogDownloadFinished += OnChangelogDownloadFinished; // Set the initial launcher mode SetLauncherMode(ELauncherMode.Inactive, false); // Set the window title this.Title = LocalizationCatalog.GetString("Launchpad - {0}", this.Configuration.GameName); // Create a new changelog widget, and add it to the scrolled window this.Browser = new Changelog(this.BrowserWindow); this.BrowserWindow.ShowAll(); this.IndicatorLabel.Text = LocalizationCatalog.GetString("Idle"); }
public void GetChangelog() { moq::Mock <Changelogs.ChangelogsClient> mockGrpcClient = new moq::Mock <Changelogs.ChangelogsClient>(moq::MockBehavior.Strict); GetChangelogRequest request = new GetChangelogRequest { ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"), }; Changelog expectedResponse = new Changelog { ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"), UserEmail = "user_emaildc7bc240", Resource = "resource164eab96", CreateTime = new wkt::Timestamp(), DisplayName = "display_name137f65c2", Type = "typee2cc9d59", Action = "action09558c41", }; mockGrpcClient.Setup(x => x.GetChangelog(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ChangelogsClient client = new ChangelogsClientImpl(mockGrpcClient.Object, null); Changelog response = client.GetChangelog(request.Name); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MakeChangelog() { Version v1 = directory.GetVersion("updateTest"); Version v2 = directory.GetVersion("originalTest"); Changelog changelog = v2.GetChangelog(v1); int count = changelog.Added.Count; }
public void BasiChangelogConstructorWorks() { Assert.DoesNotThrow(() => { var c = new Changelog(); }); }
public void AddChangelog(string Type, int userid, int blogid) { Changelog log = new Changelog { Time = DateTime.Now, Type = Type, UserId = userid, BlogsId = blogid }; db.Changelogs.Add(log); db.SaveChanges(); }
private void ChangelogEditor_Load(object sender, EventArgs e) { LoadConfig(); contextMenu.Items[0].Click += new EventHandler(editEntryButt_Click); contextMenu.Items[1].Click += new EventHandler(delEntryButt_Click); dateBox.Value = DateTime.Now; changelog = new Changelog(); UpdateListView(); }
public void DiffWorkingVersion() { Version v1 = directory.GetVersion("updateTest"); Version v2 = directory.GetVersion("originalTest"); Changelog changelog = v2.GetChangelog(v1); Version v = v1.GetChangelogVersion(changelog); directory.CreateVersion(v); }
private IEnumerable <string> getJIRANumbers(Changelog changelog) { if (changelog != null) { string pattern = @"V[RP](SGUI)?-[\d]+"; return(Regex.Matches(changelog.message, pattern, RegexOptions.IgnoreCase).Cast <Match>().Select(m => m.Value)); } return(null); }
private int SaveRecordSheet(Worksheet sheet, Changelog saveChangelog) { // 清空已测->未测的行 ClearRow(sheet, saveChangelog); // 添加未测->已测的行 InstertRow(sheet, saveChangelog); return(0); }
public void GetChangelog() { Changelog c = directory.GetChangelog("mergeOtherMain"); Assert.IsTrue(c.Added.ContainsKey("file6.txt")); Assert.IsTrue(c.Modified.ContainsKey("file2.txt")); c.Renamed.TryGetValue("file1.txt", out string f4txt); Assert.AreEqual(f4txt, "file4.txt"); Assert.IsTrue(c.Removed.Contains("file3.txt")); }
public void ShouldGenerateAChangelogEvenForEmptyCommits() { var changelog = Changelog.Discover(_testDirectory); changelog.Write(new Version(1, 1, 0), new DateTimeOffset(), new List <ConventionalCommit>()); var wasChangelogWritten = File.Exists(Path.Join(_testDirectory, "CHANGELOG.md")); Assert.True(wasChangelogWritten); }
public void MustPassVersionParam() { var ex = Assert.Throws <Exception>(() => { var changelog = new Changelog(); changelog.Generate(""); }); Assert.AreEqual("No version specified", ex.Message); }
public int SetData(Object data) { if (!(data is Changelog)) { return(-1); } mChangelog = data as Changelog; return(0); }
protected void btnAdd_Click(object sender, EventArgs e) { Changelog changelog = null; if (Request.QueryString["Edit"] == null) { changelog = new Changelog(); } else foreach (Changelog c in Game.PortalData.Changelog) if (Request.QueryString["Edit"] == c.GetHashCode().ToString()) { changelog = c; break; } changelog.Name = txtCreator.Text; changelog.Text = txtText.Text; changelog.Date = DateTime.Parse(txtDate.Text); Game.PortalData.Changelog.Sort(new Changelog.ChangelogComparer()); txtText.Text = ""; txtDate.Text = DateTime.Now.ToString(); FillDropdown(); }
public void ChangelogTaskTest() { // update dummy assemblyInfo File.Delete(dummyAssemblyInfo); using (var writer = new StreamWriter(dummyAssemblyInfo)) { writer.WriteLine("[assembly: AssemblyVersion(\"2.0.0.0\")]"); writer.Close(); } Changelog task = new Changelog { AssemblyInfoPath = dummyAssemblyInfo, BuildEngine = new DummyBuildEngine() }; bool result = task.Execute(); Assert.IsTrue(result); }