X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=GitMonitor.vala;h=7866310357719fe7236a34836f8363c16eeb4797;hb=ec124418d1155a2a952f2ca6db1b01e5ab0e1009;hp=d6fd7361f7c7f2f119586da5058ed9718d9a56b0;hpb=40bf1f4bee21b09eedf5d8e2596ee0b72b234c45;p=gitlive diff --git a/GitMonitor.vala b/GitMonitor.vala index d6fd7361..78663103 100644 --- a/GitMonitor.vala +++ b/GitMonitor.vala @@ -1,7 +1,25 @@ +/** +The monitor suffers from various issues - basically event flows while it's running... + +normall operations + +- monitors for file changes + -- adds to QUEUE when occurs. + +- queue runs in background. + - if it's got stuff in it.. + - COMMIT (normally) + - now?? - if on master - try and branch + == do user selection, until we have branched + == then start monitoring again.. + +*/ + + public class GitMonitor : Monitor @@ -111,6 +129,12 @@ public class GitMonitor : Monitor } + public void restoreQueue( Gee.ArrayList queue) + { + //used to restore teh queue after switch branches?/ - breaks our privte queue idea.. + this.queue = queue; + } + /* public new void resume () { this.paused = false; @@ -224,6 +248,20 @@ public class GitMonitor : Monitor if (this.paused || this.queue.size < 1 ) { return; } + + foreach(var q in this.queue) { + if (!q.shouldIgnore() && !q.repo.is_wip_branch()) { + var oldq = this.queue; + this.queue = new Gee.ArrayList(); + NewBranch.singleton().show(q.repo, oldq); + + return; + } + + } + + + GLib.debug("GitMonitor.runQueue\n"); this.queueRunning = true; @@ -559,10 +597,7 @@ public class GitMonitor : Monitor this.queue.add(cmd); - if (!cmd.shouldIgnore() && !cmd.repo.is_wip_branch()) { - NewBranch.singleton().show(cmd.repo); - } - + } public override void onDeleted(MonitorNamePathDir src) @@ -589,9 +624,7 @@ public class GitMonitor : Monitor this.queue.add(cmd); - if (!cmd.shouldIgnore() && !cmd.repo.is_wip_branch()) { - NewBranch.singleton().show(cmd.repo); - } + } @@ -650,9 +683,7 @@ public class GitMonitor : Monitor cmd.message = "Attribute changed " + cmd.vname; this.queue.add(cmd); - if (!cmd.shouldIgnore() && !cmd.repo.is_wip_branch()) { - NewBranch.singleton().show(cmd.repo); - } + } public override void onMoved(MonitorNamePathDir src,MonitorNamePathDir dest) @@ -685,12 +716,9 @@ public class GitMonitor : Monitor if (cmd_d.shouldIgnore()) { this.onDeleted(src); - - return; } - - + GLib.debug("RM: %s", cmd_s.vname); cmd_s.action = "rm"; this.queue.add(cmd_s); @@ -711,10 +739,7 @@ public class GitMonitor : Monitor this.queue.add(cmd); - - if (!cmd.shouldIgnore() && !cmd.repo.is_wip_branch()) { - NewBranch.singleton().show(cmd.repo); - } + // this is where it get's complicated... // as we might be moving across repo's...