GitMonitor.vala
[gitlive] / GitMonitor.vala
1
2  
3
4 public class GitMonitorQueue : MonitorNamePathDir {
5                 // name = basename
6                 // path = full path..
7                 // dir = dir path
8         
9                 public string gitpath;
10                 public string vdir;  // relative path (within git)
11                 public string vname;  // relative filename (within git)
12                 public string message ; // for commit
13                 public bool commit_all;
14                  
15                 public GitMonitorQueue(MonitorNamePathDir f) {
16
17                         base(f.name, f.path, f.dir);
18  
19                         this.message = "";
20                         this.commit_all = false;
21                         
22                         var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
23                         
24                         if (vpath_ar.length < 1 || vpath_ar[0].length < 1) {
25
26                                 this.gitpath = "";
27                                 this.vdir = "";
28                                 this.vname = "";
29                                 return;
30                         }         
31
32
33                         this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
34                         
35                         string[]  vpath = {};
36                         for (var i = 1; i< vpath_ar.length; i++) {
37                                 vpath += vpath_ar[i];
38                         }
39
40                         this.vdir =  string.joinv("/", vpath);
41
42                         this.vname =  this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
43                         
44                          
45 /*
46                         stdout.printf(
47                                         "NEW GitMonitorQueue\nname: %s\npath: %s\ndir: %s\n" + 
48                                         "gitpath: %s\nvdir: %s\nvname: %s\n",
49                                         this.name, this.path, this.dir,
50                                         this.gitpath, this.vdir, this.vname
51                         );
52 */
53
54                         //f.repo = new imports.Scm.Git.Repo({ repopath: f.gitpath })
55                 
56                 
57                 }
58
59                 public bool shouldIgnore()
60                 {
61                         
62                         // vim.. what a seriously brain dead program..
63                         if (this.name == "4913") {
64                                 GLib.debug("ignore name = 4913");
65                                 return true;
66                         }
67                          
68                         
69                         if (this.name[0] == '.') {
70                                 // except!
71                                 if (this.name == ".htaccess") {
72                                         
73                                         return false;
74                                 }
75                                 if (this.name == ".gitignore") {
76                                         return false;
77                                 }
78                                 GLib.debug("ignore name starts with dot %s", this.name);
79                                 return true;
80                         }
81                         
82                         
83                         if (this.name[this.name.length -1] == '~') {
84                                 GLib.debug("ignore name ends with ~");
85                                 return true;
86                         }
87                         // netbeans / android studio.. silly temp files..
88                         
89                         if (Regex.match_simple("___jb_old___$", this.name)) {
90                                 GLib.debug("ignore name includes jb_old");
91                             return true;
92                         }
93                         if (Regex.match_simple("___jb_bak___$", this.name)) {
94                                 GLib.debug("ignore name includes jb_bkc");
95                             return true;
96                         }
97                         //if (f.name.match(/^nbproject/)) {
98                         //    return true;
99                         //}
100                         // ignore anything in top level!!!!
101                         if (this.gitpath.length < 1) {
102                                 GLib.debug("ignore gitpath length is empty");
103                                 return true;
104                         }
105                         
106                         return false;
107                 }
108                 
109                 /** -- statics --*/
110                 
111                 public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add)
112                 {
113                         for(var i =0; i < add_files.length; i++) {
114                                 if (add_files.index(i).vname == add) {
115                                         return i;
116                                 }
117                         }
118                         return -1;
119                 }
120                 public static  int indexOfMessage(Array<GitMonitorQueue> messages, string message)  {
121                         for(var i =0; i < messages.length; i++) {
122                                 if (messages.index(i).message == message) {
123                                         return i;
124                                 }
125                         }
126                         return -1;
127                 }
128                 public static string messageToString(Array<GitMonitorQueue> messages ) {
129                         string[] ret = {};
130                         for(var i =0; i < messages.length; i++) {
131                                 ret+= messages.index(i).message;
132                         }
133                         return string.joinv("\n",ret);
134                 }
135                 public static string queueArrayToString(Array<GitMonitorQueue> list) {
136                         var ret = "";
137                         for(var i =0; i < list.length; i++) {
138                                 
139                                 ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
140                         }
141                         return ret;
142                         
143                 }
144                 
145                 public static bool  queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
146                         for(var i =0; i < list.length; i++) {
147                                 var test = list.index(i);
148                                 if (list.index(i).gitpath != cmd_s.gitpath) {
149                                         continue;
150                                 }
151                                 if (list.index(i).vname != cmd_s.vname) {
152                                         continue;
153                                 }
154                                 if (list.index(i).action != action) {
155                                         continue;
156                                 }
157                                 return true;
158                         }
159                         return false;
160                 }
161                 public string fullpath()
162                 {
163                         return this.gitpath + "/" + this.vname;
164                 }
165                 
166                         
167                         
168 }
169
170
171
172 public class GitMonitor : Monitor
173 {
174
175         public static GitMonitor gitmonitor;
176         /**
177          * @property {String} the "gitlive" directory, normally ~/gitlive
178          *  dset by OWNER... - we should do this as a CTOR.
179          *  
180          */
181         public static string gitlive;
182         
183         
184         public Array<GitMonitorQueue> queue ;
185         public bool queueRunning = false;
186         
187         public DateTime lastAdd;
188
189  
190
191         public GitMonitor () {
192         
193         
194         
195                 this.queue = new Array<GitMonitorQueue>();
196                 GitMonitor.gitmonitor = this;
197                 
198  
199
200                 
201                 Timeout.add_full(Priority.LOW, 500, () => {
202                         
203                         //GLib.debug("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
204
205                         //stdout.printf("QL %u: QR: %d\n", this.queue.length, this.queueRunning ? 1 : 0);
206                         if (this.queue.length < 1  || this.queueRunning) {
207                                 return true;
208                         }
209                         
210                         var last = -1 * this.lastAdd.difference(new DateTime.now(new TimeZone.local()));
211  
212                         // stdout.printf("LAST RUN: %s (expect %s) \n" ,
213                         //         last.to_string(),   (5 * TimeSpan.SECOND).to_string() );
214  
215                         if (last < 5 * TimeSpan.SECOND) { // wait 5 seconds before running. ????
216                                 return true;
217                         }
218                         //_this.lastAdd = new Date();
219                         //return 1;
220                 
221                         this.runQueue();
222                         return true; //
223                 });
224                 
225                 
226         }
227
228         public new void pauseError(string failure) 
229         {
230         
231                 var notification = new Notify.Notification(
232                           "Git Live ERROR!!",
233                         failure,
234                         "dialog-information"
235                         
236                 );
237                         
238                 notification.set_timeout(60); // show errros for longer
239                 notification.show();
240                 
241         Canberra.Context context;
242         Canberra.Proplist props;
243
244         Canberra.Context.create (out context);
245         Canberra.Proplist.create (out props);
246
247         props.sets (Canberra.PROP_EVENT_ID, "phone-outgoing-busy");
248         props.sets (Canberra.PROP_EVENT_DESCRIPTION, "Gitlive stopped on error");
249  
250
251         context.play_full (0, props, null);
252
253
254                         
255         
256                 this.paused = true;
257                 this.queueRunning = false;
258                 // what does this do to the old one...
259                 this.queue = new Array<GitMonitorQueue> ();
260                 this.stop();
261                 StatusIconA.statusicon.pauseError();
262                 
263                 var m = new Gtk.MessageDialog(null, Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,
264                         "A Serious problem occured running git, you will probably have to resolve this manually\n" + 
265                         "Committing is paused now, so fix the problem, close this window, then press start again\n\n\n" + 
266                         failure
267                 );
268                 m.set_keep_above(true);
269                 m.show();
270                 m.set_position(Gtk.WindowPosition.CENTER);
271                 m.response.connect( (id_pressed) => {
272                         m.hide();
273                 });
274                 
275         }
276  
277         public new void pause() {
278                 this.paused = true;
279                 // what does this do to the old one...
280                 this.queue = new Array<GitMonitorQueue> ();
281                 StatusIconA.statusicon.pause();
282
283         }
284         
285         /*
286         public new void resume () {
287                 this.paused = false;
288                 this.queue = new Array<GitMonitorQueue> ();
289                 StatusIconA.statusicon.resume();
290                 
291                 
292         }
293         */
294         /**
295          * Start the monitoring
296          * and run the queue every 500 milliseconds..
297          *
298          */
299         public new void start() 
300         {
301                 StatusIconA.statusicon.refreshing();
302                 
303                  
304                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
305                 
306                 Timeout.add_full(Priority.LOW, 500, () => {
307                         //stdout.printf("GitMonitor.start :: top.length = %u\n", this.top.length);
308                         // call this.monitor on each of 'top'
309                         for(int i = 0; i < this.top.length ; i++) {
310
311                                 this.monitor(this.top.index(i) );
312                         }
313                         StatusIconA.statusicon.resume();
314                     this.paused = false;
315                    
316                         
317                         try {
318
319                           
320                                 var notification = new Notify.Notification(
321                                         "Git Live",
322                                         "%s\nMonitoring %u Directories".printf(GitMonitor.gitlive, this.monitors.length), 
323                                          "dialog-information"
324                                 );
325                 
326                                 notification.set_timeout(5);
327                                 notification.show();
328                         } catch(Error e) {
329                                 GLib.debug("Error sending notification to screen: %s",e.message);
330                         }
331                         return false; // do not keep doing this..
332
333                 });
334                 
335
336                 
337                  
338         }
339
340
341         public new void stop() {
342                 StatusIconA.statusicon.pause();
343                 base.stop();
344         }
345         
346         
347         public new void monitor (string path,  int depth = 0)
348         {
349                 
350                 //var depth = typeof(depth) == 'number'  ? depth *1 : 0;
351                 
352                  
353                 // if we are not at top level.. and there is a .git directory  (it's a submodule .. ignore) 
354                 if (depth > 1 && FileUtils.test(path + "/.git" , FileTest.IS_DIR)) {
355                         return;
356                 }
357                 
358                 if (depth == 1) {
359                         // FIXME - check if repo is flagged as not autocommit..
360                         //var repo = imports.Scm.Repo.Repo.get(path);
361                         //if (!repo || !repo.autocommit()) {
362                         //    return;
363                         //} 
364                 }
365                 
366                 
367                 // check if the repo is to be monitored.
368                 //print("PATH : " + path);
369                 
370                 
371                 base.monitor(path, depth);
372         }
373
374         
375
376         /**
377          * run the queue.
378          * - pulls the items off the queue 
379          *    (as commands run concurrently and new items may get added while it's running)
380          * - runs the queue items
381          * - pushes upstream.
382          * 
383          */
384         public void runQueue()
385         {
386                 
387                 if (this.paused) {
388                         return;
389                 }
390                 GLib.debug("GitMonitor.runQueue\n");
391
392                 this.queueRunning = true;
393
394                 var cmds = new Array<GitMonitorQueue>();
395
396                 for(var i = 0; i < this.queue.length; i++) {
397                         cmds.append_val(this.queue.index(i));
398                 }
399
400                 this.queue = new Array<GitMonitorQueue>();// empty queue!
401
402                 
403                 string[] success = {};
404                 string[] failure = {};
405            //var repos = new Array<GitRepo>(); //??
406                 //var done = new Array<GitMonitorQueue>();
407                 
408                 // first build a array of repo's to work with
409                 var repo_list = new Array<GitRepo>();
410                 
411                 // pull and group.
412                 
413                 //print(JSON.stringify(cmds));
414                 // make sure nothing get's added to the queue where we are doing this..
415
416                 this.paused = true;
417
418                 GLib.debug("GitMonitor.runQueue - creating repos");
419                 
420                 for(var i = 0; i < cmds.length; i++) {
421                    
422                         var cmd = cmds.index(i);
423                 
424                         var gitpath = cmd.gitpath; 
425                         GLib.debug("GitMonitor.runQueue - finding %s", cmd.gitpath);
426                 
427                         var ix  = GitRepo.indexOf(repo_list,  cmd.gitpath);
428                         if (ix < 0) {
429                                 repo_list.append_val(new GitRepo( gitpath ));
430                                 ix = GitRepo.indexOf(repo_list,  cmd.gitpath);
431                         }
432                         GLib.debug("GitMonitor.runQueue - adding to repolist %d", ix);
433
434                         //if (typeof(repo_list[gitpath]) == 'undefined') {
435                         //    repo_list[gitpath] = new imports.Scm.Git.Repo.Repo( { repopath : gitpath });
436                         //    repo_list[gitpath].cmds = [];
437                          //   repo_list[gitpath].pull();
438                         //}
439                         repo_list.index(ix).cmds.append_val(cmd);
440
441                 }
442                 this.paused = false;
443                 // build add, remove and commit message list..
444
445                 GLib.debug("GitMonitor.runQueue - creating actions");
446                 
447                 for(var i = 0;i < repo_list.length;i++) {
448          
449                         var repo = repo_list.index(i);
450
451                         var add_files = new Array<GitMonitorQueue>();
452                         var add_files_f = new Array<GitMonitorQueue>();
453                         var remove_files = new Array<GitMonitorQueue>();
454                         var messages = new Array<GitMonitorQueue>();
455                         //print(JSON.stringify(repo.cmds,null,4));
456                         
457                         for(var ii = 0;ii < repo.cmds.length;ii++) {
458                                 var cmd = repo.cmds.index(ii);
459         
460                                 if (repo.is_ignore(cmd.vname)) {
461                                         continue;
462                                 }
463         
464                                 
465                                 switch(cmd.action) {
466                                         case "add" :
467                                                 
468                                                 if (GitMonitorQueue.indexOfAdd(add_files, cmd.vname) > -1) {
469                                                    break;
470                                                 }
471                                                 
472                                                 add_files.append_val(cmd);
473                                                 break;
474                                         
475                                         case "rm":
476                                                 if (GitMonitorQueue.indexOfAdd(remove_files, cmd.vname) > -1 ) {
477                                                    break;
478                                                 }
479                                                 
480                                                 // if file exists, do not try and delete it.
481                                                 if (FileUtils.test(cmd.fullpath(), FileTest.EXISTS)) {
482                                                         break;
483                                                 }
484                                                 
485                                                 remove_files.append_val(cmd);
486                                                 break;
487                                         
488                                         case "commit" :
489                                                 if (GitMonitorQueue.indexOfMessage(messages, cmd.message) > -1 ) {
490                                                    break;
491                                                 }
492                                                 messages.append_val(cmd);
493                                                 
494                                                 break;
495                                         default:
496                                                 stdout.printf("Opps unmatched action %s\n", cmd.action);
497                                                 break;
498                                 } 
499                         }
500                         GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files));
501                         GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files));
502                         
503                         //repo.debug = 1;
504                         // these can fail... at present... as we wildcard stuff.
505                    
506                         // make sure added files do not get removed.. ?? 
507                         /*
508                         var remove_files_f = new Array<GitMonitorQueue>();
509                         for(var ii = 0;ii < remove_files.length;ii++) {
510                                 if (GitMonitorQueue.indexOfAdd(add_files,  remove_files.index(ii).vname) > -1 ) {
511                                          continue;
512                                 }
513                                 remove_files_f.append_val(remove_files.index(ii));
514                         };
515                         stdout.printf("REMOVE : %u files\n"  , remove_files_f.length);
516                         */
517                         
518                         // if file was added, then removed, 
519                         var remove_files_f = new Array<GitMonitorQueue>();
520                         for(var ii = 0;ii < remove_files.length;ii++) {
521                                 
522                                 
523                                 
524                                 if (GitMonitorQueue.indexOfAdd(add_files,  remove_files.index(ii).vname) > -1 ) {
525                                         // in add and remove - do not remvove
526                                         continue;
527                                 }
528                                 remove_files_f.append_val(remove_files.index(ii));
529                         };
530                         for(var ii = 0;ii < add_files.length;ii++) {
531                                 if (GitMonitorQueue.indexOfAdd(remove_files,  add_files.index(ii).vname) > -1 ) {
532                                         // the add file is in the remove list, and it does not exist - do not add it..
533                                         print("check exists ? %s\n",add_files.index(ii).fullpath());
534                                         
535                                         if (!FileUtils.test(add_files.index(ii).fullpath(), FileTest.EXISTS)) {
536                                                         continue;
537                                         }
538                                          
539                                 }
540                                 
541                                 
542                                 
543                                 add_files_f.append_val(add_files.index(ii));
544                         };
545                         
546                         GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files_f));
547                         GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files_f));
548                     
549                     if (add_files_f.length < 1 && remove_files_f.length < 1) {
550                                 continue;
551                     }
552                     
553                         // make sure monitoring is paused so it does not recursively pick up
554                         // deletions
555                         this.paused = true; 
556                           
557                           
558                         try {
559                                 
560                                 repo.pull();
561                         } catch(Error e) {
562                                 this.pauseError(e.message);
563                                 //failure +=  e.message;
564                                 //print("Pull failed:\n");
565                                 return;
566                         }
567                                                                         
568                         // -- DO STUFF..            
569                         try {
570                                 repo.add(add_files_f);
571                         } catch(Error e) {
572                                 this.pauseError(e.message);
573                                 return;
574                                 failure +=  e.message;
575                                 GLib.debug("Add failed:");
576                         }  
577                         try {
578                                  repo.remove(remove_files_f);
579                         } catch(Error e) {
580                                 this.pauseError(e.message);
581                                 return;
582                                 failure +=  e.message;
583                                 GLib.debug("Remove failed:");
584                         }  
585
586
587                         try { 
588                                 success += repo.commit(
589                                         GitMonitorQueue.messageToString(messages),
590                                         add_files_f
591                                 );
592                                 success += repo.push();
593
594                         } catch(Error e) {
595                         
596                                 // if the error is 'nothing to commit, working tree clean'
597                                 // then it's not an error, - just continue;
598                                 if (/nothing to commit, working tree clean/.match(e.message)) {
599                                         GLib.debug("%s",e.message);
600                                         success += e.message;
601                                         this.paused = false; 
602                                         continue;
603                                 }
604                                 
605                         
606                         
607                                 this.paused = false;                    
608                                 this.pauseError(e.message);
609                                 
610                                 return;
611                                 //failure += e.message;
612                                 //print("Push failed:\n");
613                                 
614                         }   
615                         this.paused = false;                                            
616                 }
617                 
618                 
619                 // finally merge all the commit messages.
620                  
621                 try {
622                         // catch notification failures.. so we can carry on..
623                         if (success.length > 0) {
624
625                                 
626                                 var notification = new Notify.Notification(
627                                         "Git Live Commited",
628                                         string.joinv("\n",success),
629                                          "dialog-information"
630                                         
631                                 );
632         
633                                 notification.set_timeout(5);
634                                 notification.show();   
635                         }
636                         
637                         //if (failure.length > 0) {
638
639                                 // should never get this far...
640                         //      this.pauseError();   
641                         //}
642                 } catch(Error e) {
643                         GLib.debug(e.message);
644                         
645                 }
646                 this.queueRunning = false;
647         }
648         
649
650
651         
652
653         //string[] just_created;
654  
655  
656
657
658
659    
660
661
662         public override  void onChanged(MonitorNamePathDir src) 
663         { 
664                 //print("GitMonitor.onChanged\n");        
665                 return; // always ignore this..?
666                 //this.parsePath(src);
667         }
668         
669
670  
671         /**
672          *  results in  git add  + git commit..
673          *
674          */
675         public override void onChangesDoneHint(MonitorNamePathDir src)  
676         { 
677
678                 if (this.paused) {
679                         return;
680                 }
681                 GLib.debug("GitMonitor.onChangedHint");                         
682
683                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
684                 var cmd = new GitMonitorQueue(src);
685                 if (cmd.shouldIgnore()) {
686                         GLib.debug("GitMonitor.onChangedHint - ignored");
687                         return;
688                 }
689                 
690                 //var add_it = false;
691                 /*
692                 if (this.is_just_created(cmd.path)) {
693                         
694                 if (typeof(this.just_created[src.path]) !='undefined') {
695                         delete this.just_created[src.path];
696                         
697                         this.queue.push( 
698                                 [ src.gitpath,  'add', src.vpath ],
699                                 [ src.gitpath,  'commit',    { message: src.vpath} ] 
700                                 
701                         );
702                  
703                         return;
704                 }
705                 */
706                 cmd.action = "add";
707                 this.queue.append_val(cmd);
708
709                 cmd = new GitMonitorQueue(src);
710                 cmd.action = "commit";
711                 cmd.message = cmd.vname;
712                 this.queue.append_val(cmd);
713  
714                  
715         }
716         public override  void onDeleted(MonitorNamePathDir src) 
717    { 
718
719                 if (this.paused) {
720                         return;
721                 }
722                 GLib.debug("GitMonitor.onDeleted");                     
723                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
724                 var cmd = new GitMonitorQueue(src);
725                 if (cmd.shouldIgnore()) {
726                         return;
727                 }
728                 // should check if monitor needs removing..
729                 // it should also check if it was a directory.. - so we dont have to commit all..
730                 cmd.action = "rm";
731                 this.queue.append_val(cmd);
732
733                 cmd = new GitMonitorQueue(src);
734                 cmd.action = "commit";
735                 cmd.message = cmd.vname;
736                 cmd.commit_all = true;
737
738                 this.queue.append_val(cmd);
739  
740         }
741         public override  void onCreated(MonitorNamePathDir src) {
742
743                 if (this.paused) {
744                         return;
745                 }
746                 GLib.debug("GitMonitor.onCreated");                     
747                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
748                 var cmd = new GitMonitorQueue(src);
749                 if (cmd.shouldIgnore()) {
750                         return;
751                 }
752
753                 if (!FileUtils.test(src.path, GLib.FileTest.IS_DIR)) {
754                    // this.just_created[src.path] = true;
755                         return; // we do not handle file create flags... - use done hint.
756                 }
757                 // directory has bee created
758                 this.monitor(src.path);
759                 //this.top.append_val(src.path);
760                 //this.monitor(src.path );
761
762
763 // -- no point in adding a dir.. as git does not handle them...
764 //        this.queue.push( 
765   //          [ src.gitpath, 'add' , src.vpath,  { all: true } ],
766  //           [ src.gitpath, 'commit' , { all: true, message: src.vpath} ]
767   //          
768    //     );
769
770         }
771
772         public  override void onAttributeChanged(MonitorNamePathDir src) { 
773
774                 if (this.paused) {
775                         return;
776                 }
777                 GLib.debug("GitMonitor.onAttributeChanged %s", src.name);                       
778                 if (src.dir == GitMonitor.gitlive) {
779                    return; // attribute on top level..
780                 }
781                 
782                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
783                 var cmd = new GitMonitorQueue(src);
784                 if (cmd.shouldIgnore()) {
785                         return;
786                 }
787                 cmd.action = "add";
788                 this.queue.append_val(cmd);
789
790                 cmd = new GitMonitorQueue(src);
791                 cmd.action = "commit";
792                 cmd.message = "Attribute changed " + cmd.vname;
793                 this.queue.append_val(cmd);
794         }
795  
796    public  override void onMoved(MonitorNamePathDir src,MonitorNamePathDir dest)  
797         { 
798
799                 if (this.paused) {
800                         return;
801                 }
802                 GLib.debug("GitMonitor.onMoved");                       
803                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
804                 var cmd_s = new GitMonitorQueue(src);
805
806                 var cmd_d = new GitMonitorQueue(dest);
807    
808                 
809                 if (cmd_d.gitpath != cmd_s.gitpath) {
810                         this.onDeleted(src);
811                         this.onCreated(dest);
812                         this.onChangesDoneHint(dest);
813                         return;
814                 }
815                 // needs to handle move to/from unsupported types..
816                 
817                 if (cmd_s.shouldIgnore()) {
818                         this.onCreated(dest);
819                         this.onChangesDoneHint(dest);
820                         return;
821
822                 }
823                 if (cmd_d.shouldIgnore()) {
824                         
825                         this.onDeleted(src);
826  
827
828                         return;
829                 }
830                 
831                 
832                 GLib.debug("RM: %s", cmd_s.vname);
833                 cmd_s.action = "rm";
834                 this.queue.append_val(cmd_s);
835
836                 
837                 
838                 GLib.debug("ADD: %s", cmd_d.vname);
839                 cmd_d.action = "add";
840                 this.queue.append_val(cmd_d);
841
842
843                 var cmd = new GitMonitorQueue(dest);
844                 cmd.action = "commit";
845                 cmd.message = "MOVED " + cmd_s.vname + " to " + cmd_d.vname;
846                 if (GitMonitorQueue.queueHas(this.queue, cmd_s, "add")) {
847                         cmd.message = cmd_d.vname;
848                 }
849                 
850                 this.queue.append_val(cmd);
851
852
853                  
854         }
855            
856 }