finish commit differentiating script
This commit is contained in:
parent
86070aa16b
commit
cbb326f904
4 changed files with 97 additions and 2 deletions
13
ManagementScript/src/Commit.bf
Normal file
13
ManagementScript/src/Commit.bf
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace ManagementScript;
|
||||
|
||||
using System;
|
||||
|
||||
class Commit
|
||||
{
|
||||
public this(StringView data)
|
||||
{
|
||||
Data.Append(data);
|
||||
}
|
||||
|
||||
public String Data = new .(1000) ~ delete _;
|
||||
}
|
13
ManagementScript/src/Diff.bf
Normal file
13
ManagementScript/src/Diff.bf
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace ManagementScript;
|
||||
|
||||
using System;
|
||||
|
||||
class Diff
|
||||
{
|
||||
public this(StringView data)
|
||||
{
|
||||
Data.Append(data);
|
||||
}
|
||||
|
||||
public String Data = new .(1000) ~ delete _;
|
||||
}
|
|
@ -1,11 +1,77 @@
|
|||
namespace ManagementScript;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
|
||||
class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
public static String Target = "../data/data.txt";
|
||||
|
||||
public static int Main()
|
||||
{
|
||||
/*
|
||||
The main goal here is converting this:
|
||||
|
||||
683248c66683c8cb3d53fd774adb072fbc6b8fdf,Booklordofthedings,Booklordofthedings@tutanota.com,1724077446,N
|
||||
10 10 gmtk_2024/levels/Level_2_Rooms/level_2_room_2.tscn
|
||||
2 2 gmtk_2024/levels/Level_2_Rooms/level_2_room_3.tscn
|
||||
5 0 gmtk_2024/levels/Level_2_Rooms/level_2_room_4.tscn
|
||||
|
||||
|
||||
|
||||
To this:
|
||||
|
||||
Commits.txt
|
||||
683248c66683c8cb3d53fd774adb072fbc6b8fdf,Booklordofthedings,Booklordofthedings@tutanota.com,1724077446,N
|
||||
Diffs.txt
|
||||
683248c66683c8cb3d53fd774adb072fbc6b8fdf 10 10 gmtk_2024/levels/Level_2_Rooms/level_2_room_2.tscn
|
||||
683248c66683c8cb3d53fd774adb072fbc6b8fdf 2 2 gmtk_2024/levels/Level_2_Rooms/level_2_room_3.tscn
|
||||
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;
|
||||
|
||||
List<Commit> commits = new .();
|
||||
defer { DeleteContainerAndItems!(commits); }
|
||||
|
||||
List<Commit> diffs = new .();
|
||||
defer { DeleteContainerAndItems!(diffs); }
|
||||
|
||||
StringView lastCommit = "";
|
||||
|
||||
for(var line in input.Split('\n'))
|
||||
{
|
||||
if(line.IsEmpty)
|
||||
continue;
|
||||
|
||||
if(line.Contains('\t'))
|
||||
{
|
||||
diffs.Add(new .(scope $"{lastCommit} {line}"));
|
||||
}
|
||||
else
|
||||
{
|
||||
lastCommit = line.Split(',').GetNext();
|
||||
commits.Add(new .(line));
|
||||
}
|
||||
}
|
||||
delete input;
|
||||
|
||||
String cfile = new String();
|
||||
for(var i in commits)
|
||||
cfile.Append(scope $"{i.Data}\n");
|
||||
File.WriteAllText("../data/commits.txt", cfile);
|
||||
delete cfile;
|
||||
|
||||
String dfile = new String();
|
||||
for(var i in diffs)
|
||||
dfile.Append(scope $"{i.Data}\n");
|
||||
File.WriteAllText("../data/diffs.txt", dfile);
|
||||
delete dfile;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -11,3 +11,6 @@ cd data
|
|||
git clone %repo% target
|
||||
cd target
|
||||
git log --pretty=format:"%%H,%%an,%%ae,%%at,%%G?" --numstat > ../data.txt
|
||||
|
||||
cd ../../ManagementScript
|
||||
BeefBuild -run -config=Release
|
||||
|
|
Loading…
Add table
Reference in a new issue