Partial Fix #5560 - Gitlive - branching wip
authorAlan Knowles <alan@roojs.com>
Fri, 16 Nov 2018 05:14:25 +0000 (13:14 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 16 Nov 2018 05:14:25 +0000 (13:14 +0800)
Clones.bjs
Clones.vala
GitRepo.vala
RepoStatusPopover.bjs
RepoStatusPopover.vala

index 30b9b23..fea00e0 100644 (file)
@@ -30,8 +30,8 @@
      "items" : [
       {
        "bool homogeneous" : true,
-       "* pack" : "pack_start,false,false,0",
        "xtype" : "Box",
+       "* pack" : "pack_start,false,false,0",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "items" : [
@@ -40,8 +40,8 @@
           "clicked" : "() => {\n\n/*    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Remotes =     imports.Remotes.Remotes;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Remotes.repo = repo;\n    Remotes.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Remotes.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n  */   \n    \n     \n\n       \n    \n    \n}"
          },
          "label" : "Add Repository",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
@@ -49,8 +49,8 @@
           "clicked" : "() => {\n// \n\n\t//NewBranch.singleton().show();\n\n/*\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Branches =     imports.Branches.Branches;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Branches.repo = repo;\n    Branches.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Branches.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n     \n    \n    \n    \n\n       \n */   \n    \n}"
          },
          "label" : "Branches",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk",
          "bool visible" : false
         },
@@ -59,8 +59,8 @@
           "clicked" : "() =>  {\n\n\tvar rv = _this.reposView;\n\tvar rs = _this.reposStore;\n\tvar s =rv.el.get_selection();\n\tif (s.count_selected_rows() != 1) {\n\t\treturn;\n\t}\n\tGtk.TreeIter iter;\n\tGtk.TreeModel tm;\n\ts.get_selected(out tm, out iter);\n\tGLib.Value val;\n    tm.get_value(iter, 6, out val);\n    var git_working_dir = (string)val;\n    \n    var repo = GitRepo.singleton().get(git_working_dir);\n    \n    // if you hit merge.... in master..\n    // ignore..\n    if (repo.currentBranch.name == \"master\") {\n    \treturn;\n\t}\n\tMergeBranch.singleton().show(repo.activeTicket, repo);\n\t_this.reposStore.load();\n\t\n \n    \n}\n\n"
          },
          "label" : "Merge",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
           "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
          },
          "label" : "Switch Branch",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk",
          "bool visible" : false
         },
         {
          "listeners" : {
-          "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
+          "clicked" : "() =>  {\n\n\tvar rv = _this.reposView;\n\tvar rs = _this.reposStore;\n\tvar s =rv.el.get_selection();\n\tif (s.count_selected_rows() != 1) {\n\t\treturn;\n\t}\n\tGtk.TreeIter iter;\n\tGtk.TreeModel tm;\n\ts.get_selected(out tm, out iter);\n\tGLib.Value val;\n    tm.get_value(iter, 6, out val);\n    var git_working_dir = (string)val;\n    \n    var repo = GitRepo.singleton().get(git_working_dir);\n    GitMonitor.gitmonitor.pause();    \n    repo.pull();\n    repo.loadStatus();\n    _this.reposStore.load();\n    GitMonitor.gitmonitor.start(); \n\n \n    \n}\n\n"
          },
          "label" : "Pull",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         }
        ]
       },
       {
        "* init" : "  {\n  \n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
-       "bool hexpand" : true,
        "bool expand" : true,
+       "bool hexpand" : true,
        "xtype" : "ScrolledWindow",
        "* pack" : "pack_end,true,true,0",
        "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
@@ -95,7 +95,7 @@
        "items" : [
         {
          "listeners" : {
-          "row_activated" : "(path, col)  =>  {\n\tGLib.debug(\"row activated: %s\", col.title);\n\tif (col.title != \"Current Branch\") {\n\t\treturn;\n\t}\n\t\n\t//\n\t\n\tGtk.TreeIter iter;\n\t_this.reposStore.el.get_iter(out iter, path);\n\tGLib.Value val;\n    _this.reposStore.el.get_value(iter, 6, out val);\n    var git_working_dir = (string)val;\n    \n    var repo = GitRepo.singleton().get(git_working_dir);\n    \n    Gdk.Rectangle rect;\n    _this.reposView.el.get_cell_area(path, col, out rect);\n    RepoStatusPopover.singleton().show(this.el, rect, repo);\n    \n     \n    \n}",
+          "row_activated" : "(path, col)  =>  {\n\n\tif (col.title != \"Current Branch\") {\n\t\treturn;\n\t}\n\t\n\t//\n\t\n\tGtk.TreeIter iter;\n\t_this.reposStore.el.get_iter(out iter, path);\n\tGLib.Value val;\n    _this.reposStore.el.get_value(iter, 6, out val);\n    var git_working_dir = (string)val;\n    \n    var repo = GitRepo.singleton().get(git_working_dir);\n    \n    Gdk.Rectangle rect;\n    _this.reposView.el.get_cell_area(path, col, out rect);\n    RepoStatusPopover.singleton().show(this.el, rect, repo);\n    \n     \n    \n}",
           "cursor_changed" : "()  => {\n  // SEE SELECTION.CHANGED\n  /*\n  \n  return;\n  \n    if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing? - clea it?\n        return;\n    }\n        var ret = {};         \n    var model = this.get('/changedFilesStore');\n\n     var s = this.el.get_selection();\n     var files = [];\n    s.selected_foreach(function(model,p,iter) {\n    \n       files.push( model.get_value(iter, 0).value.get_string());\n     \n    });\n    this.get('/patchview').showDiff(files); \n    //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     //print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n     \n    return true;\n*/\n}"
          },
          "id" : "reposView",
            "$ pathToRepo" : "function(path) {\n\n    var tr= this.repos;\n\n    \n    for(var i =0 ; i < tr.length; i++) {\n        if (tr[i].repopath == path) {\n            return tr[i];\n        }\n    } \n    return false; \n}\n",
            "xtype" : "ListStore",
            "* pack" : "set_model",
-           "| void load" : "()\n{\n    //this.insert(citer,iter,0);\n    print(\"getting list\");\n    var tr = GitRepo.list();\n    \n    this.el.clear();\n    \n    // fixme .. sort by last updated ...\n    \n    \n    for(var i =0 ; i < tr.length; i++) {\n\t    var repo = tr.index(i);\n\t    // this is done before we display stuff...\n\t    //repo.loadBranches();\n\t    //repo.loadStatus();\n\t    \n\t    Gtk.TreeIter iter;\n\t    this.el.append(out iter);\n     \n        //print(JSON.stringify(ret,null,4));\n         //tr[i].getBranches();\n         //tr[i].getStatus();\n         //var hi;\n         //try {\n             //tr[i].debug=1;\n         //     hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );\n//             print(JSON.stringify(hi,null,4));\n        // } catch(e) { print(e);}\n          \n        this.el.set_value(iter, 0,   repo.name );\n        this.el.set_value( iter, 1, repo.currentBranch.name   );\n        this.el.set_value( iter, 2,  repo.branchesToString()   );\n//        this.el.set_value(ret.iter, 2, '' + repo.branches.map(\n//                        function(e) { return e.name; \n//                    }).join(', ') \n //        );\n//        this.el.set_value(iter, 3, '' +  (!hi  ? '??' : hi[0].changed_raw));        \n        this.el.set_value(iter, 4, repo.is_autocommit() );                \n        this.el.set_value(iter, 5, repo.is_autopush() );                        \n        this.el.set_value(iter, 6,  repo.git_working_dir );  \n        // highlight color.\n        var cb = repo.currentBranch;\n        //print(JSON.stringify(cb,null,4));\n        var col = \"#ffffff\";\n        \n        if (cb.lastrev != cb.remoterev) {\n            col =  \"#f2dede\";\n            this.el.set_value( iter, 1, repo.currentBranch.name +\"\\nRemote != Local\"   );\n        }\n        if (repo.has_local_changes) {\n            col =  \"#d9edf7\";\n            this.el.set_value( iter, 1, repo.currentBranch.name +\"\\nHas uncommitted changes\"   );\n        }\n        if  ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {\n            col =  \"#fcf8e3\";\n            this.el.set_value( iter, 1, repo.currentBranch.name +\"\\nRemote != Local\\nHas uncommitted changes\"   );            \n        }\n        \n        this.el.set_value(iter, 7, col  );      \n        var ticket = repo.activeTicket;\n        \n        this.el.set_value(iter, 8, repo.is_auto_branch()  );      \n        this.el.set_value(iter, 9, ticket == null ? \"\" : ticket.id  );      \n        \n        \n    }     \n    this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);\n} ",
+           "| void load" : "()\n{\n    //this.insert(citer,iter,0);\n    print(\"getting list\");\n    var tr = GitRepo.list();\n    \n    this.el.clear();\n    \n    // fixme .. sort by last updated ...\n    \n    \n    for(var i =0 ; i < tr.length; i++) {\n\t    var repo = tr.index(i);\n\t    // this is done before we display stuff...\n\t    //repo.loadBranches();\n\t    //repo.loadStatus();\n\t    \n\t    Gtk.TreeIter iter;\n\t    this.el.append(out iter);\n     \n        //print(JSON.stringify(ret,null,4));\n         //tr[i].getBranches();\n         //tr[i].getStatus();\n         //var hi;\n         //try {\n             //tr[i].debug=1;\n         //     hi = tr[i].history('/', 1, 'branch', tr[i].currentBranch.name );\n//             print(JSON.stringify(hi,null,4));\n        // } catch(e) { print(e);}\n          \n        this.el.set_value(iter, 0,   repo.name );\n        this.el.set_value( iter, 1, repo.currentBranch.name   );\n        this.el.set_value( iter, 2,  repo.branchesToString()   );\n//        this.el.set_value(ret.iter, 2, '' + repo.branches.map(\n//                        function(e) { return e.name; \n//                    }).join(', ') \n //        );\n//        this.el.set_value(iter, 3, '' +  (!hi  ? '??' : hi[0].changed_raw));        \n        this.el.set_value(iter, 4, repo.is_autocommit() );                \n        this.el.set_value(iter, 5, repo.is_autopush() );                        \n        this.el.set_value(iter, 6,  repo.git_working_dir );  \n        // highlight color.\n        var cb = repo.currentBranch;\n        //print(JSON.stringify(cb,null,4));\n        var col = \"#ffffff\";\n        \n        if (cb.lastrev != cb.remoterev) {\n            col =  \"#f2dede\";\n            this.el.set_value( iter, 1, repo.currentBranch.name +\"\\n\" +\n            \t(repo.ahead_or_behind == \"B\" ? \"Local is BEHIND remote\" : \"Local is AHEAD of remote\")\n            \n               );\n        }\n        if (repo.has_local_changes) {\n            col =  \"#d9edf7\";\n            this.el.set_value( iter, 1, repo.currentBranch.name +\"\\nHas uncommitted changes\"   );\n        }\n        if  ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {\n            col =  \"#fcf8e3\";\n            this.el.set_value( iter, 1, repo.currentBranch.name +\"\\n\" + \n            (repo.ahead_or_behind == \"B\" ? \"Local is BEHIND remote\" : \"Local is AHEAD of remote\") +\n            \"\\nHas uncommitted changes\"   );            \n        }\n        \n        this.el.set_value(iter, 7, col  );      \n        var ticket = repo.activeTicket;\n        \n        this.el.set_value(iter, 8, repo.is_auto_branch()  );      \n        this.el.set_value(iter, 9, ticket == null ? \"\" : ticket.id  );      \n        \n        \n    }     \n    this.el.set_sort_column_id (0, Gtk.SortType.ASCENDING);\n} ",
            "$ xns" : "Gtk"
           },
           {
               "toggled" : "  (self, path)  => {\n  \n  \tGtk.TreeIter iter;\n  \t_this.reposStore.el.get_iter_from_string(out iter, path);\n  \t\n  \tGLib.Value val;\n  \tGLib.Value rval;\n  \t_this.reposStore.el.get_value(iter, 4, out val);\n  \t_this.reposStore.el.get_value(iter, 6, out rval);\n  \t\n  \tvar repopath = (string)rval;\n  \tvar bval = (bool)val;\n  \t_this.reposStore.el.set_value(iter, 4, !bval);\n  \tGLib.debug(\"got repopath? %s\", repopath);\n  \t\n  \tvar repo = GitRepo.get(repopath);\n  \trepo.set_autocommit(!bval);\n  \t\n  \t\n  \t\n  \n}"
              },
              "id" : "cr_autocommit",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
               "toggled" : "  (self, path)  => {\n  \n  \tGtk.TreeIter iter;\n  \t_this.reposStore.el.get_iter_from_string(out iter, path);\n  \t\n  \tGLib.Value val;\n  \tGLib.Value rval;\n  \t_this.reposStore.el.get_value(iter, 5, out val);\n  \t_this.reposStore.el.get_value(iter, 6, out rval);\n  \t\n  \tvar repopath = (string)rval;\n  \tvar bval = (bool)val;\n  \t_this.reposStore.el.set_value(iter, 5, !bval);\n  \tvar repo = GitRepo.get(repopath);\n  \trepo.set_autopush(!bval);\n  \t\n  \t\n  \t\n  \n}"
              },
              "id" : "cr_autopush",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
               "toggled" : "  (self, path)  => {\n  \n  \tGtk.TreeIter iter;\n  \t_this.reposStore.el.get_iter_from_string(out iter, path);\n  \t\n  \tGLib.Value val;\n  \tGLib.Value rval;\n  \t_this.reposStore.el.get_value(iter, 8, out val);\n  \t_this.reposStore.el.get_value(iter, 6, out rval);\n  \t\n  \tvar repopath = (string)rval;\n  \tvar bval = (bool)val;\n  \t_this.reposStore.el.set_value(iter, 8, !bval);\n  \tvar repo = GitRepo.get(repopath);\n  \trepo.set_auto_branch(!bval);\n  \t\n  \t\n  \t\n  \n}"
              },
              "id" : "cr_autobranch",
-             "xtype" : "CellRendererToggle",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererToggle",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
           },
           {
            "id" : "tv_repo",
-           "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
            "Gtk.SortType sort_order" : "Gtk.SortType.ASCENDING",
+           "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
            "title" : "Repo",
            "* pack" : "append_column",
            "xtype" : "TreeViewColumn",
            "items" : [
             {
              "id" : "cr_repo",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_active_ticket",
-             "xtype" : "CellRendererText",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererText",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_current_branch",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_last_updated",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_all_branches",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
index 3a187ec..78f86ca 100644 (file)
@@ -411,12 +411,29 @@ public class Clones : Object
             this.el.label = "Pull";
 
             //listeners
-            this.el.clicked.connect( () => {
-                
+            this.el.clicked.connect( () =>  {
+            
+               var rv = _this.reposView;
+               var rs = _this.reposStore;
+               var s =rv.el.get_selection();
+               if (s.count_selected_rows() != 1) {
+                       return;
+               }
+               Gtk.TreeIter iter;
+               Gtk.TreeModel tm;
+               s.get_selected(out tm, out iter);
+               GLib.Value val;
+                tm.get_value(iter, 6, out val);
+                var git_working_dir = (string)val;
                 
+                var repo = GitRepo.singleton().get(git_working_dir);
+                GitMonitor.gitmonitor.pause();    
+                repo.pull();
+                repo.loadStatus();
+                _this.reposStore.load();
+                GitMonitor.gitmonitor.start(); 
+            
              
-                   
-                
                 
             });
         }
@@ -523,7 +540,7 @@ public class Clones : Object
 
             //listeners
             this.el.row_activated.connect( (path, col)  =>  {
-               GLib.debug("row activated: %s", col.title);
+            
                if (col.title != "Current Branch") {
                        return;
                }
@@ -656,7 +673,10 @@ public class Clones : Object
                 
                 if (cb.lastrev != cb.remoterev) {
                     col =  "#f2dede";
-                    this.el.set_value( iter, 1, repo.currentBranch.name +"\nRemote != Local"   );
+                    this.el.set_value( iter, 1, repo.currentBranch.name +"\n" +
+                       (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote")
+                    
+                       );
                 }
                 if (repo.has_local_changes) {
                     col =  "#d9edf7";
@@ -664,7 +684,9 @@ public class Clones : Object
                 }
                 if  ((cb.lastrev != cb.remoterev) && (repo.has_local_changes)) {
                     col =  "#fcf8e3";
-                    this.el.set_value( iter, 1, repo.currentBranch.name +"\nRemote != Local\nHas uncommitted changes"   );            
+                    this.el.set_value( iter, 1, repo.currentBranch.name +"\n" + 
+                    (repo.ahead_or_behind == "B" ? "Local is BEHIND remote" : "Local is AHEAD of remote") +
+                    "\nHas uncommitted changes"   );            
                 }
                 
                 this.el.set_value(iter, 7, col  );      
index a072592..b444ce4 100644 (file)
@@ -21,6 +21,7 @@ public class GitRepo : Object
     public bool has_local_changes = false;
     public string git_status;    
     public string git_diff;        
+    public string ahead_or_behind = "";
     
     public Gee.HashMap<string,bool> ignore_files;
     public GitBranch currentBranch;
@@ -253,6 +254,12 @@ public class GitRepo : Object
                var r = this.git({ "status" , "--porcelain" });
                this.git_status = r;
                this.has_local_changes = r.length > 0;
+               
+               var rs = this.git({ "status" , "-sb" });
+
+               this.ahead_or_behind = rs.contains("[ahead") ? "A" : (rs.contains("[behind") ? "B" : "");
+               
+               
                this.git_diff  = this.git({ "diff" , "HEAD", "--no-color" });
        }    
 
@@ -751,16 +758,17 @@ public class GitRepo : Object
         //if (File.exists(this.repo + '/.git/config')) {
             //env.push("GITPATH=" + this.repo );
         //}
-        
-
+          
         var cfg = new SpawnConfig(this.git_working_dir , args , env);
         //cfg.debug = true;
 
        // may throw error...
         var sp = new Spawn(cfg);
       
-
-        GLib.debug( "GOT: %s" , sp.output);
+       // diff output is a bit big..
+               if (args_in[0] != "diff") {
+               GLib.debug( "GOT: %s" , sp.output);
+        }
         // parse output for some commands ?
         return sp.output;
     }
index 9a15553..a34afca 100644 (file)
        "items" : [
         {
          "id" : "label_status",
-         "xtype" : "Label",
          "* pack" : false,
+         "xtype" : "Label",
          "$ xns" : "Gtk",
          "utf8 label" : "Status"
         },
         {
          "id" : "label_diff",
-         "* pack" : false,
          "xtype" : "Label",
+         "* pack" : false,
          "$ xns" : "Gtk",
          "utf8 label" : "Diff"
         },
        "items" : [
         {
          "listeners" : {
-          "button_press_event" : "() => {\n        _this.el.hide();\n        return false;\n}"
+          "button_press_event" : "() => {\n   _this.repo.git({ \"stash\" , \"--all\" });\n   _this.repo.loadStatus();\n   \n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    Clones.singleton().reposStore.load();\n  \n   _this.el.hide();\n    return false;\n}"
          },
          "label" : "Stash Changes",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
          "listeners" : {
-          "button_press_event" : "() => {\n         _this.el.hide();\n        return false;\n}"
+          "button_press_event" : "() => {\n   _this.repo.git({ \"commit\" , \"-a\" ,\"-m\", \"Uncommited changes synced\" });\n   _this.repo.push();\n   _this.repo.loadStatus();\n   \n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    \n   _this.el.hide();\n   Clones.singleton().reposStore.load();\n   \n    return false;\n}"
          },
          "label" : "Commit Changes",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         },
         {
           "button_press_event" : "() => {\n       _this.el.hide();\n        return false;\n}"
          },
          "label" : "Ignore for now",
-         "xtype" : "Button",
          "* pack" : "add",
+         "xtype" : "Button",
          "$ xns" : "Gtk"
         }
        ]
index 0e363fb..136505c 100644 (file)
@@ -384,8 +384,15 @@ public class RepoStatusPopover : Object
 
             //listeners
             this.el.button_press_event.connect( () => {
-                    _this.el.hide();
-                    return false;
+               _this.repo.git({ "stash" , "--all" });
+               _this.repo.loadStatus();
+               
+                _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
+                _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+                Clones.singleton().reposStore.load();
+              
+               _this.el.hide();
+                return false;
             });
         }
 
@@ -413,8 +420,17 @@ public class RepoStatusPopover : Object
 
             //listeners
             this.el.button_press_event.connect( () => {
-                     _this.el.hide();
-                    return false;
+               _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
+               _this.repo.push();
+               _this.repo.loadStatus();
+               
+                _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
+                _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
+                
+               _this.el.hide();
+               Clones.singleton().reposStore.load();
+               
+                return false;
             });
         }