NewBranch.bjs
[gitlive] / MergeBranch.vala
index 8671085..6f84765 100644 (file)
@@ -21,6 +21,7 @@ public class MergeBranch : Object
     public Xcls_name name;
 
         // my vars (def)
+    public GitRepo repo;
     public RooTicket? ticket;
     public bool running;
 
@@ -62,6 +63,7 @@ public class MergeBranch : Object
                if (response_id == 0) {
                    _this.el.hide();    
                    this.running = false; 
+               GitMonitor.gitmonitor.start();
                        return;
                }
                 /*
@@ -83,11 +85,26 @@ public class MergeBranch : Object
                        }
             }
                */
+               
+               if (this.repo != null) {
+                       repo.doMerge(
+                               _this.actionsel.selectedAction(), 
+                               _this.ticketsel.selectedTicketId(),
+                               _this.name.el.get_text()
+                       );
+               
+               } else {
+                       GitRepo.doMerges(
+                               _this.actionsel.selectedAction(), 
+                               _this.ticketsel.selectedTicketId(),
+                               _this.name.el.get_text()
+                       );
+               }
                this.running = false; 
         
                 
                _this.el.hide();        
-         
+               GitMonitor.gitmonitor.start();
         
                 
         });
@@ -99,13 +116,16 @@ public class MergeBranch : Object
     }
 
     // user defined functions
-    public   void show (  RooTicket ticket ) 
+    public   void show (  RooTicket ticket, GitRepo? repo ) 
     {
          // this.el.set_gravity(Gdk.Gravity.NORTH);
         if (this.running) {
                return;
        }
+       GitMonitor.gitmonitor.stop();
+       
         this.ticket = ticket;
+        this.repo = repo;
         
        this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
                GLib.debug("Loading tickets"); 
@@ -115,6 +135,7 @@ public class MergeBranch : Object
        _this.dbmodel.loadTickets();
        _this.actionmodel.loadActions();
     
+    
     }
     public class Xcls_VBox2 : Object
     {
@@ -479,7 +500,7 @@ public class MergeBranch : Object
         // user defined functions
         public void loadTickets () {
         
-            RooTicket.singleton().loadTickets();
+            RooTicket.singleton().loadTickets("",RooTicket.NotMe.FALSE, RooTicket.Closed.FALSE);
             
             _this.ticketsel.loading = true;
         
@@ -488,12 +509,21 @@ public class MergeBranch : Object
             var el = this.el;
             
             el.append(out iter);
-        
-            
             el.set_value(iter, 0, "");
             el.set_value(iter, 1, "-- select a ticket --");
             
             _this.ticketsel.el.set_active_iter(iter);
+            
+            if (_this.ticket != null &&  _this.ticket.id == "-1") {
+                       el.append(out iter);
+                       el.set_value(iter, 0, "-1");
+                       el.set_value(iter, 1, "Temporary Branch - No ticket specified/relivant");
+                _this.ticketsel.el.set_active_iter(iter);      
+            }
+            
+            
+            
+            
             var tickets = RooTicket.singleton().tickets;
             foreach(var ticket in tickets) {
             
@@ -501,7 +531,7 @@ public class MergeBranch : Object
         
                 el.set_value(iter, 0, ticket.id);
                 el.set_value(iter, 1, "#%s [%s] %s".printf( ticket.id, ticket.project_id_name , ticket.summary));
-                       if (_this.ticket.id == ticket.id) {
+                       if (_this.ticket != null && _this.ticket.id == ticket.id) {
                            _this.ticketsel.el.set_active_iter(iter);
                    }
                 
@@ -563,7 +593,7 @@ public class MergeBranch : Object
         public void updateText () {
                var ticket_id = _this.ticketsel.selectedTicketId();
                
-               RooTicket ticket = null
+               RooTicket ticket = null;
                if (ticket_id.length > 0){
                        ticket = RooTicket.singleton().getById(ticket_id);
                }