sync
authorAlan Knowles <alan@roojs.com>
Wed, 4 Jul 2018 09:28:45 +0000 (17:28 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 4 Jul 2018 09:28:45 +0000 (17:28 +0800)
GitMonitor.vala

index ed4980c..41a1447 100644 (file)
@@ -58,33 +58,39 @@ public class GitMonitorQueue : MonitorNamePathDir {
                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/)) {
@@ -92,6 +98,7 @@ public class GitMonitorQueue : MonitorNamePathDir {
                        //}
                        // ignore anything in top level!!!!
                        if (this.gitpath.length < 1) {
+                               GLib.debug("ignore gitpath length is empty");
                                return true;
                        }
                        
@@ -190,9 +197,9 @@ public class GitMonitor : Monitor
  
 
                
-               Timeout.add_full(Priority.LOW, 1000, () => {
+               Timeout.add_full(Priority.LOW, 500, () => {
                        
-                       //print("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
+                       //GLib.debug("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
 
                        //stdout.printf("QL %u: QR: %d\n", this.queue.length, this.queueRunning ? 1 : 0);
                        if (this.queue.length < 1  || this.queueRunning) {
@@ -318,7 +325,7 @@ public class GitMonitor : Monitor
                                notification.set_timeout(5);
                                notification.show();
                        } catch(Error e) {
-                               GLib.debug("Error sending notification to screen: %s\n",e.message);
+                               GLib.debug("Error sending notification to screen: %s",e.message);
                        }
                        return false; // do not keep doing this..
 
@@ -407,21 +414,21 @@ public class GitMonitor : Monitor
 
                this.paused = true;
 
-               GLib.debug("GitMonitor.runQueue - creating repos\n");
+               GLib.debug("GitMonitor.runQueue - creating repos");
                
                for(var i = 0; i < cmds.length; i++) {
                   
                        var cmd = cmds.index(i);
                
                        var gitpath = cmd.gitpath; 
-                       GLib.debug("GitMonitor.runQueue - finding %s\n", cmd.gitpath);
+                       GLib.debug("GitMonitor.runQueue - finding %s", cmd.gitpath);
                
                        var ix  = GitRepo.indexOf(repo_list,  cmd.gitpath);
                        if (ix < 0) {
                                repo_list.append_val(new GitRepo( gitpath ));
                                ix = GitRepo.indexOf(repo_list,  cmd.gitpath);
                        }
-                       GLib.debug("GitMonitor.runQueue - adding to repolist %d\n", ix);
+                       GLib.debug("GitMonitor.runQueue - adding to repolist %d", ix);
 
                        //if (typeof(repo_list[gitpath]) == 'undefined') {
                        //    repo_list[gitpath] = new imports.Scm.Git.Repo.Repo( { repopath : gitpath });
@@ -434,7 +441,7 @@ public class GitMonitor : Monitor
                this.paused = false;
                // build add, remove and commit message list..
 
-               GLib.debug("GitMonitor.runQueue - creating actions\n");
+               GLib.debug("GitMonitor.runQueue - creating actions");
                
                for(var i = 0;i < repo_list.length;i++) {
         
@@ -489,8 +496,8 @@ public class GitMonitor : Monitor
                                                break;
                                } 
                        }
-                       GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
-                       GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
+                       GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files));
+                       GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files));
                        
                        //repo.debug = 1;
                        // these can fail... at present... as we wildcard stuff.
@@ -535,8 +542,8 @@ public class GitMonitor : Monitor
                                add_files_f.append_val(add_files.index(ii));
                        };
                        
-                       GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files_f));
-                       GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files_f));
+                       GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files_f));
+                       GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files_f));
                    
                    if (add_files_f.length < 1 && remove_files_f.length < 1) {
                                continue;
@@ -564,7 +571,7 @@ public class GitMonitor : Monitor
                                this.pauseError(e.message);
                                return;
                                failure +=  e.message;
-                               GLib.debug("Add failed:\n");
+                               GLib.debug("Add failed:");
                        }  
                        try {
                                 repo.remove(remove_files_f);
@@ -572,7 +579,7 @@ public class GitMonitor : Monitor
                                this.pauseError(e.message);
                                return;
                                failure +=  e.message;
-                               GLib.debug("Remove failed:\n");
+                               GLib.debug("Remove failed:");
                        }  
 
 
@@ -588,7 +595,7 @@ public class GitMonitor : Monitor
                                // if the error is 'nothing to commit, working tree clean'
                                // then it's not an error, - just continue;
                                if (/nothing to commit, working tree clean/.match(e.message)) {
-                                       GLib.debug("%s\n",e.message);
+                                       GLib.debug("%s",e.message);
                                        success += e.message;
                                        this.paused = false; 
                                        continue;
@@ -670,15 +677,15 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onChangedHint\n");                               
+               GLib.debug("GitMonitor.onChangedHint");                         
 
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd = new GitMonitorQueue(src);
                if (cmd.shouldIgnore()) {
+                       GLib.debug("GitMonitor.onChangedHint - ignored");
                        return;
                }
                
-          
                //var add_it = false;
                /*
                if (this.is_just_created(cmd.path)) {
@@ -711,7 +718,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onDeleted\n");                   
+               GLib.debug("GitMonitor.onDeleted");                     
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd = new GitMonitorQueue(src);
                if (cmd.shouldIgnore()) {
@@ -735,7 +742,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onCreated\n");                   
+               GLib.debug("GitMonitor.onCreated");                     
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd = new GitMonitorQueue(src);
                if (cmd.shouldIgnore()) {
@@ -766,7 +773,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onAttributeChanged\n");                  
+               GLib.debug("GitMonitor.onAttributeChanged %s", src.name);                       
                if (src.dir == GitMonitor.gitlive) {
                   return; // attribute on top level..
                }
@@ -791,7 +798,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onMoved\n");                     
+               GLib.debug("GitMonitor.onMoved");                       
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd_s = new GitMonitorQueue(src);
 
@@ -821,13 +828,13 @@ public class GitMonitor : Monitor
                }
                
                
-               GLib.debug("RM: %s\n", cmd_s.vname);
+               GLib.debug("RM: %s", cmd_s.vname);
                cmd_s.action = "rm";
                this.queue.append_val(cmd_s);
 
                
                
-               GLib.debug("ADD: %s\n", cmd_d.vname);
+               GLib.debug("ADD: %s", cmd_d.vname);
                cmd_d.action = "add";
                this.queue.append_val(cmd_d);