<commit_before>using GLib;

namespace Wiz {
	public class Version : GLib.Object {
		/* A Version is a pair of Graph objects, one representing the commit
		 * the other representing the blob
		 */
		public Bit bit { get; construct; }
		public string version_uuid { get; construct; }

		private Commit commit;

		/* deprecated */
		protected string blob_id {
			get {
				return this.commit.blob;
			}
		}

		public string committer {
			get {
				return this.commit.committer;
			}
		}

		public int timestamp {
			get {
				return this.commit.timestamp;
			}
		}

		public Version? previous {
			owned get {
				var v = this.bit.commits.get_backward(this.version_uuid);
				if (v == null)
					return null;
				return new Version(this.bit, v);
			}
		}

		public Version? next {
			owned get {
				var v = this.bit.commits.get_forward(this.version_uuid);
				if (v == null)
					return null;
				return new Version(this.bit, v);
			}
		}

		public List<Version> parents {
			owned get {
				var parents = new List<Version>();
				foreach (var p in this.bit.commits.get_backwards(this.version_uuid))
					parents.append(new Version(this.bit, p));
				return parents;
			}
		}

		public List<Version> children {
			owned get {
				var children = new List<Version>();
				foreach (var c in this.bit.commits.get_forwards(this.version_uuid))
					children.append(new Version(this.bit, c));
				return children;
			}
		}

		private Blob blob;
		private MappedFile file;

		public Version(Bit bit, string version_uuid) {
			this.bit = bit;
			this.version_uuid = version_uuid;

			this.commit = this.bit.commits.lookup_commit(this.version_uuid);
		}

		void _open_blob() throws GLib.FileError {
			if (this.file == null) {
				this.blob = new Blob.from_uuid(this.bit.blobs, this.commit.blob);
				this.file = this.blob.read();
			}
		}

		public long get_length() throws GLib.FileError {
			this._open_blob();
			return this.file.get_length();
		}

		public GLib.InputStream read() throws GLib.FileError {
			this._open_blob();
			return new MemoryInputStream.from_data(this.file.get_contents(), this.file.get_length(), null);
		}

		public char *read_as_string() throws GLib.FileError {
			this._open_blob();
			return (char *)this.file.get_contents();
		}
	}
}
<commit_msg>All people to build a commit on top of a given version<commit_after>using GLib;

namespace Wiz {
	public class Version : GLib.Object {
		/* A Version is a pair of Graph objects, one representing the commit
		 * the other representing the blob
		 */
		public Bit bit { get; construct; }
		public string version_uuid { get; construct; }

		private Commit commit;

		/* deprecated */
		protected string blob_id {
			get {
				return this.commit.blob;
			}
		}

		public string committer {
			get {
				return this.commit.committer;
			}
		}

		public int timestamp {
			get {
				return this.commit.timestamp;
			}
		}

		public Version? previous {
			owned get {
				var v = this.bit.commits.get_backward(this.version_uuid);
				if (v == null)
					return null;
				return new Version(this.bit, v);
			}
		}

		public Version? next {
			owned get {
				var v = this.bit.commits.get_forward(this.version_uuid);
				if (v == null)
					return null;
				return new Version(this.bit, v);
			}
		}

		public List<Version> parents {
			owned get {
				var parents = new List<Version>();
				foreach (var p in this.bit.commits.get_backwards(this.version_uuid))
					parents.append(new Version(this.bit, p));
				return parents;
			}
		}

		public List<Version> children {
			owned get {
				var children = new List<Version>();
				foreach (var c in this.bit.commits.get_forwards(this.version_uuid))
					children.append(new Version(this.bit, c));
				return children;
			}
		}

		private Blob blob;
		private MappedFile file;

		public Version(Bit bit, string version_uuid) {
			this.bit = bit;
			this.version_uuid = version_uuid;

			this.commit = this.bit.commits.lookup_commit(this.version_uuid);
		}

		public CommitBuilder get_commit_builder() {
			var cb = new CommitBuilder(this.bit.commits);
			cb.add_parent(this.version_uuid);
			return cb;
		}


		/* STUFF BELOW HERE CONSIDERED FAIL */

		void _open_blob() throws GLib.FileError {
			if (this.file == null) {
				this.blob = new Blob.from_uuid(this.bit.blobs, this.commit.blob);
				this.file = this.blob.read();
			}
		}

		public long get_length() throws GLib.FileError {
			this._open_blob();
			return this.file.get_length();
		}

		public GLib.InputStream read() throws GLib.FileError {
			this._open_blob();
			return new MemoryInputStream.from_data(this.file.get_contents(), this.file.get_length(), null);
		}

		public char *read_as_string() throws GLib.FileError {
			this._open_blob();
			return (char *)this.file.get_contents();
		}
	}
}

{'fraction_non_alphanumeric': 0.1140222175644519, 'fraction_numerical': 0.0, 'mean_word_length': 2.996649916247906, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5482347', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1551, 'n_words': 400}