Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the start of the utility notebooks #4202

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 251 additions & 0 deletions src/benchmarks/gc/Utility-Notebooks/CommitDetails.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Script To Get Commit Differences Between Two Commits for the GC Authors "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Set Variables"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"string pathToRepository = \"\"; // Fill in e.g., @\"C:\\Users\\musharm\\source\\repos\\runtime\";\n",
"string baselineCommit = \"2d7eea2\";\n",
"string comparandCommit = \"9e6ba1f\";\n",
"string outputPath = \"\"; // Fill in e.g., \"C:\\\\Users\\\\musharm\\\\Desktop\\\\output.md\";"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Instantiate Methods"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"using System.Diagnostics;\n",
"using System.IO;\n",
"\n",
"const string gitCommand = @\"log --author=\"\"^Maoni Stephens\"\" --author=\"\"^Andrew Au\"\" --author=\"\"^Mark Plesko\"\" --author=\"\"^Mukund Raghav Sharma\"\" --author=\"\"^Manish Godse\"\" --pretty=format:\"\"Date: %ad%nAuthor: %an%nTitle: %s%n\"\"\";\n",
"\n",
"public void SaveMarkdownTable(string repositoryPath, string baselineCommit, string comparandCommit, string outputPath)\n",
"{\n",
" (string output, string error) = RunGitCommand(repositoryPath, baselineCommit, comparandCommit);\n",
" if (!string.IsNullOrEmpty(error))\n",
" {\n",
" Console.WriteLine(\"Failed with error: \" + error);\n",
" return;\n",
" }\n",
"\n",
" string table = CreateMarkdownTable(output);\n",
" SaveMarkdownTable(table, outputPath);\n",
"}\n",
"\n",
"public (string? output, string? error) RunGitCommand(string repositoryPath, string baselineCommit, string comparandCommit)\n",
"{\n",
" ProcessStartInfo startInfo = new ProcessStartInfo();\n",
" startInfo.FileName = \"git\";\n",
" startInfo.Arguments = gitCommand + \" \" + baselineCommit + \"...\" + comparandCommit;\n",
" startInfo.WorkingDirectory = repositoryPath;\n",
" startInfo.RedirectStandardOutput = true;\n",
" startInfo.RedirectStandardError = true;\n",
" startInfo.UseShellExecute = false;\n",
"\n",
" Process process = new Process();\n",
" process.StartInfo = startInfo;\n",
" process.Start();\n",
"\n",
" string output = process.StandardOutput.ReadToEnd();\n",
" string error = process.StandardError.ReadToEnd();\n",
" process.WaitForExit();\n",
"\n",
" return (output, error);\n",
"}\n",
"\n",
"public string CreateMarkdownTable(string details)\n",
"{\n",
" string[] lines = details.Split(\"\\n\\n\");\n",
"\n",
" StringBuilder table = new StringBuilder();\n",
" table.AppendLine(\"| Date | Author | Title | PR |\");\n",
" table.AppendLine(\"|------|--------|-------|----|\");\n",
"\n",
" foreach (string line in lines)\n",
" {\n",
" string[] fields = line.Split(\"\\n\");\n",
"\n",
" string date = fields[0].Replace(\"Date: \", \"\");\n",
" string author = fields[1].Replace(\"Author: \", \"\");\n",
" string title = fields[2].Replace(\"Title: \", \"\");\n",
"\n",
" // Extract number in parentheses from the title\n",
" string pr = \"\";\n",
" int startIndex = title.IndexOf('(');\n",
" int endIndex = title.IndexOf(')');\n",
" if (startIndex != -1 && endIndex != -1)\n",
" {\n",
" pr = title.Substring(startIndex + 1, endIndex - startIndex - 1);\n",
" }\n",
"\n",
" // Create markdown link for PR\n",
" string prLink = $\"[{pr}](https://github.com/dotnet/runtime/pull/{pr.Replace(\"#\", \"\")})\";\n",
"\n",
" table.AppendLine($\"| {date} | {author} | {title} | {prLink} |\");\n",
" }\n",
"\n",
" return table.ToString();\n",
"}\n",
"\n",
"// \n",
"public void SaveMarkdownTable(string content, string path)\n",
"{\n",
" File.WriteAllText(path, content);\n",
"}\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Run"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"SaveMarkdownTable(pathToRepository, baselineCommit, comparandCommit, outputPath);"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div class=\"dni-plaintext\"><pre>16056</pre></div><style>\r\n",
".dni-code-hint {\r\n",
" font-style: italic;\r\n",
" overflow: hidden;\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview {\r\n",
" white-space: nowrap;\r\n",
"}\r\n",
".dni-treeview td {\r\n",
" vertical-align: top;\r\n",
" text-align: start;\r\n",
"}\r\n",
"details.dni-treeview {\r\n",
" padding-left: 1em;\r\n",
"}\r\n",
"table td {\r\n",
" text-align: start;\r\n",
"}\r\n",
"table tr { \r\n",
" vertical-align: top; \r\n",
" margin: 0em 0px;\r\n",
"}\r\n",
"table tr td pre \r\n",
"{ \r\n",
" vertical-align: top !important; \r\n",
" margin: 0em 0px !important;\r\n",
"} \r\n",
"table th {\r\n",
" text-align: start;\r\n",
"}\r\n",
"</style>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<table><tbody><tr><td><img src=\"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAcgAAAHICAYAAADKoXrq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BIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAIBBIAAoEEgEAgASAQSAAI7uv9uFkAgNvd/A8A1U9HVwv36gAAAABJRU5ErkJggg==\" width=\"125em\"></img></td><td style=\"line-height:.8em\"><p style=\"font-size:1.5em\"><b>.NET Interactive</b></p><p>&#169; 2020 Microsoft Corporation</p><p><b>Version: </b>1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074</p><p><b>Library version: </b>1.0.0-beta.24229.4+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074</p><p><b>Build date: </b>2024-05-01T22:47:43.3565220Z</p><p><a href=\"https://github.com/dotnet/interactive\">https://github.com/dotnet/interactive</a></p></td></tr></tbody></table>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"System.Diagnostics.Process.GetCurrentProcess().Id\n",
"#!about"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"name": "polyglot-notebook"
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"languageName": "csharp",
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading