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