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     private Canberra.Context sound_context;
182
183         public GitMonitor () {
184         
185         
186         
187                 this.queue = new Array<GitMonitorQueue>();
188                 GitMonitor.gitmonitor = this;
189                 
190         Canberra.Context.create(out sound_context);
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                 sound_context.play(0, Canberra.PROP_EVENT_ID, "message-pause-error", Canberra.PROP_EVENT_DESCRIPTION, "Problem with gitlive");
234
235                         
236         
237                 this.paused = true;
238                 this.queueRunning = false;
239                 // what does this do to the old one...
240                 this.queue = new Array<GitMonitorQueue> ();
241                 this.stop();
242                 StatusIconA.statusicon.pauseError();
243                 
244                 var m = new Gtk.MessageDialog(null, Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,
245                         "A Serious problem occured running git, you will probably have to resolve this manually\n" + 
246                         "Committing is paused now, so fix the problem, close this window, then press start again\n\n\n" + 
247                         failure
248                 );
249                 m.set_keep_above(true);
250                 m.show();
251                 m.set_position(Gtk.WindowPosition.CENTER);
252                 m.response.connect( (id_pressed) => {
253                         m.hide();
254                 });
255                 
256         }
257  
258         public new void pause() {
259                 this.paused = true;
260                 // what does this do to the old one...
261                 this.queue = new Array<GitMonitorQueue> ();
262                 StatusIconA.statusicon.pause();
263
264         }
265         
266         /*
267         public new void resume () {
268                 this.paused = false;
269                 this.queue = new Array<GitMonitorQueue> ();
270                 StatusIconA.statusicon.resume();
271                 
272                 
273         }
274         */
275         /**
276          * Start the monitoring
277          * and run the queue every 500 milliseconds..
278          *
279          */
280         public new void start() 
281         {
282                 StatusIconA.statusicon.refreshing();
283                 
284                  
285                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
286                 
287                 Timeout.add_full(Priority.LOW, 500, () => {
288                         //stdout.printf("GitMonitor.start :: top.length = %u\n", this.top.length);
289                         // call this.monitor on each of 'top'
290                         for(int i = 0; i < this.top.length ; i++) {
291
292                                 this.monitor(this.top.index(i) );
293                         }
294                         StatusIconA.statusicon.resume();
295                     this.paused = false;
296                    
297                         
298                         try {
299
300                           
301                                 var notification = new Notify.Notification(
302                                         "Git Live",
303                                         "%s\nMonitoring %u Directories".printf(GitMonitor.gitlive, this.monitors.length), 
304                                          "dialog-information"
305                                 );
306                 
307                                 notification.set_timeout(5);
308                                 notification.show();
309                         } catch(Error e) {
310                                 GLib.debug("Error sending notification to screen: %s\n",e.message);
311                         }
312                         return false; // do not keep doing this..
313
314                 });
315                 
316
317                 
318                  
319         }
320
321
322         public new void stop() {
323                 StatusIconA.statusicon.pause();
324                 base.stop();
325         }
326         
327         
328         public new void monitor (string path,  int depth = 0)
329         {
330                 
331                 //var depth = typeof(depth) == 'number'  ? depth *1 : 0;
332                 
333                  
334                 // if we are not at top level.. and there is a .git directory  (it's a submodule .. ignore) 
335                 if (depth > 1 && FileUtils.test(path + "/.git" , FileTest.IS_DIR)) {
336                         return;
337                 }
338                 
339                 if (depth == 1) {
340                         // FIXME - check if repo is flagged as not autocommit..
341                         //var repo = imports.Scm.Repo.Repo.get(path);
342                         //if (!repo || !repo.autocommit()) {
343                         //    return;
344                         //} 
345                 }
346                 
347                 
348                 // check if the repo is to be monitored.
349                 //print("PATH : " + path);
350                 
351                 
352                 base.monitor(path, depth);
353         }
354
355         
356
357         /**
358          * run the queue.
359          * - pulls the items off the queue 
360          *    (as commands run concurrently and new items may get added while it's running)
361          * - runs the queue items
362          * - pushes upstream.
363          * 
364          */
365         public void runQueue()
366         {
367                 
368                 if (this.paused) {
369                         return;
370                 }
371                 GLib.debug("GitMonitor.runQueue\n");
372
373                 this.queueRunning = true;
374
375                 var cmds = new Array<GitMonitorQueue>();
376
377                 for(var i = 0; i < this.queue.length; i++) {
378                         cmds.append_val(this.queue.index(i));
379                 }
380
381                 this.queue = new Array<GitMonitorQueue>();// empty queue!
382
383                 
384                 string[] success = {};
385                 string[] failure = {};
386            //var repos = new Array<GitRepo>(); //??
387                 //var done = new Array<GitMonitorQueue>();
388                 
389                 // first build a array of repo's to work with
390                 var repo_list = new Array<GitRepo>();
391                 
392                 // pull and group.
393                 
394                 //print(JSON.stringify(cmds));
395                 // make sure nothing get's added to the queue where we are doing this..
396
397                 this.paused = true;
398
399                 GLib.debug("GitMonitor.runQueue - creating repos\n");
400                 
401                 for(var i = 0; i < cmds.length; i++) {
402                    
403                         var cmd = cmds.index(i);
404                 
405                         var gitpath = cmd.gitpath; 
406                         GLib.debug("GitMonitor.runQueue - finding %s\n", cmd.gitpath);
407                 
408                         var ix  = GitRepo.indexOf(repo_list,  cmd.gitpath);
409                         if (ix < 0) {
410                                 repo_list.append_val(new GitRepo( gitpath ));
411                                 ix = GitRepo.indexOf(repo_list,  cmd.gitpath);
412                         }
413                         GLib.debug("GitMonitor.runQueue - adding to repolist %d\n", ix);
414
415                         //if (typeof(repo_list[gitpath]) == 'undefined') {
416                         //    repo_list[gitpath] = new imports.Scm.Git.Repo.Repo( { repopath : gitpath });
417                         //    repo_list[gitpath].cmds = [];
418                          //   repo_list[gitpath].pull();
419                         //}
420                         repo_list.index(ix).cmds.append_val(cmd);
421
422                 }
423                 this.paused = false;
424                 // build add, remove and commit message list..
425
426                 GLib.debug("GitMonitor.runQueue - creating actions\n");
427                 
428                 for(var i = 0;i < repo_list.length;i++) {
429          
430                         var repo = repo_list.index(i);
431
432                         var add_files = new Array<GitMonitorQueue>();
433                         var add_files_f = new Array<GitMonitorQueue>();
434                         var remove_files = new Array<GitMonitorQueue>();
435                         var messages = new Array<GitMonitorQueue>();
436                         //print(JSON.stringify(repo.cmds,null,4));
437                         
438                         for(var ii = 0;ii < repo.cmds.length;ii++) {
439                                 var cmd = repo.cmds.index(ii);
440         
441                                 if (repo.is_ignore(cmd.vname)) {
442                                         continue;
443                                 }
444         
445                                 
446                                 switch(cmd.action) {
447                                         case "add" :
448                                                 
449                                                 if (GitMonitorQueue.indexOfAdd(add_files, cmd.vname) > -1) {
450                                                    break;
451                                                 }
452                                                 
453                                                 add_files.append_val(cmd);
454                                                 break;
455                                         
456                                         case "rm":
457                                                 if (GitMonitorQueue.indexOfAdd(remove_files, cmd.vname) > -1 ) {
458                                                    break;
459                                                 }
460                                                 
461                                                 // if file exists, do not try and delete it.
462                                                 if (FileUtils.test(cmd.fullpath(), FileTest.EXISTS)) {
463                                                         break;
464                                                 }
465                                                 
466                                                 remove_files.append_val(cmd);
467                                                 break;
468                                         
469                                         case "commit" :
470                                                 if (GitMonitorQueue.indexOfMessage(messages, cmd.message) > -1 ) {
471                                                    break;
472                                                 }
473                                                 messages.append_val(cmd);
474                                                 
475                                                 break;
476                                         default:
477                                                 stdout.printf("Opps unmatched action %s\n", cmd.action);
478                                                 break;
479                                 } 
480                         }
481                         GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
482                         GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
483                         
484                         //repo.debug = 1;
485                         // these can fail... at present... as we wildcard stuff.
486                    
487                         // make sure added files do not get removed.. ?? 
488                         /*
489                         var remove_files_f = new Array<GitMonitorQueue>();
490                         for(var ii = 0;ii < remove_files.length;ii++) {
491                                 if (GitMonitorQueue.indexOfAdd(add_files,  remove_files.index(ii).vname) > -1 ) {
492                                          continue;
493                                 }
494                                 remove_files_f.append_val(remove_files.index(ii));
495                         };
496                         stdout.printf("REMOVE : %u files\n"  , remove_files_f.length);
497                         */
498                         
499                         // if file was added, then removed, 
500                         var remove_files_f = new Array<GitMonitorQueue>();
501                         for(var ii = 0;ii < remove_files.length;ii++) {
502                                 
503                                 
504                                 
505                                 if (GitMonitorQueue.indexOfAdd(add_files,  remove_files.index(ii).vname) > -1 ) {
506                                         // in add and remove - do not remvove
507                                         continue;
508                                 }
509                                 remove_files_f.append_val(remove_files.index(ii));
510                         };
511                         for(var ii = 0;ii < add_files.length;ii++) {
512                                 if (GitMonitorQueue.indexOfAdd(remove_files,  add_files.index(ii).vname) > -1 ) {
513                                         // the add file is in the remove list, and it does not exist - do not add it..
514                                         print("check exists ? %s\n",add_files.index(ii).fullpath());
515                                         
516                                         if (!FileUtils.test(add_files.index(ii).fullpath(), FileTest.EXISTS)) {
517                                                         continue;
518                                         }
519                                          
520                                 }
521                                 
522                                 
523                                 
524                                 add_files_f.append_val(add_files.index(ii));
525                         };
526                         
527                         GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files_f));
528                         GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files_f));
529                     
530                     if (add_files_f.length < 1 && remove_files_f.length < 1) {
531                                 continue;
532                     }
533                     
534                         // make sure monitoring is paused so it does not recursively pick up
535                         // deletions
536                         this.paused = true; 
537                           
538                           
539                         try {
540                                 
541                                 repo.pull();
542                         } catch(Error e) {
543                                 this.pauseError(e.message);
544                                 //failure +=  e.message;
545                                 //print("Pull failed:\n");
546                                 return;
547                         }
548                                                                         
549                         // -- DO STUFF..            
550                         try {
551                                 repo.add(add_files_f);
552                         } catch(Error e) {
553                                 this.pauseError(e.message);
554                                 return;
555                                 failure +=  e.message;
556                                 GLib.debug("Add failed:\n");
557                         }  
558                         try {
559                                  repo.remove(remove_files_f);
560                         } catch(Error e) {
561                                 this.pauseError(e.message);
562                                 return;
563                                 failure +=  e.message;
564                                 GLib.debug("Remove failed:\n");
565                         }  
566
567
568                         try { 
569                                 success += repo.commit(
570                                         GitMonitorQueue.messageToString(messages),
571                                         add_files_f
572                                 );
573                                 success += repo.push();
574
575                         } catch(Error e) {
576                         
577                                 // if the error is 'nothing to commit, working tree clean'
578                                 // then it's not an error, - just continue;
579                                 if (/nothing to commit, working tree clean/.match(e.message)) {
580                                         GLib.debug("%s\n",e.message);
581                                         success += e.message;
582                                         this.paused = false; 
583                                         continue;
584                                 }
585                                 
586                         
587                         
588                                 this.paused = false;                    
589                                 this.pauseError(e.message);
590                                 
591                                 return;
592                                 //failure += e.message;
593                                 //print("Push failed:\n");
594                                 
595                         }   
596                         this.paused = false;                                            
597                 }
598                 
599                 
600                 // finally merge all the commit messages.
601                  
602                 try {
603                         // catch notification failures.. so we can carry on..
604                         if (success.length > 0) {
605
606                                 
607                                 var notification = new Notify.Notification(
608                                         "Git Live Commited",
609                                         string.joinv("\n",success),
610                                          "dialog-information"
611                                         
612                                 );
613         
614                                 notification.set_timeout(5);
615                                 notification.show();   
616                         }
617                         
618                         //if (failure.length > 0) {
619
620                                 // should never get this far...
621                         //      this.pauseError();   
622                         //}
623                 } catch(Error e) {
624                         GLib.debug(e.message);
625                         
626                 }
627                 this.queueRunning = false;
628         }
629         
630
631
632         
633
634         //string[] just_created;
635  
636  
637
638
639
640    
641
642
643         public override  void onChanged(MonitorNamePathDir src) 
644         { 
645                 //print("GitMonitor.onChanged\n");        
646                 return; // always ignore this..?
647                 //this.parsePath(src);
648         }
649         
650
651  
652         /**
653          *  results in  git add  + git commit..
654          *
655          */
656         public override void onChangesDoneHint(MonitorNamePathDir src)  
657         { 
658
659                 if (this.paused) {
660                         return;
661                 }
662                 GLib.debug("GitMonitor.onChangedHint\n");                               
663
664                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
665                 var cmd = new GitMonitorQueue(src);
666                 if (cmd.shouldIgnore()) {
667                         return;
668                 }
669                 
670            
671                 //var add_it = false;
672                 /*
673                 if (this.is_just_created(cmd.path)) {
674                         
675                 if (typeof(this.just_created[src.path]) !='undefined') {
676                         delete this.just_created[src.path];
677                         
678                         this.queue.push( 
679                                 [ src.gitpath,  'add', src.vpath ],
680                                 [ src.gitpath,  'commit',    { message: src.vpath} ] 
681                                 
682                         );
683                  
684                         return;
685                 }
686                 */
687                 cmd.action = "add";
688                 this.queue.append_val(cmd);
689
690                 cmd = new GitMonitorQueue(src);
691                 cmd.action = "commit";
692                 cmd.message = cmd.vname;
693                 this.queue.append_val(cmd);
694  
695                  
696         }
697         public override  void onDeleted(MonitorNamePathDir src) 
698    { 
699
700                 if (this.paused) {
701                         return;
702                 }
703                 GLib.debug("GitMonitor.onDeleted\n");                   
704                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
705                 var cmd = new GitMonitorQueue(src);
706                 if (cmd.shouldIgnore()) {
707                         return;
708                 }
709                 // should check if monitor needs removing..
710                 // it should also check if it was a directory.. - so we dont have to commit all..
711                 cmd.action = "rm";
712                 this.queue.append_val(cmd);
713
714                 cmd = new GitMonitorQueue(src);
715                 cmd.action = "commit";
716                 cmd.message = cmd.vname;
717                 cmd.commit_all = true;
718
719                 this.queue.append_val(cmd);
720  
721         }
722         public override  void onCreated(MonitorNamePathDir src) {
723
724                 if (this.paused) {
725                         return;
726                 }
727                 GLib.debug("GitMonitor.onCreated\n");                   
728                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
729                 var cmd = new GitMonitorQueue(src);
730                 if (cmd.shouldIgnore()) {
731                         return;
732                 }
733
734                 if (!FileUtils.test(src.path, GLib.FileTest.IS_DIR)) {
735                    // this.just_created[src.path] = true;
736                         return; // we do not handle file create flags... - use done hint.
737                 }
738                 // directory has bee created
739                 this.monitor(src.path);
740                 //this.top.append_val(src.path);
741                 //this.monitor(src.path );
742
743
744 // -- no point in adding a dir.. as git does not handle them...
745 //        this.queue.push( 
746   //          [ src.gitpath, 'add' , src.vpath,  { all: true } ],
747  //           [ src.gitpath, 'commit' , { all: true, message: src.vpath} ]
748   //          
749    //     );
750
751         }
752
753         public  override void onAttributeChanged(MonitorNamePathDir src) { 
754
755                 if (this.paused) {
756                         return;
757                 }
758                 GLib.debug("GitMonitor.onAttributeChanged\n");                  
759                 if (src.dir == GitMonitor.gitlive) {
760                    return; // attribute on top level..
761                 }
762                 
763                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
764                 var cmd = new GitMonitorQueue(src);
765                 if (cmd.shouldIgnore()) {
766                         return;
767                 }
768                 cmd.action = "add";
769                 this.queue.append_val(cmd);
770
771                 cmd = new GitMonitorQueue(src);
772                 cmd.action = "commit";
773                 cmd.message = "Attribute changed " + cmd.vname;
774                 this.queue.append_val(cmd);
775         }
776  
777    public  override void onMoved(MonitorNamePathDir src,MonitorNamePathDir dest)  
778         { 
779
780                 if (this.paused) {
781                         return;
782                 }
783                 GLib.debug("GitMonitor.onMoved\n");                     
784                 this.lastAdd = new DateTime.now(new TimeZone.local()); 
785                 var cmd_s = new GitMonitorQueue(src);
786
787                 var cmd_d = new GitMonitorQueue(dest);
788    
789                 
790                 if (cmd_d.gitpath != cmd_s.gitpath) {
791                         this.onDeleted(src);
792                         this.onCreated(dest);
793                         this.onChangesDoneHint(dest);
794                         return;
795                 }
796                 // needs to handle move to/from unsupported types..
797                 
798                 if (cmd_s.shouldIgnore()) {
799                         this.onCreated(dest);
800                         this.onChangesDoneHint(dest);
801                         return;
802
803                 }
804                 if (cmd_d.shouldIgnore()) {
805                         
806                         this.onDeleted(src);
807  
808
809                         return;
810                 }
811                 
812                 
813                 GLib.debug("RM: %s\n", cmd_s.vname);
814                 cmd_s.action = "rm";
815                 this.queue.append_val(cmd_s);
816
817                 
818                 
819                 GLib.debug("ADD: %s\n", cmd_d.vname);
820                 cmd_d.action = "add";
821                 this.queue.append_val(cmd_d);
822
823
824                 var cmd = new GitMonitorQueue(dest);
825                 cmd.action = "commit";
826                 cmd.message = "MOVED " + cmd_s.vname + " to " + cmd_d.vname;
827                 if (GitMonitorQueue.queueHas(this.queue, cmd_s, "add")) {
828                         cmd.message = cmd_d.vname;
829                 }
830                 
831                 this.queue.append_val(cmd);
832
833
834                  
835         }
836            
837 }