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