"response" : "(self, response_id) => { \n \n this.el.hide();\n \n}"
},
"default_width" : 800,
- "| void show" : "() {\n\n \n this.el.set_deletable(false);\n this.el.set_gravity(Gdk.Gravity.NORTH);\n this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n this.el.show_all();\n _this.reposStore.load();\n // load clones..\n// this.get('/reposStore').load();\n \n //this.get('/ok_button').el.set_sensitive(false);\n \n // block until we return.\n// var run_ret = this.el.run();\n// if (run_ret < 1 ) {\n// return \"DONE\";\n// }\n// print(\"RUN RETURN : \" + run_ret);\n// return \"DONE\";\n //print(JSON.stringify(this.get('bug').getValue()));\n // return this.get('bug').getValue();\n //this.success = c.success;\n}\n",
"$ deletable" : true,
+ "| void show" : "() {\n\n \n this.el.set_deletable(false);\n this.el.set_gravity(Gdk.Gravity.NORTH);\n this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n this.el.show_all();\n _this.reposStore.load();\n // load clones..\n// this.get('/reposStore').load();\n \n //this.get('/ok_button').el.set_sensitive(false);\n \n // block until we return.\n// var run_ret = this.el.run();\n// if (run_ret < 1 ) {\n// return \"DONE\";\n// }\n// print(\"RUN RETURN : \" + run_ret);\n// return \"DONE\";\n //print(JSON.stringify(this.get('bug').getValue()));\n // return this.get('bug').getValue();\n //this.success = c.success;\n}\n",
"title" : "Manage Clones",
"xtype" : "Dialog",
"default_height" : 500,
"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" : "Remotes / Clones",
- "* pack" : "add",
"xtype" : "Button",
+ "* pack" : "add",
"$ xns" : "Gtk"
},
{
"listeners" : {
- "clicked" : "() => {\n// \n\n\tNewBranch.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}"
+ "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"
},
{
"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 Merger = imports.Merger.Merger;\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 Merger.repo = repo;\n Merger.el.set_transient_for(Clones.el);\n Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n Merger.show();\n Clones.el.set_title(\"Manage Clones\");\n\n \n \n\n \n \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"
},
{
"clicked" : "() => {\n \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",
"toggled" : " (self, path) => {\n/* var ret ={} ;\n var store = this.get('/reposStore');\n store.el.get_iter_from_string(ret, path);\n \n var value = store.el.get_value(ret.iter,4).value.get_boolean();\n \n //print(JSON.stringify(value));\n store.el.set_value(ret.iter,4, !value);\n \n var path = store.el.get_value(ret.iter, 6).value.get_string();\n var repo = imports.Scm.Repo.Repo.get(path);\n repo.autocommit(!value);\n */ \n \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/* var ret ={} ;\n var store = this.get('/reposStore');\n store.el.get_iter_from_string(ret, path);\n \n var value = store.el.get_value(ret.iter,5).value.get_boolean();\n \n //print(JSON.stringify(value));\n store.el.set_value(ret.iter,5, !value);\n var path = store.el.get_value(ret.iter, 6).value.get_string();\n var repo = imports.Scm.Repo.Repo.get(path);\n repo.autopush(!value);\n */\n}"
},
"id" : "cr_autopush",
- "* pack" : "pack_start,false",
"xtype" : "CellRendererToggle",
+ "* pack" : "pack_start,false",
"$ 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_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"
}
]
this.el.clicked.connect( () => {
//
- NewBranch.singleton().show();
+ //NewBranch.singleton().show();
/*
var rv = this.get('/reposView');
-
-
-public class GitMonitorQueue : MonitorNamePathDir {
- // name = basename
- // path = full path..
- // dir = dir path
-
- public string gitpath;
- public string vdir; // relative path (within git)
- public string vname; // relative filename (within git)
- public string message ; // for commit
- public bool commit_all;
-
- public GitMonitorQueue(MonitorNamePathDir f) {
-
- base(f.name, f.path, f.dir);
-
- this.message = "";
- this.commit_all = false;
-
- var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
-
- if (vpath_ar.length < 1 || vpath_ar[0].length < 1) {
-
- this.gitpath = "";
- this.vdir = "";
- this.vname = "";
- return;
- }
-
-
- this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
-
- string[] vpath = {};
- for (var i = 1; i< vpath_ar.length; i++) {
- vpath += vpath_ar[i];
- }
-
- this.vdir = string.joinv("/", vpath);
-
- this.vname = this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
-
-
-/*
- stdout.printf(
- "NEW GitMonitorQueue\nname: %s\npath: %s\ndir: %s\n" +
- "gitpath: %s\nvdir: %s\nvname: %s\n",
- this.name, this.path, this.dir,
- this.gitpath, this.vdir, this.vname
- );
-*/
-
- //f.repo = new imports.Scm.Git.Repo({ repopath: f.gitpath })
-
-
- }
-
- public bool shouldIgnore()
- {
-
- // vim.. what a seriously brain dead program..
- if (this.name == "4913") {
- GLib.debug("ignore name = 4913");
- return true;
- }
-
-
- if (this.name[0] == '.') {
- // except!
- if (this.name == ".htaccess") {
-
- return false;
- }
- if (this.name == ".gitignore") {
- return false;
- }
- GLib.debug("ignore name starts with dot %s", this.name);
- return true;
- }
-
-
- if (this.name[this.name.length -1] == '~') {
- GLib.debug("ignore name ends with ~");
- return true;
- }
- // netbeans / android studio.. silly temp files..
-
- if (Regex.match_simple("___jb_old___$", this.name)) {
- GLib.debug("ignore name includes jb_old");
- return true;
- }
- if (Regex.match_simple("___jb_bak___$", this.name)) {
- GLib.debug("ignore name includes jb_bkc");
- return true;
- }
- //if (f.name.match(/^nbproject/)) {
- // return true;
- //}
- // ignore anything in top level!!!!
- if (this.gitpath.length < 1) {
- GLib.debug("ignore gitpath length is empty");
- return true;
- }
-
- return false;
- }
-
- /** -- statics --*/
-
- public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add)
- {
- for(var i =0; i < add_files.length; i++) {
- if (add_files.index(i).vname == add) {
- return i;
- }
- }
- return -1;
- }
- public static int indexOfMessage(Array<GitMonitorQueue> messages, string message) {
- for(var i =0; i < messages.length; i++) {
- if (messages.index(i).message == message) {
- return i;
- }
- }
- return -1;
- }
- public static string messageToString(Array<GitMonitorQueue> messages ) {
- string[] ret = {};
- for(var i =0; i < messages.length; i++) {
- ret+= messages.index(i).message;
- }
- return string.joinv("\n",ret);
- }
- public static string queueArrayToString(Array<GitMonitorQueue> list) {
- var ret = "";
- for(var i =0; i < list.length; i++) {
-
- ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
- }
- return ret;
-
- }
-
- public static bool queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
- for(var i =0; i < list.length; i++) {
- var test = list.index(i);
- if (list.index(i).gitpath != cmd_s.gitpath) {
- continue;
- }
- if (list.index(i).vname != cmd_s.vname) {
- continue;
- }
- if (list.index(i).action != action) {
- continue;
- }
- return true;
- }
- return false;
- }
- public string fullpath()
- {
- return this.gitpath + "/" + this.vname;
- }
-
-
-
-}
-
-
+
public class GitMonitor : Monitor
{
--- /dev/null
+
+
+public class GitMonitorQueue : MonitorNamePathDir {
+ // name = basename
+ // path = full path..
+ // dir = dir path
+
+ public string gitpath;
+ public string vdir; // relative path (within git)
+ public string vname; // relative filename (within git)
+ public string message ; // for commit
+ public bool commit_all;
+ public GitRepo repo;
+
+ public GitMonitorQueue(MonitorNamePathDir f) {
+
+ base(f.name, f.path, f.dir);
+
+ this.message = "";
+ this.commit_all = false;
+
+ var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
+
+ if (vpath_ar.length < 1 || vpath_ar[0].length < 1) {
+
+ this.gitpath = "";
+ this.vdir = "";
+ this.vname = "";
+ return;
+ }
+
+
+ this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
+
+ string[] vpath = {};
+ for (var i = 1; i< vpath_ar.length; i++) {
+ vpath += vpath_ar[i];
+ }
+
+ this.vdir = string.joinv("/", vpath);
+
+ this.vname = this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
+
+ this.repo = GitRepo.get(this.gitpath);
+
+ // trigger the suggestion to start a new branch
+
+ NewBranch.show(this.repo);
+
+ }
+
+ public bool shouldIgnore()
+ {
+
+ // vim.. what a seriously brain dead program..
+ if (this.name == "4913") {
+ GLib.debug("ignore name = 4913");
+ return true;
+ }
+
+
+ if (this.name[0] == '.') {
+ // except!
+ if (this.name == ".htaccess") {
+
+ return false;
+ }
+ if (this.name == ".gitignore") {
+ return false;
+ }
+ GLib.debug("ignore name starts with dot %s", this.name);
+ return true;
+ }
+
+
+ if (this.name[this.name.length -1] == '~') {
+ GLib.debug("ignore name ends with ~");
+ return true;
+ }
+ // netbeans / android studio.. silly temp files..
+
+ if (Regex.match_simple("___jb_old___$", this.name)) {
+ GLib.debug("ignore name includes jb_old");
+ return true;
+ }
+ if (Regex.match_simple("___jb_bak___$", this.name)) {
+ GLib.debug("ignore name includes jb_bkc");
+ return true;
+ }
+ //if (f.name.match(/^nbproject/)) {
+ // return true;
+ //}
+ // ignore anything in top level!!!!
+ if (this.gitpath.length < 1) {
+ GLib.debug("ignore gitpath length is empty");
+ return true;
+ }
+
+ return false;
+ }
+
+ /** -- statics --*/
+
+ public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add)
+ {
+ for(var i =0; i < add_files.length; i++) {
+ if (add_files.index(i).vname == add) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ public static int indexOfMessage(Array<GitMonitorQueue> messages, string message) {
+ for(var i =0; i < messages.length; i++) {
+ if (messages.index(i).message == message) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ public static string messageToString(Array<GitMonitorQueue> messages ) {
+ string[] ret = {};
+ for(var i =0; i < messages.length; i++) {
+ ret+= messages.index(i).message;
+ }
+ return string.joinv("\n",ret);
+ }
+ public static string queueArrayToString(Array<GitMonitorQueue> list) {
+ var ret = "";
+ for(var i =0; i < list.length; i++) {
+
+ ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
+ }
+ return ret;
+
+ }
+
+ public static bool queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
+ for(var i =0; i < list.length; i++) {
+ var test = list.index(i);
+ if (list.index(i).gitpath != cmd_s.gitpath) {
+ continue;
+ }
+ if (list.index(i).vname != cmd_s.vname) {
+ continue;
+ }
+ if (list.index(i).action != action) {
+ continue;
+ }
+ return true;
+ }
+ return false;
+ }
+ public string fullpath()
+ {
+ return this.gitpath + "/" + this.vname;
+ }
+
+
+
+}
+
*
*
*/
+static GitRepo _GitRepo;
+
public class GitRepo : Object
{
-
+
public Array<GitMonitorQueue> cmds;
public string name;
public Gee.HashMap<string,bool> ignore_files;
public GitBranch currentBranch;
+
+ public static GitRepo singleton()
+ {
+ if (_GitRepo == null) {
+ _GitRepo = new GitRepo();
+ _GitRepo.cache = new Gee.HashMap<string,GitRepo>();
+ }
+ return _GitRepo;
+ }
+
/**
* index of.. matching gitpath..
*/
public static int indexOf( Array<GitRepo> repos, string gitpath) {
// make a fake object to compare against..
- var test_repo = new GitRepo(gitpath);
+ var test_repo = GitRepo.get(gitpath);
for(var i =0; i < repos.length; i++) {
if (repos.index(i).gitdir == test_repo.gitdir) {
}
+ public Gee.HashMap<string,GitRepo> cache;
+
+
public static Array<GitRepo> list()
{
-
+
//if (GitRepo.list_cache != null) {
// unowned Array<GitRepo> ret = GitRepo.list_cache;
// return ret;
//}
-
+ var cache = GitRepo.singleton().cache;
var list_cache = new Array<GitRepo>();
var dir = Environment.get_home_dir() + "/gitlive";
continue;
}
- list_cache.append_val(new GitRepo( sp )) ;
-
+ var rep = GitRepo.get( sp );
+ list_cache.append_val(rep);
}
-}
+ }
+
+ public static GitRepo get(string path)
+ {
+ var cache = GitRepo.singleton().cache;
+ if (cache.has_key(path)) {
+ return cache.get(path);
+ }
+ return new GitRepo(path);
+ }
+
*
*/
- public GitRepo(string path) {
+ private GitRepo(string path) {
// cal parent?
this.name = File.new_for_path(path).get_basename();
this.ignore_files = new Gee.HashMap<string,bool>();
this.gitdir = path; // naked...
}
this.cmds = new Array<GitMonitorQueue> ();
- //Repo.superclass.constructor.call(this,cfg);
+ var cache = GitRepo.singleton().cache;
+ //Repo.superclass.constructor.call(this,cfg);
+ if ( !cache.has_key(path) ) {
+ cache.set( path, this);
+ }
}
Gitlive.vala \
Monitor.vala \
GitMonitor.vala \
+ GitMonitorQueue.vala \
Spawn.vala \
StatusIcon.vala \
GitRepo.vala \
- GitBranch.vala \
- RooTicket.vala \
+ GitBranch.vala \
+ RooTicket.vala \
c/xorg_idletime.c \
- WindowLog.vala \
+ WindowLog.vala \
Clones.vala \
- NewBranch.vala \
- GitMonitorQueue.vala
+ NewBranch.vala
+
{
// first 5 words of summary..
var regex = new Regex ("[^A-Za-z0-9 ]+");
- var str = regex.replace(this.summary, this.summary.length, 0);
+ var str = regex.replace(this.summary, this.summary.length,0, "");
string[] words = Regex.split_simple ("[ \t]+", str);
var ret = "";
for (var i =0; i< (words.length > 5 ? 5 : words.length); i++) {
ret += words[i];
}
return ret;
-
}
public string usernameLocal()
{
// git username is an email addres... - so this reutrns the local part..
//?? assumes that all members are under the same domain... normally the case......
- return RooTicket.singleton().username.split('@')[0];
+ return RooTicket.singleton().username.split("@")[0];
}
}
GLib.debug("found password?");
// we are gussing....
- username = bits[3];
- password = bits[5];
+
RooTicket.singleton().username = bits[3];
RooTicket.singleton().password = bits[5];
}