From 55d94ffcc22b705da1d4149afd5d4cfb453136ba Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 5 Nov 2018 15:31:01 +0800 Subject: [PATCH] handling of old branches --- GitMonitor.vala | 8 ++++---- GitMonitorQueue.vala | 4 ++-- GitRepo.vala | 16 ++++++---------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/GitMonitor.vala b/GitMonitor.vala index 543ba589..052b05f4 100644 --- a/GitMonitor.vala +++ b/GitMonitor.vala @@ -594,7 +594,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 +620,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 +676,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 +730,7 @@ public class GitMonitor : Monitor cmd.message = cmd_d.vname; } - this.queue.append_val(cmd); + this.queue.add(cmd); diff --git a/GitMonitorQueue.vala b/GitMonitorQueue.vala index 1988d4f8..00ab4655 100644 --- a/GitMonitorQueue.vala +++ b/GitMonitorQueue.vala @@ -119,8 +119,8 @@ public class GitMonitorQueue : MonitorNamePathDir { } public static string messageToString(Gee.ArrayList messages ) { string[] ret = {}; - for(var i =0; i < messages.length; i++) { - ret+= messages.index(i).message; + for(var i =0; i < messages.size; i++) { + ret+= messages.get(i).message; } return string.joinv("\n",ret); } diff --git a/GitRepo.vala b/GitRepo.vala index 17556aed..6108c1ee 100644 --- a/GitRepo.vala +++ b/GitRepo.vala @@ -349,13 +349,13 @@ public class GitRepo : Object public bool createBranchNamed(string branchname) { - + var stash = false; if (this.branches.has_key(branchname)) { // this is where it get's tricky... try { string[] cmd = { "ls-files" , "-m" }; // list the modified files.. var ret = this.git(cmd); - var stash = ret.length> 1 ; + stash = ret.length> 1 ; cmd = { "stash" }; @@ -369,13 +369,13 @@ public class GitRepo : Object } try { - cmd = { "merge", "master" }; + string[] cmd = { "merge", "master" }; this.git(cmd); } catch(Error e) { try { - cmd = { "mergetool" }; + string[] cmd = { "mergetool" }; this.git(cmd); - cmd = { "commit" "-m" "Fix merge conflicts from master" }; + cmd = { "commit", "-m" , "Fix merge conflicts from master" }; this.git(cmd); } catch(Error ee) { GitMonitor.gitmonitor.pauseError(ee.message); @@ -383,7 +383,7 @@ public class GitRepo : Object } } try { - cmd = { "stash", "pop" }; + string[] cmd = { "stash", "pop" }; if (stash) { this.git(cmd); } } catch(Error ee) { GitMonitor.gitmonitor.pauseError(ee.message); @@ -413,11 +413,7 @@ public class GitRepo : Object notification.show(); - } catch(Error e) { - GitMonitor.gitmonitor.pauseError(e.message); - return false; - } this.loadBranches(); // update branch list... GitMonitor.gitmonitor.runQueue(); // commit any outstanding... return true; -- 2.39.2