public bool shouldIgnore()
{
-
+
// vim.. what a seriously brain dead program..
if (this.name == "4913") {
return true;
if (this.name == ".htaccess") {
return false;
}
-
+ if (this.name == ".gitignore") {
+ return false;
+ }
return true;
}
+
if (this.name[this.name.length -1] == '~') {
return true;
}
public bool queueRunning = false;
public DateTime lastAdd;
-
-
+
+
+
public GitMonitor () {
+
+
+
this.queue = new Array<GitMonitorQueue>();
GitMonitor.gitmonitor = this;
+
+
+
Timeout.add_full(Priority.LOW, 1000, () => {
//print("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
notification.set_timeout(60); // show errros for longer
notification.show();
-
+ Canberra.Context context;
+ Canberra.Proplist props;
+
+ Canberra.Context.create (out context);
+ Canberra.Proplist.create (out props);
+
+ props.sets (Canberra.PROP_EVENT_ID, "gitlive-error");
+ props.sets (Canberra.PROP_EVENT_DESCRIPTION, "Gitlive stopped on error");
+ props.sets (Canberra.PROP_CANBERRA_CACHE_CONTROL, "permanent");
+ props.sets (Canberra.PROP_MEDIA_ROLE, "event");
+
+ context.play_full (0, props, null);
+
notification.set_timeout(5);
notification.show();
} catch(Error e) {
- print("Error %s\n",e.message);
+ GLib.debug("Error sending notification to screen: %s\n",e.message);
}
return false; // do not keep doing this..
if (this.paused) {
return;
}
- print("GitMonitor.runQueue\n");
+ GLib.debug("GitMonitor.runQueue\n");
this.queueRunning = true;
this.paused = true;
- print("GitMonitor.runQueue - creating repos\n");
+ GLib.debug("GitMonitor.runQueue - creating repos\n");
for(var i = 0; i < cmds.length; i++) {
var cmd = cmds.index(i);
var gitpath = cmd.gitpath;
- stdout.printf("GitMonitor.runQueue - finding %s\n", cmd.gitpath);
+ GLib.debug("GitMonitor.runQueue - finding %s\n", cmd.gitpath);
var ix = GitRepo.indexOf(repo_list, cmd.gitpath);
if (ix < 0) {
repo_list.append_val(new GitRepo( gitpath ));
ix = GitRepo.indexOf(repo_list, cmd.gitpath);
}
- stdout.printf("GitMonitor.runQueue - adding to repolist %d\n", ix);
+ GLib.debug("GitMonitor.runQueue - adding to repolist %d\n", ix);
//if (typeof(repo_list[gitpath]) == 'undefined') {
// repo_list[gitpath] = new imports.Scm.Git.Repo.Repo( { repopath : gitpath });
this.paused = false;
// build add, remove and commit message list..
- print("GitMonitor.runQueue - creating actions\n");
+ GLib.debug("GitMonitor.runQueue - creating actions\n");
for(var i = 0;i < repo_list.length;i++) {
break;
}
}
- print( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
- print( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
+ GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
+ GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
//repo.debug = 1;
// these can fail... at present... as we wildcard stuff.
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));
+ GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files_f));
+ GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files_f));
if (add_files_f.length < 1 && remove_files_f.length < 1) {
continue;
// deletions
this.paused = true;
+
try {
repo.pull();
//print("Pull failed:\n");
return;
}
-
-
+
// -- DO STUFF..
try {
repo.add(add_files_f);
this.pauseError(e.message);
return;
failure += e.message;
- print("Add failed:\n");
+ GLib.debug("Add failed:\n");
}
try {
repo.remove(remove_files_f);
this.pauseError(e.message);
return;
failure += e.message;
- print("Remove failed:\n");
+ GLib.debug("Remove failed:\n");
}
// if the error is 'nothing to commit, working tree clean'
// then it's not an error, - just continue;
-
if (/nothing to commit, working tree clean/.match(e.message)) {
+ GLib.debug("%s\n",e.message);
success += e.message;
+ this.paused = false;
continue;
}
// this.pauseError();
//}
} catch(Error e) {
- print(e.message);
+ GLib.debug(e.message);
}
this.queueRunning = false;
if (this.paused) {
return;
}
- print("GitMonitor.onChangedHint\n");
+ GLib.debug("GitMonitor.onChangedHint\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
if (this.paused) {
return;
}
- print("GitMonitor.onDeleted\n");
+ GLib.debug("GitMonitor.onDeleted\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
if (cmd.shouldIgnore()) {
if (this.paused) {
return;
}
- print("GitMonitor.onCreated\n");
+ GLib.debug("GitMonitor.onCreated\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
if (cmd.shouldIgnore()) {
if (this.paused) {
return;
}
- print("GitMonitor.onAttributeChanged\n");
+ GLib.debug("GitMonitor.onAttributeChanged\n");
if (src.dir == GitMonitor.gitlive) {
return; // attribute on top level..
}
if (this.paused) {
return;
}
- print("GitMonitor.onMoved\n");
+ GLib.debug("GitMonitor.onMoved\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd_s = new GitMonitorQueue(src);
}
- print("RM: %s\n", cmd_s.vname);
+ GLib.debug("RM: %s\n", cmd_s.vname);
cmd_s.action = "rm";
this.queue.append_val(cmd_s);
- print("ADD: %s\n", cmd_d.vname);
+ GLib.debug("ADD: %s\n", cmd_d.vname);
cmd_d.action = "add";
this.queue.append_val(cmd_d);