this.message = "";
this.commit_all = false;
-
+
var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
if (vpath_ar[0].length < 1) {
/** -- statics --*/
- public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add) {
+ 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 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;
+
+ }
}
var repo = repo_list.index(i);
var add_files = new Array<GitMonitorQueue>();
+ var add_files_f = new Array<GitMonitorQueue>();
var remove_files = new Array<GitMonitorQueue>();
var messages = new Array<GitMonitorQueue>();
//print(JSON.stringify(repo.cmds,null,4));
break;
}
}
-
+ print( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
+ print( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
//repo.debug = 1;
// these can fail... at present... as we wildcard stuff.
- stdout.printf("ADD : %u files\n" , add_files.length);
-
- // make sure added files do not get removed..
-
+
+ // make sure added files do not get removed.. ??
+ /*
var remove_files_f = new Array<GitMonitorQueue>();
for(var ii = 0;ii < remove_files.length;ii++) {
if (GitMonitorQueue.indexOfAdd(add_files, remove_files.index(ii).vname) > -1 ) {
remove_files_f.append_val(remove_files.index(ii));
};
stdout.printf("REMOVE : %u files\n" , remove_files_f.length);
-
+ */
+
+ // if file was added, then removed,
+ var remove_files_f = new Array<GitMonitorQueue>();
+ for(var ii = 0;ii < remove_files.length;ii++) {
+ if (GitMonitorQueue.indexOfAdd(add_files, remove_files.index(ii).vname) > -1 ) {
+ // in add and remove - do not remvove
+ continue;
+ }
+ remove_files_f.append_val(remove_files.index(ii));
+ };
+ for(var ii = 0;ii < add_files.length;ii++) {
+ if (GitMonitorQueue.indexOfAdd(remove_files, add_files.index(ii).vname) > -1 ) {
+ // in add and remove - do not remvove
+ continue;
+ }
+ add_files_f.append_val(add_files.index(ii));
+ };
+
+ print( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files_f));
+ print( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files_f));
+
+
// make sure monitoring is paused so it does not recursively pick up
// deletions
- try {
+ try {
repo.pull();
} catch(Error e) {
failure += e.message;
- }
+ }
+
+
// -- DO STUFF..
try {
- repo.add(add_files);
+ repo.add(add_files_f);
} catch(Error e) {
failure += e.message;
}
try {
success += repo.commit(
GitMonitorQueue.messageToString(messages),
- add_files
+ add_files_f
);
success += repo.push();
if (this.paused) {
return;
}
+ if (src.dir == GitMonitor.gitlive) {
+ return; // attribute on top level..
+ }
+
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
if (cmd.shouldIgnore()) {
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd_s = new GitMonitorQueue(src);
- var cmd_d = new GitMonitorQueue(src);
+ var cmd_d = new GitMonitorQueue(dest);
if (cmd_d.gitpath != cmd_s.gitpath) {
return;
}
-
+ print("RM: %s\n", cmds_s.vname);
cmd_s.action = "rm";
this.queue.append_val(cmd_s);
-
-
-
+ print("ADD: %s\n", cmds_d.vname);
cmd_d.action = "add";
this.queue.append_val(cmd_d);