X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=GitRepo.vala;h=c7e60701bb011a157ea6b8dbce512b83c69b1c42;hp=823696ec8019c0c02665dd5f2b0dafed029d5e3c;hb=5c0a38cb0c01bc54849ca5f9990bfcc43c8dafc5;hpb=0c10a808ad544684bdda587cb45daeed6cc039b9 diff --git a/GitRepo.vala b/GitRepo.vala index 823696ec..c7e60701 100644 --- a/GitRepo.vala +++ b/GitRepo.vala @@ -336,22 +336,41 @@ public class GitRepo : Object } - public void setActiveTicket(RooTicket ticket, string branchname) + public bool setActiveTicket(RooTicket ticket, string branchname) { - this.createBranchNamed(branchname); + if (!this.createBranchNamed(branchname)) { + return false; + } FileUtils.set_contents(this.gitdir + "/.gitlive-active-ticket" , ticket.id); this.activeTicket = ticket; } public void createBranchNamed(string branchname) { - if (this.branches.has_key(branchname)) { - string[] cmd = { "checkout", branchname }; - this.git(cmd); - } else { - string[] cmd = { "checkout", "-b" , branchname }; - this.git(cmd); - } + + try { + if (this.branches.has_key(branchname)) { + string[] cmd = { "checkout", branchname }; + this.git(cmd); + } else { + string[] cmd = { "checkout", "-b" , branchname }; + this.git(cmd); + } + var notification = new Notify.Notification( + "Changed to branch %s".printf(branchname), + "", + "dialog-information" + + ); + + notification.set_timeout(5); + notification.show(); + + + } catch(e) { + GitMonitor.gitmonitor.pauseError(e.message); + + } this.loadBranches(); // update branch list... GitMonitor.gitmonitor.runQueue(); // commit any outstanding... }