sync
[gitlive] / GitRepo.vala
index 823696e..c7e6070 100644 (file)
@@ -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...
     }