Fix document formatting a bit
Warning: there is still a bug here that seemingly limits binaries to 0
This commit is contained in:
parent
431b6e9634
commit
a5640bcd1b
4 changed files with 94 additions and 9 deletions
|
@ -6,12 +6,12 @@ output: html_document
|
|||
---
|
||||
<div style="font-family=sans-serif; font-size:1.5rem;">
|
||||
|
||||
system("get.data.bat")
|
||||
|
||||
|
||||
|
||||
```{r echo=FALSE, include=FALSE, warning = FALSE}
|
||||
|
||||
|
||||
system("get.data.bat")
|
||||
system("format.data.bat")
|
||||
|
||||
diffs <- read.delim("data/diffs.txt")
|
||||
commits <- read.csv("data/commits.txt", sep=";")
|
||||
|
@ -75,6 +75,7 @@ Die Variablen die Ausgelesen werden beinhalten zwei Datensets mit einer 1:n Bezi
|
|||
- Email *//Email*
|
||||
- Time *//Zeitcode wann der Commit erstellt wurde*
|
||||
- Signed *//Ob dieser Comit mit einem Schlüssel "unterschrieben" wurde*
|
||||
- Binaries *//Wie viele binäre Dateien mit dem Commit verändert wurden*
|
||||
|
||||
#### diffs
|
||||
- Commit Hash *//Representiert die Id des jeweiligen Commits*
|
||||
|
@ -103,10 +104,6 @@ Dies wird von Git benutzt, um anzuzeigen, dass es sich um eine binäre Datei han
|
|||
Allerdings ist die tatsache, dass eine Binäre Datei geändert wurde eine weitere Variable, die möglicherweise für
|
||||
das Model interessant sein könnte.
|
||||
|
||||
```{r}
|
||||
##TODO: Cange dataset to attach "Binary files changed" to commits
|
||||
```
|
||||
|
||||
## Quellen
|
||||
|
||||
Sämtlicher Quellcode dieser Arbeit ist online verfügbar unter:
|
||||
|
|
79
ManagementScript/src/BinaryTester.bf
Normal file
79
ManagementScript/src/BinaryTester.bf
Normal file
|
@ -0,0 +1,79 @@
|
|||
namespace ManagementScript;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
|
||||
class BinaryTester
|
||||
{
|
||||
/*
|
||||
Get all commits by lines
|
||||
Add bin changes field to csv
|
||||
go through all changes
|
||||
if bin file changes exist add them
|
||||
*/
|
||||
|
||||
Dictionary<String, uint32> binaryDiffs = new .() ~ DeleteDictionaryAndKeys!(_);
|
||||
|
||||
|
||||
public this()
|
||||
{
|
||||
{
|
||||
String inputDiffs = new .();
|
||||
String outputDiffs = new .();
|
||||
File.ReadAllText("../data/diffs.txt", inputDiffs);
|
||||
|
||||
var e = inputDiffs.Split('\n');
|
||||
outputDiffs.Append(scope $"{e.GetNext()}\n");
|
||||
lines: for(var line in e)
|
||||
{
|
||||
///Check if the line contains a binary diff, increment the counter and extract it
|
||||
var parts = line.Split('\t');
|
||||
var name = scope String(parts.GetNext());
|
||||
if(!binaryDiffs.ContainsKeyAlt<StringView>(name))
|
||||
binaryDiffs.Add(new .(name), 0);
|
||||
|
||||
for(var part in parts)
|
||||
{
|
||||
if(part == "-")
|
||||
{
|
||||
binaryDiffs[name] += 1;
|
||||
continue lines;
|
||||
}
|
||||
}
|
||||
//The line does not contain a binary diff, we can append it to the normal file
|
||||
outputDiffs.Append(scope $"{line}\n");
|
||||
}
|
||||
|
||||
File.WriteAllText("../data/diffs.txt", outputDiffs);
|
||||
delete outputDiffs;
|
||||
delete inputDiffs;
|
||||
}
|
||||
|
||||
|
||||
//We now have binary diffs
|
||||
|
||||
|
||||
String inputCommits = new .();
|
||||
defer delete inputCommits;
|
||||
String outputCommits = new .();
|
||||
defer delete outputCommits;
|
||||
|
||||
|
||||
File.ReadAllText("../data/commits.txt", inputCommits);
|
||||
var e = inputCommits.Split('\n');
|
||||
outputCommits.Append(scope $"{e.GetNext().Value};binaries\n");
|
||||
for(var line in e)
|
||||
{
|
||||
var commithash = line.Split(';').GetNext().Value;
|
||||
if(!binaryDiffs.ContainsKeyAlt<StringView>(commithash))
|
||||
{
|
||||
outputCommits.Append(scope $"{line};0\n");
|
||||
continue;
|
||||
}
|
||||
outputCommits.Append(scope $"{line};{binaryDiffs[scope .(commithash)]}\n");
|
||||
}
|
||||
|
||||
File.WriteAllText("../data/commits.txt", outputCommits, false);
|
||||
}
|
||||
}
|
|
@ -8,8 +8,14 @@ class Program
|
|||
{
|
||||
public static String Target = "../data/data.txt";
|
||||
|
||||
public static int Main()
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
if(args.Count > 0 && args[0] == "bin")
|
||||
{
|
||||
scope BinaryTester(); //Used for the second conversion
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
The main goal here is converting this:
|
||||
|
||||
|
@ -30,7 +36,6 @@ class Program
|
|||
683248c66683c8cb3d53fd774adb072fbc6b8fdf 5 0 gmtk_2024/levels/Level_2_Rooms/level_2_room_4.tscn
|
||||
*/
|
||||
|
||||
|
||||
String input = new .(10000);
|
||||
if(File.ReadAllText(Target, input) case .Err)
|
||||
return -1;
|
||||
|
|
4
format.data.bat
Normal file
4
format.data.bat
Normal file
|
@ -0,0 +1,4 @@
|
|||
@ECHO OFF
|
||||
cd ManagementScript
|
||||
|
||||
BeefBuild -run -config=Release -args bin
|
Loading…
Add table
Reference in a new issue