sync
authorAlan Knowles <alan@roojs.com>
Thu, 1 Nov 2018 13:03:53 +0000 (21:03 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 1 Nov 2018 13:03:53 +0000 (21:03 +0800)
Clones.bjs
Clones.vala
GitMonitor.vala
GitMonitorQueue.vala [new file with mode: 0644]
GitRepo.vala
Makefile.am
RooTicket.vala

index 68cb9b2..a1630a7 100644 (file)
@@ -13,8 +13,8 @@
     "response" : "(self, response_id) =>  { \n \n        this.el.hide();\n  \n}"
    },
    "default_width" : 800,
     "response" : "(self, response_id) =>  { \n \n        this.el.hide();\n  \n}"
    },
    "default_width" : 800,
-   "| void show" : "()    {\n\n    \n    this.el.set_deletable(false);\n    this.el.set_gravity(Gdk.Gravity.NORTH);\n    this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n    this.el.show_all();\n    _this.reposStore.load();\n    // load clones..\n//     this.get('/reposStore').load();\n    \n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n//    var run_ret = this.el.run();\n//    if (run_ret < 1 ) {\n//        return  \"DONE\";\n//    }\n//    print(\"RUN RETURN : \" + run_ret);\n//    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
    "$ deletable" : true,
    "$ deletable" : true,
+   "| void show" : "()    {\n\n    \n    this.el.set_deletable(false);\n    this.el.set_gravity(Gdk.Gravity.NORTH);\n    this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n    this.el.show_all();\n    _this.reposStore.load();\n    // load clones..\n//     this.get('/reposStore').load();\n    \n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n//    var run_ret = this.el.run();\n//    if (run_ret < 1 ) {\n//        return  \"DONE\";\n//    }\n//    print(\"RUN RETURN : \" + run_ret);\n//    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
    "title" : "Manage Clones",
    "xtype" : "Dialog",
    "default_height" : 500,
    "title" : "Manage Clones",
    "xtype" : "Dialog",
    "default_height" : 500,
           "clicked" : "() => {\n\n/*    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Remotes =     imports.Remotes.Remotes;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Remotes.repo = repo;\n    Remotes.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Remotes.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n  */   \n    \n     \n\n       \n    \n    \n}"
          },
          "label" : "Remotes / Clones",
           "clicked" : "() => {\n\n/*    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Remotes =     imports.Remotes.Remotes;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Remotes.repo = repo;\n    Remotes.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Remotes.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n  */   \n    \n     \n\n       \n    \n    \n}"
          },
          "label" : "Remotes / Clones",
-         "* pack" : "add",
          "xtype" : "Button",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
          "listeners" : {
          "$ xns" : "Gtk"
         },
         {
          "listeners" : {
-          "clicked" : "() => {\n// \n\n\tNewBranch.singleton().show();\n\n/*\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Branches =     imports.Branches.Branches;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Branches.repo = repo;\n    Branches.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Branches.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n     \n    \n    \n    \n\n       \n */   \n    \n}"
+          "clicked" : "() => {\n// \n\n\t//NewBranch.singleton().show();\n\n/*\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Branches =     imports.Branches.Branches;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Branches.repo = repo;\n    Branches.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Branches.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n     \n    \n    \n    \n\n       \n */   \n    \n}"
          },
          "label" : "Branches",
          },
          "label" : "Branches",
-         "* pack" : "add",
          "xtype" : "Button",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
          "$ xns" : "Gtk"
         },
         {
@@ -57,8 +57,8 @@
           "clicked" : "() =>  {\n/*\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Merger =     imports.Merger.Merger;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Merger.repo = repo;\n    Merger.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Merger.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n    \n    \n\n     \n    \n\n */      \n    \n    \n}"
          },
          "label" : "Merge",
           "clicked" : "() =>  {\n/*\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Merger =     imports.Merger.Merger;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Merger.repo = repo;\n    Merger.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Merger.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n    \n    \n\n     \n    \n\n */      \n    \n    \n}"
          },
          "label" : "Merge",
-         "* pack" : "add",
          "xtype" : "Button",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
          "$ xns" : "Gtk"
         },
         {
@@ -66,8 +66,8 @@
           "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
          },
          "label" : "Switch Branch",
           "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
          },
          "label" : "Switch Branch",
-         "* pack" : "add",
          "xtype" : "Button",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
          "$ xns" : "Gtk"
         },
         {
           "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
          },
          "label" : "Pull",
           "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
          },
          "label" : "Pull",
-         "* pack" : "add",
          "xtype" : "Button",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         }
        ]
       },
       {
        "* init" : "  {\n  \n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
          "$ xns" : "Gtk"
         }
        ]
       },
       {
        "* init" : "  {\n  \n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
-       "bool hexpand" : true,
        "bool expand" : true,
        "bool expand" : true,
+       "bool hexpand" : true,
        "xtype" : "ScrolledWindow",
        "* pack" : "pack_end,true,true,0",
        "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
        "xtype" : "ScrolledWindow",
        "* pack" : "pack_end,true,true,0",
        "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
               "toggled" : "  (self, path)  => {\n/*    var ret ={} ;\n    var store = this.get('/reposStore');\n    store.el.get_iter_from_string(ret, path);\n                                                                 \n    var value =   store.el.get_value(ret.iter,4).value.get_boolean();\n                                                                 \n    //print(JSON.stringify(value));\n    store.el.set_value(ret.iter,4, !value);\n    \n     var path =  store.el.get_value(ret.iter, 6).value.get_string();\n     var repo = imports.Scm.Repo.Repo.get(path);\n     repo.autocommit(!value);\n  */   \n    \n    \n}"
              },
              "id" : "cr_autocommit",
               "toggled" : "  (self, path)  => {\n/*    var ret ={} ;\n    var store = this.get('/reposStore');\n    store.el.get_iter_from_string(ret, path);\n                                                                 \n    var value =   store.el.get_value(ret.iter,4).value.get_boolean();\n                                                                 \n    //print(JSON.stringify(value));\n    store.el.set_value(ret.iter,4, !value);\n    \n     var path =  store.el.get_value(ret.iter, 6).value.get_string();\n     var repo = imports.Scm.Repo.Repo.get(path);\n     repo.autocommit(!value);\n  */   \n    \n    \n}"
              },
              "id" : "cr_autocommit",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
               "toggled" : "  (self, path)  => {\n/*    var ret ={} ;\n    var store = this.get('/reposStore');\n    store.el.get_iter_from_string(ret, path);\n                                                                 \n    var value =   store.el.get_value(ret.iter,5).value.get_boolean();\n                                                                 \n    //print(JSON.stringify(value));\n    store.el.set_value(ret.iter,5, !value);\n      var path =  store.el.get_value(ret.iter, 6).value.get_string();\n     var repo = imports.Scm.Repo.Repo.get(path);\n     repo.autopush(!value);\n    */\n}"
              },
              "id" : "cr_autopush",
               "toggled" : "  (self, path)  => {\n/*    var ret ={} ;\n    var store = this.get('/reposStore');\n    store.el.get_iter_from_string(ret, path);\n                                                                 \n    var value =   store.el.get_value(ret.iter,5).value.get_boolean();\n                                                                 \n    //print(JSON.stringify(value));\n    store.el.set_value(ret.iter,5, !value);\n      var path =  store.el.get_value(ret.iter, 6).value.get_string();\n     var repo = imports.Scm.Repo.Repo.get(path);\n     repo.autopush(!value);\n    */\n}"
              },
              "id" : "cr_autopush",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
           },
           {
            "id" : "tv_repo",
           },
           {
            "id" : "tv_repo",
-           "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
            "Gtk.SortType sort_order" : "Gtk.SortType.ASCENDING",
            "Gtk.SortType sort_order" : "Gtk.SortType.ASCENDING",
+           "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
            "title" : "Repo",
            "* pack" : "append_column",
            "xtype" : "TreeViewColumn",
            "title" : "Repo",
            "* pack" : "append_column",
            "xtype" : "TreeViewColumn",
            "items" : [
             {
              "id" : "cr_repo",
            "items" : [
             {
              "id" : "cr_repo",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_current_branch",
            "items" : [
             {
              "id" : "cr_current_branch",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_last_updated",
            "items" : [
             {
              "id" : "cr_last_updated",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_all_branches",
            "items" : [
             {
              "id" : "cr_all_branches",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
              "$ xns" : "Gtk"
             }
            ]
index 5543108..3a91a66 100644 (file)
@@ -244,7 +244,7 @@ public class Clones : Object
             this.el.clicked.connect( () => {
             // 
             
             this.el.clicked.connect( () => {
             // 
             
-               NewBranch.singleton().show();
+               //NewBranch.singleton().show();
             
             /*
                 var rv = this.get('/reposView');
             
             /*
                 var rv = this.get('/reposView');
index ef2bdca..7be1ab5 100644 (file)
@@ -1,173 +1,5 @@
 
 
-
-public class GitMonitorQueue : MonitorNamePathDir {
-               // name = basename
-               // path = full path..
-               // dir = dir path
-       
-               public string gitpath;
-               public string vdir;  // relative path (within git)
-               public string vname;  // relative filename (within git)
-               public string message ; // for commit
-               public bool commit_all;
-                
-               public GitMonitorQueue(MonitorNamePathDir f) {
-
-                       base(f.name, f.path, f.dir);
-                       this.message = "";
-                       this.commit_all = false;
-                       
-                       var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
-                       
-                       if (vpath_ar.length < 1 || vpath_ar[0].length < 1) {
-
-                               this.gitpath = "";
-                               this.vdir = "";
-                               this.vname = "";
-                               return;
-                       }         
-
-
-                       this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
-                       
-                       string[]  vpath = {};
-                       for (var i = 1; i< vpath_ar.length; i++) {
-                               vpath += vpath_ar[i];
-                       }
-
-                       this.vdir =  string.joinv("/", vpath);
-
-                       this.vname =  this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
-                       
-                        
-/*
-                       stdout.printf(
-                                       "NEW GitMonitorQueue\nname: %s\npath: %s\ndir: %s\n" + 
-                                       "gitpath: %s\nvdir: %s\nvname: %s\n",
-                                       this.name, this.path, this.dir,
-                                       this.gitpath, this.vdir, this.vname
-                       );
-*/
-
-                       //f.repo = new imports.Scm.Git.Repo({ repopath: f.gitpath })
-               
-               
-               }
-
-               public bool shouldIgnore()
-               {
-                       
-                       // vim.. what a seriously brain dead program..
-                       if (this.name == "4913") {
-                               GLib.debug("ignore name = 4913");
-                               return true;
-                       }
-                        
-                       
-                       if (this.name[0] == '.') {
-                               // except!
-                               if (this.name == ".htaccess") {
-                                       
-                                       return false;
-                               }
-                               if (this.name == ".gitignore") {
-                                       return false;
-                               }
-                               GLib.debug("ignore name starts with dot %s", this.name);
-                               return true;
-                       }
-                       
-                       
-                       if (this.name[this.name.length -1] == '~') {
-                               GLib.debug("ignore name ends with ~");
-                               return true;
-                       }
-                       // netbeans / android studio.. silly temp files..
-                       
-                       if (Regex.match_simple("___jb_old___$", this.name)) {
-                               GLib.debug("ignore name includes jb_old");
-                           return true;
-                       }
-                       if (Regex.match_simple("___jb_bak___$", this.name)) {
-                               GLib.debug("ignore name includes jb_bkc");
-                           return true;
-                       }
-                       //if (f.name.match(/^nbproject/)) {
-                       //    return true;
-                       //}
-                       // ignore anything in top level!!!!
-                       if (this.gitpath.length < 1) {
-                               GLib.debug("ignore gitpath length is empty");
-                               return true;
-                       }
-                       
-                       return false;
-               }
-               
-               /** -- statics --*/
-               
-               public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add)
-               {
-                       for(var i =0; i < add_files.length; i++) {
-                               if (add_files.index(i).vname == add) {
-                                       return i;
-                               }
-                       }
-                       return -1;
-               }
-               public static  int indexOfMessage(Array<GitMonitorQueue> messages, string message)  {
-                       for(var i =0; i < messages.length; i++) {
-                               if (messages.index(i).message == message) {
-                                       return i;
-                               }
-                       }
-                       return -1;
-               }
-               public static string messageToString(Array<GitMonitorQueue> messages ) {
-                       string[] ret = {};
-                       for(var i =0; i < messages.length; i++) {
-                               ret+= messages.index(i).message;
-                       }
-                       return string.joinv("\n",ret);
-               }
-               public static string queueArrayToString(Array<GitMonitorQueue> list) {
-                       var ret = "";
-                       for(var i =0; i < list.length; i++) {
-                               
-                               ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
-                       }
-                       return ret;
-                       
-               }
-               
-               public static bool  queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
-                       for(var i =0; i < list.length; i++) {
-                               var test = list.index(i);
-                               if (list.index(i).gitpath != cmd_s.gitpath) {
-                                       continue;
-                               }
-                               if (list.index(i).vname != cmd_s.vname) {
-                                       continue;
-                               }
-                               if (list.index(i).action != action) {
-                                       continue;
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-               public string fullpath()
-               {
-                       return this.gitpath + "/" + this.vname;
-               }
-               
-                       
-                       
-}
-
-
+  
 
 public class GitMonitor : Monitor
 {
 
 public class GitMonitor : Monitor
 {
diff --git a/GitMonitorQueue.vala b/GitMonitorQueue.vala
new file mode 100644 (file)
index 0000000..1af6eca
--- /dev/null
@@ -0,0 +1,162 @@
+
+
+public class GitMonitorQueue : MonitorNamePathDir {
+               // name = basename
+               // path = full path..
+               // dir = dir path
+       
+               public string gitpath;
+               public string vdir;  // relative path (within git)
+               public string vname;  // relative filename (within git)
+               public string message ; // for commit
+               public bool commit_all;
+               public GitRepo repo;
+                
+               public GitMonitorQueue(MonitorNamePathDir f) {
+
+                       base(f.name, f.path, f.dir);
+                       this.message = "";
+                       this.commit_all = false;
+                       
+                       var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
+                       
+                       if (vpath_ar.length < 1 || vpath_ar[0].length < 1) {
+
+                               this.gitpath = "";
+                               this.vdir = "";
+                               this.vname = "";
+                               return;
+                       }         
+
+
+                       this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
+                       
+                       string[]  vpath = {};
+                       for (var i = 1; i< vpath_ar.length; i++) {
+                               vpath += vpath_ar[i];
+                       }
+
+                       this.vdir =  string.joinv("/", vpath);
+
+                       this.vname =  this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
+                       
+                       this.repo = GitRepo.get(this.gitpath);
+                       
+                       // trigger the suggestion to start a new branch
+                       
+                       NewBranch.show(this.repo);
+               
+               }
+
+               public bool shouldIgnore()
+               {
+                       
+                       // vim.. what a seriously brain dead program..
+                       if (this.name == "4913") {
+                               GLib.debug("ignore name = 4913");
+                               return true;
+                       }
+                        
+                       
+                       if (this.name[0] == '.') {
+                               // except!
+                               if (this.name == ".htaccess") {
+                                       
+                                       return false;
+                               }
+                               if (this.name == ".gitignore") {
+                                       return false;
+                               }
+                               GLib.debug("ignore name starts with dot %s", this.name);
+                               return true;
+                       }
+                       
+                       
+                       if (this.name[this.name.length -1] == '~') {
+                               GLib.debug("ignore name ends with ~");
+                               return true;
+                       }
+                       // netbeans / android studio.. silly temp files..
+                       
+                       if (Regex.match_simple("___jb_old___$", this.name)) {
+                               GLib.debug("ignore name includes jb_old");
+                           return true;
+                       }
+                       if (Regex.match_simple("___jb_bak___$", this.name)) {
+                               GLib.debug("ignore name includes jb_bkc");
+                           return true;
+                       }
+                       //if (f.name.match(/^nbproject/)) {
+                       //    return true;
+                       //}
+                       // ignore anything in top level!!!!
+                       if (this.gitpath.length < 1) {
+                               GLib.debug("ignore gitpath length is empty");
+                               return true;
+                       }
+                       
+                       return false;
+               }
+               
+               /** -- statics --*/
+               
+               public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add)
+               {
+                       for(var i =0; i < add_files.length; i++) {
+                               if (add_files.index(i).vname == add) {
+                                       return i;
+                               }
+                       }
+                       return -1;
+               }
+               public static  int indexOfMessage(Array<GitMonitorQueue> messages, string message)  {
+                       for(var i =0; i < messages.length; i++) {
+                               if (messages.index(i).message == message) {
+                                       return i;
+                               }
+                       }
+                       return -1;
+               }
+               public static string messageToString(Array<GitMonitorQueue> messages ) {
+                       string[] ret = {};
+                       for(var i =0; i < messages.length; i++) {
+                               ret+= messages.index(i).message;
+                       }
+                       return string.joinv("\n",ret);
+               }
+               public static string queueArrayToString(Array<GitMonitorQueue> list) {
+                       var ret = "";
+                       for(var i =0; i < list.length; i++) {
+                               
+                               ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
+                       }
+                       return ret;
+                       
+               }
+               
+               public static bool  queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
+                       for(var i =0; i < list.length; i++) {
+                               var test = list.index(i);
+                               if (list.index(i).gitpath != cmd_s.gitpath) {
+                                       continue;
+                               }
+                               if (list.index(i).vname != cmd_s.vname) {
+                                       continue;
+                               }
+                               if (list.index(i).action != action) {
+                                       continue;
+                               }
+                               return true;
+                       }
+                       return false;
+               }
+               public string fullpath()
+               {
+                       return this.gitpath + "/" + this.vname;
+               }
+               
+                       
+                       
+}
+
index b03f834..4e018e5 100644 (file)
@@ -7,9 +7,11 @@
  *
  *
  */
  *
  *
  */
+static GitRepo  _GitRepo; 
 public class GitRepo : Object
 {
 public class GitRepo : Object
 {
-    
+     
     public Array<GitMonitorQueue> cmds;
 
     public string name;
     public Array<GitMonitorQueue> cmds;
 
     public string name;
@@ -20,12 +22,22 @@ public class GitRepo : Object
     public Gee.HashMap<string,bool> ignore_files;
     public GitBranch currentBranch;
 
     public Gee.HashMap<string,bool> ignore_files;
     public GitBranch currentBranch;
 
+
+       public static GitRepo singleton()
+    {
+        if (_GitRepo == null) {
+            _GitRepo = new GitRepo();
+            _GitRepo.cache = new Gee.HashMap<string,GitRepo>();
+        }
+        return _GitRepo;
+    }
+
     /**
     * index of.. matching gitpath..
     */
     public static int indexOf( Array<GitRepo> repos, string gitpath) {
         // make a fake object to compare against..
     /**
     * index of.. matching gitpath..
     */
     public static int indexOf( Array<GitRepo> repos, string gitpath) {
         // make a fake object to compare against..
-        var test_repo = new GitRepo(gitpath);
+        var test_repo = GitRepo.get(gitpath);
         
         for(var i =0; i < repos.length; i++) {
             if (repos.index(i).gitdir == test_repo.gitdir) {
         
         for(var i =0; i < repos.length; i++) {
             if (repos.index(i).gitdir == test_repo.gitdir) {
@@ -36,15 +48,18 @@ public class GitRepo : Object
     
     }
     
     
     }
     
+    public  Gee.HashMap<string,GitRepo> cache;
+    
+    
     
     public static   Array<GitRepo> list()
     {
     
     public static   Array<GitRepo> list()
     {
-        
+
         //if (GitRepo.list_cache !=  null) {
         //    unowned  Array<GitRepo>    ret = GitRepo.list_cache;
          //   return ret;
         //}
         //if (GitRepo.list_cache !=  null) {
         //    unowned  Array<GitRepo>    ret = GitRepo.list_cache;
          //   return ret;
         //}
-        
+        var cache = GitRepo.singleton().cache;
         var list_cache = new Array<GitRepo>();
         
         var dir = Environment.get_home_dir() + "/gitlive";
         var list_cache = new Array<GitRepo>();
         
         var dir = Environment.get_home_dir() + "/gitlive";
@@ -102,8 +117,8 @@ public class GitRepo : Object
                 continue;
             }
             
                 continue;
             }
             
-             list_cache.append_val(new GitRepo(  sp )) ;
-             
+               var rep =  GitRepo.get(  sp );
+               list_cache.append_val(rep);             
             
         }
     
             
         }
     
@@ -111,7 +126,17 @@ public class GitRepo : Object
         
          
           
         
          
           
-}
+       }
+       
+       public static GitRepo get(string path) 
+       {
+               var cache = GitRepo.singleton().cache;
+               if (cache.has_key(path)) {
+                       return cache.get(path);
+               }
+               return new GitRepo(path);
+       }
+       
     
  
    
     
  
    
@@ -123,7 +148,7 @@ public class GitRepo : Object
      *
      */
      
      *
      */
      
-    public GitRepo(string path) {
+    private GitRepo(string path) {
         // cal parent?
         this.name =   File.new_for_path(path).get_basename();
         this.ignore_files = new Gee.HashMap<string,bool>();
         // cal parent?
         this.name =   File.new_for_path(path).get_basename();
         this.ignore_files = new Gee.HashMap<string,bool>();
@@ -134,8 +159,12 @@ public class GitRepo : Object
             this.gitdir = path; // naked...
         }
         this.cmds = new  Array<GitMonitorQueue> ();
             this.gitdir = path; // naked...
         }
         this.cmds = new  Array<GitMonitorQueue> ();
-        //Repo.superclass.constructor.call(this,cfg);
         
         
+               var cache = GitRepo.singleton().cache;
+        //Repo.superclass.constructor.call(this,cfg);
+         if ( !cache.has_key(path) ) {
+               cache.set( path, this);
+       }
     } 
     
     
     } 
     
     
index 994a15c..6cc2b4a 100644 (file)
@@ -21,16 +21,17 @@ Gitlive_SOURCES = \
           Gitlive.vala \
           Monitor.vala \
           GitMonitor.vala \
           Gitlive.vala \
           Monitor.vala \
           GitMonitor.vala \
+          GitMonitorQueue.vala \
           Spawn.vala \
           StatusIcon.vala \
           GitRepo.vala \
           Spawn.vala \
           StatusIcon.vala \
           GitRepo.vala \
-          GitBranch.vala \          
-          RooTicket.vala \                    
+          GitBranch.vala \
+          RooTicket.vala \
           c/xorg_idletime.c \
           c/xorg_idletime.c \
-          WindowLog.vala \ 
+          WindowLog.vala \
           Clones.vala \
           Clones.vala \
-          NewBranch.vala \
-          GitMonitorQueue.vala 
+          NewBranch.vala 
+
           
 
 
           
 
 
index 3b8271f..f845baa 100644 (file)
@@ -34,7 +34,7 @@ class RooTicket : Object
        {
                // first 5 words of summary..
                var  regex = new Regex ("[^A-Za-z0-9 ]+");
        {
                // first 5 words of summary..
                var  regex = new Regex ("[^A-Za-z0-9 ]+");
-               var str = regex.replace(this.summary, this.summary.length, 0);
+               var str = regex.replace(this.summary, this.summary.length,0, "");
                string[] words = Regex.split_simple ("[ \t]+", str);
                var ret = "";
                for (var i =0; i< (words.length > 5 ? 5 : words.length); i++) {
                string[] words = Regex.split_simple ("[ \t]+", str);
                var ret = "";
                for (var i =0; i< (words.length > 5 ? 5 : words.length); i++) {
@@ -42,13 +42,12 @@ class RooTicket : Object
                        ret += words[i];
                }
                return ret;
                        ret += words[i];
                }
                return ret;
-               
        }
        public string usernameLocal()
        {
                // git username is an email addres... - so this reutrns the local part..
                //?? assumes that all members are under the same domain... normally the case......
        }
        public string usernameLocal()
        {
                // git username is an email addres... - so this reutrns the local part..
                //?? assumes that all members are under the same domain... normally the case......
-               return RooTicket.singleton().username.split('@')[0];
+               return RooTicket.singleton().username.split("@")[0];
        
        }
 
        
        }
 
@@ -151,8 +150,7 @@ class RooTicket : Object
                                }
                                        GLib.debug("found password?");
                                // we are gussing.... 
                                }
                                        GLib.debug("found password?");
                                // we are gussing.... 
-                               username = bits[3];
-                               password = bits[5];
+
                                RooTicket.singleton().username  = bits[3];
                                RooTicket.singleton().password  = bits[5];              
                        }
                                RooTicket.singleton().username  = bits[3];
                                RooTicket.singleton().password  = bits[5];              
                        }