3 public class GitMonitorQueue : MonitorNamePathDir {
9 public string vdir; // relative path (within git)
10 public string vname; // relative filename (within git)
11 public string message ; // for commit
12 public bool commit_all;
15 public GitMonitorQueue(MonitorNamePathDir f) {
17 base(f.name, f.path, f.dir);
20 this.commit_all = false;
22 var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
24 if (vpath_ar.length < 1 || vpath_ar[0].length < 1) {
33 this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
36 for (var i = 1; i< vpath_ar.length; i++) {
40 this.vdir = string.joinv("/", vpath);
42 this.vname = this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
44 this.repo = GitRepo.get(this.gitpath);
46 // trigger the suggestion to start a new branch
47 if (!this.shouldIgnore() && !this.repo.is_wip_branch()) {
48 NewBranch.singleton().show(this.repo);
53 public bool shouldIgnore()
56 // vim.. what a seriously brain dead program..
57 if (this.name == "4913") {
58 GLib.debug("ignore name = 4913");
63 if (this.name[0] == '.') {
65 if (this.name == ".htaccess") {
69 if (this.name == ".gitignore") {
72 GLib.debug("ignore name starts with dot %s", this.name);
77 if (this.name[this.name.length -1] == '~') {
78 GLib.debug("ignore name ends with ~");
81 // netbeans / android studio.. silly temp files..
83 if (Regex.match_simple("___jb_old___$", this.name)) {
84 GLib.debug("ignore name includes jb_old");
87 if (Regex.match_simple("___jb_bak___$", this.name)) {
88 GLib.debug("ignore name includes jb_bkc");
91 //if (f.name.match(/^nbproject/)) {
94 // ignore anything in top level!!!!
95 if (this.gitpath.length < 1) {
96 GLib.debug("ignore gitpath length is empty");
105 public static int indexOfAdd( Gee.ArrayList<GitMonitorQueue> add_files, string add)
107 for(var i =0; i < add_files.size; i++) {
108 if (add_files.get(i).vname == add) {
114 public static int indexOfMessage(Gee.ArrayList<GitMonitorQueue> messages, string message) {
115 for(var i =0; i < messages.size; i++) {
116 if (messages.get(i).message == message) {
122 public static string messageToString(Gee.ArrayList<GitMonitorQueue> messages ) {
124 for(var i =0; i < messages.size; i++) {
125 ret+= messages.get(i).message;
127 return string.joinv("\n",ret);
129 public static string queueArrayToString(Gee.ArrayList<GitMonitorQueue> list) {
131 for(var i =0; i < list.size; i++) {
133 ret += (ret.length > 0 ? ", " : "") + list.get(i).vname;
139 public static bool queueHas(Gee.ArrayList<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
140 for(var i =0; i < list.size; i++) {
141 var test = list.get(i);
142 if (list.get(i).gitpath != cmd_s.gitpath) {
145 if (list.get(i).vname != cmd_s.vname) {
148 if (list.get(i).action != action) {
155 public string fullpath()
157 return this.gitpath + "/" + this.vname;