<commit_before>define([
    'js/Client/ClientLogCore',
    'core/lib/sha1',
    'common/commonUtil',
    'js/Client/ClientNode',
    'js/Client/ClientMeta'],
    function(ClientCore,SHA1,commonUtil,ClientNode,ClientMeta){
    'use strict';
    var KEY        = "_id";
    var INSERTARR  = commonUtil.insertIntoArray;
    var ISSET      = commonUtil.issetrelid;
    var MINSETID   = commonUtil.minsetid;
    var RELFROMID  = commonUtil.relidfromid;
    var RELFROMSET = commonUtil.setidtorelid;
    var COPY       = commonUtil.copy;
    var ClientProject = function(parameters){ //it represents one working copy of a project attached to a given branch of the project
        var self = this,
            storage = parameters.storage, //the storage of the project
            master = parameters.master, //the client master
            id = parameters.id,
            userstamp = parameters.user,
            mycommit = parameters.commit,
            branch = parameters.branch,
            currentRoot = null,
            users = {},
            currentCore = null,
            currentNodes = {},
            currentPathes = {},
            currentNupathes = {},
            clipboard = [],
            //meta = new ClientMeta(master),
            status = null,
            readonly = parameters.readonly || false,
            intransaction = false;

        //functions that client master will call
        var dismantle = function(){
            currentCore = null;
            currentRoot = null;
            currentNodes = {};
            currentPathes = {};
            clipboard = [];
            status = null;
            users = {};
            //master.changeStatus(id,status);
        };
        var goOffline = function(){
            //this function can be called internally if we lose online status due to some conflict
            status = "offline";
            master.changeStatus(id,status);
        };
        var goOnline = function(callback){
            callback = callback || function(){};
            if(status !== 'online'){
                status = 'online';
                storage.requestPoll(branch,poll);
                modifyRootOnServer("- going online -",callback);
            } else {
                callback();
            }
        };
        var networkError = function(){
            status = 'nonetwork';
            master.changeStatus(id,status);
        };
        var createEmpty = function(callback){
            var core = new ClientCore({
                storage: storage,
                logger: null
            });
            currentCore = core;
            var root = core.createNode();
            var rootid = storeNode(root);
            core.setRegistry(root,"isConnection",false);
            core.setRegistry(root,"position",{ "x": 0, "y": 0});
            core.setAttribute(root,"name","root");
            core.setRegistry(root,"isMeta",false);
            //we create meta-meta
            var metameta = core.createNode(root);
            var metametaid = storeNode(metameta);
            core.setRegistry(metameta,"isConnection",false);
            core.setRegistry(metameta,"position",{ "x": 0, "y": 0});
            core.setAttribute(metameta,"name","META-META");
            core.setRegistry(metameta,"isMeta",false);
            var mmobject = core.createNode(metameta);
            var mmobjectid = storeNode(mmobject);
            core.setRegistry(mmobject,"isConnection",false);
            core.setRegistry(mmobject,"position",{ "x": 0, "y": 0});
            core.setAttribute(mmobject,"name","object");
            core.setRegistry(mmobject,"isMeta",false);
            addMember(mmobjectid,mmobjectid,'ValidChildren');
            addMember(mmobjectid,mmobjectid,'ValidSource');
            addMember(mmobjectid,mmobjectid,'ValidDestination');
            addMember(mmobjectid,mmobjectid,'ValidInheritor');


            //now we also creates the META folder with one object and the MODEL folder which aims to be the starting point for the projects
            var meta = core.createNode(root);
            var metaid = storeNode(meta);
            core.setRegistry(meta,"isConnection",false);
            core.setRegistry(meta,"position",{ "x": 0, "y": 0});
            core.setAttribute(meta,"name","META");
            core.setRegistry(meta,"isMeta",true);
            addMember(metaid,mmobjectid,'ValidChildren');
            var model = core.createNode(root);
            var modelid = storeNode(model);
            core.setRegistry(model,"isConnection",false);
            core.setRegistry(model,"position",{ "x": 0, "y": 0});
            core.setAttribute(model,"name","MODEL");
            core.setRegistry(model,"isMeta",false);
            //now we should save this and create the first commit so afterwards we will be able to connect to this project...
            var key = core.persist(root,function(err){
                if(err){<commit_msg>now the mtea-sets of the base object are empty because we not use the inheritance yet<commit_after>define([
    'js/Client/ClientLogCore',
    'core/lib/sha1',
    'common/commonUtil',
    'js/Client/ClientNode',
    'js/Client/ClientMeta'],
    function(ClientCore,SHA1,commonUtil,ClientNode,ClientMeta){
    'use strict';
    var KEY        = "_id";
    var INSERTARR  = commonUtil.insertIntoArray;
    var ISSET      = commonUtil.issetrelid;
    var MINSETID   = commonUtil.minsetid;
    var RELFROMID  = commonUtil.relidfromid;
    var RELFROMSET = commonUtil.setidtorelid;
    var COPY       = commonUtil.copy;
    var ClientProject = function(parameters){ //it represents one working copy of a project attached to a given branch of the project
        var self = this,
            storage = parameters.storage, //the storage of the project
            master = parameters.master, //the client master
            id = parameters.id,
            userstamp = parameters.user,
            mycommit = parameters.commit,
            branch = parameters.branch,
            currentRoot = null,
            users = {},
            currentCore = null,
            currentNodes = {},
            currentPathes = {},
            currentNupathes = {},
            clipboard = [],
            //meta = new ClientMeta(master),
            status = null,
            readonly = parameters.readonly || false,
            intransaction = false;

        //functions that client master will call
        var dismantle = function(){
            currentCore = null;
            currentRoot = null;
            currentNodes = {};
            currentPathes = {};
            clipboard = [];
            status = null;
            users = {};
            //master.changeStatus(id,status);
        };
        var goOffline = function(){
            //this function can be called internally if we lose online status due to some conflict
            status = "offline";
            master.changeStatus(id,status);
        };
        var goOnline = function(callback){
            callback = callback || function(){};
            if(status !== 'online'){
                status = 'online';
                storage.requestPoll(branch,poll);
                modifyRootOnServer("- going online -",callback);
            } else {
                callback();
            }
        };
        var networkError = function(){
            status = 'nonetwork';
            master.changeStatus(id,status);
        };
        var createEmpty = function(callback){
            var core = new ClientCore({
                storage: storage,
                logger: null
            });
            currentCore = core;
            var root = core.createNode();
            var rootid = storeNode(root);
            core.setRegistry(root,"isConnection",false);
            core.setRegistry(root,"position",{ "x": 0, "y": 0});
            core.setAttribute(root,"name","root");
            core.setRegistry(root,"isMeta",false);
            //we create meta-meta
            var metameta = core.createNode(root);
            var metametaid = storeNode(metameta);
            core.setRegistry(metameta,"isConnection",false);
            core.setRegistry(metameta,"position",{ "x": 0, "y": 0});
            core.setAttribute(metameta,"name","META-META");
            core.setRegistry(metameta,"isMeta",false);
            var mmobject = core.createNode(metameta);
            var mmobjectid = storeNode(mmobject);
            core.setRegistry(mmobject,"isConnection",false);
            core.setRegistry(mmobject,"position",{ "x": 0, "y": 0});
            core.setAttribute(mmobject,"name","object");
            core.setRegistry(mmobject,"isMeta",false);
            //TODO currently as we use copy and not inheritance we have to set the base object with empty meta-sets...
            //addMember(mmobjectid,mmobjectid,'ValidChildren');
            //addMember(mmobjectid,mmobjectid,'ValidSource');
            //addMember(mmobjectid,mmobjectid,'ValidDestination');
            //addMember(mmobjectid,mmobjectid,'ValidInheritor');


            //now we also creates the META folder with one object and the MODEL folder which aims to be the starting point for the projects
            var meta = core.createNode(root);
            var metaid = storeNode(meta);
            core.setRegistry(meta,"isConnection",false);
            core.setRegistry(meta,"position",{ "x": 0, "y": 0});
            core.setAttribute(meta,"name","META");
            core.setRegistry(meta,"isMeta",true);
            addMember(metaid,mmobjectid,'ValidChildren');
            var model = core.createNode(root);
            var modelid = storeNode(model);
            core.setRegistry(model,"isConnection",false);
            core.setRegistry(model,"position",{ "x": 0, "y": 0});
            core.setAttribute(model,"name","MODEL");
            core.setRegistry(model,"isMeta",false);
            //now we should save this and create the first commit so afterwards we will be able to connect to this project...
            var key = core.persist(root,function(err){
                if(err){
{'fraction_non_alphanumeric': 0.11601550849985089, 'fraction_numerical': 0.0023859230539815092, 'mean_word_length': 2.0011933174224343, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 3, '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': '3863671', 'n_tokens_mistral': 2606, 'n_tokens_neox': 2553, 'n_words': 623}