X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=GitMonitor.vala;h=7e42154a36ed151ddd550430b44291e697db7edc;hp=543ba5897ad955d1e0191f4ef11ad5a46d7f4926;hb=9e641e366549656621a3e4fc4950b62c4b395650;hpb=f93028e569039b48af6351e2d37f80d15d94ff5a diff --git a/GitMonitor.vala b/GitMonitor.vala index 543ba589..7e42154a 100644 --- a/GitMonitor.vala +++ b/GitMonitor.vala @@ -54,13 +54,19 @@ public class GitMonitor : Monitor if (this.queue.size < 1 || this.queueRunning) { return true; } + var first = this.queue.get(0); + var delay = true; + if (!first.repo.is_wip_branch() && first.repo.is_auto_branch()) { + delay = false; + } + var last = -1 * this.lastAdd.difference(new DateTime.now(new TimeZone.local())); // stdout.printf("LAST RUN: %s (expect %s) \n" , // last.to_string(), (5 * TimeSpan.SECOND).to_string() ); - if (last < 5 * TimeSpan.SECOND) { // wait 5 seconds before running. ???? + if (delay && last < 5 * TimeSpan.SECOND) { // wait 5 seconds before running. ???? return true; } //_this.lastAdd = new Date(); @@ -250,7 +256,7 @@ public class GitMonitor : Monitor } foreach(var q in this.queue) { - if (!q.shouldIgnore() && !q.repo.is_wip_branch()) { + if (!q.shouldIgnore() && !q.repo.is_wip_branch() && q.repo.is_auto_branch()) { var oldq = this.queue; this.queue = new Gee.ArrayList(); NewBranch.singleton().show(q.repo, oldq); @@ -262,7 +268,7 @@ public class GitMonitor : Monitor - GLib.debug("GitMonitor.runQueue\n"); + GLib.debug("GitMonitor.runQueue size =%d\n", this.queue.size); this.queueRunning = true; @@ -299,7 +305,7 @@ public class GitMonitor : Monitor var gitpath = cmd.gitpath; var repo = GitRepo.get( gitpath ); - if ( !repo.is_wip_branch()) { + if ( !repo.is_wip_branch() && repo.is_auto_branch()) { leave_queued.add(cmd); continue; } @@ -594,7 +600,7 @@ public class GitMonitor : Monitor cmd = new GitMonitorQueue(src); cmd.action = "commit"; cmd.message = cmd.vname; - this.queue.append_val(cmd); + this.queue.add(cmd); } @@ -620,7 +626,7 @@ public class GitMonitor : Monitor cmd.message = cmd.vname; cmd.commit_all = true; - this.queue.append_val(cmd); + this.queue.add(cmd); } public override void onCreated(MonitorNamePathDir src) { @@ -676,7 +682,7 @@ public class GitMonitor : Monitor cmd = new GitMonitorQueue(src); cmd.action = "commit"; cmd.message = "Attribute changed " + cmd.vname; - this.queue.append_val(cmd); + this.queue.add(cmd); } public override void onMoved(MonitorNamePathDir src,MonitorNamePathDir dest) @@ -730,7 +736,7 @@ public class GitMonitor : Monitor cmd.message = cmd_d.vname; } - this.queue.append_val(cmd); + this.queue.add(cmd);