GitRepo.vala
[gitlive] / GitRepo.vala
1
2 /**
3  * @class Scm.Git.Repo
4  *
5  * @extends Scm.Repo
6  * 
7  *
8  *
9  */
10 static GitRepo  _GitRepo; 
11  
12 public class GitRepo : Object
13 {
14      
15     public Gee.ArrayList<GitMonitorQueue> cmds;
16
17     public string name;
18     public string gitdir;
19     public string git_working_dir;
20     public bool debug = false;
21     public bool has_local_changes = false;
22     public string host = "";
23     public string git_status;    
24     public string git_diff;        
25     public string ahead_or_behind = "";
26     
27     public Gee.HashMap<string,bool> ignore_files;
28     public GitBranch currentBranch;
29     public Gee.HashMap<string,GitBranch> branches; // accessed in GitBranch..
30         public RooTicket? activeTicket;
31     public  Gee.HashMap<string,GitRepo> cache;
32     public  Gee.HashMap<string,string> config_cache;
33     
34     
35     
36         public static GitRepo singleton()
37     {
38         if (_GitRepo == null) {
39             _GitRepo = new GitRepo.single();
40             _GitRepo.cache = new Gee.HashMap<string,GitRepo>();
41         }
42         return _GitRepo;
43     }
44  
45     /**
46     * index of.. matching gitpath..
47     */
48     public static int indexOf( Array<GitRepo> repos, string gitpath) {
49         // make a fake object to compare against..
50         var test_repo = GitRepo.get(gitpath);
51         
52         for(var i =0; i < repos.length; i++) {
53             if (repos.index(i).gitdir == test_repo.gitdir) {
54                 return i;
55             }
56         }
57         return -1;
58     
59     }
60     
61
62     
63     
64     
65     public static   Array<GitRepo> list()
66     {
67
68         //if (GitRepo.list_cache !=  null) {
69         //    unowned  Array<GitRepo>    ret = GitRepo.list_cache;
70          //   return ret;
71         //}
72         var cache = GitRepo.singleton().cache;
73         var list_cache = new Array<GitRepo>();
74         
75         var dir = Environment.get_home_dir() + "/gitlive";
76         
77         var f = File.new_for_path(dir);
78         FileEnumerator file_enum;
79         try {
80             file_enum = f.enumerate_children(
81                 FileAttribute.STANDARD_DISPLAY_NAME + ","+ 
82                 FileAttribute.STANDARD_TYPE,
83                 FileQueryInfoFlags.NONE,
84                 null);
85         } catch (Error e) {
86             
87             return list_cache;
88             
89         }
90         
91         FileInfo next_file; 
92         
93         while (true) {
94             
95             try {
96                 next_file = file_enum.next_file(null);
97                 if (next_file == null) {
98                     break;
99                 }
100                 
101             } catch (Error e) {
102                 GLib.debug("Error: %s",e.message);
103                 break;
104             }
105          
106             //print("got a file " + next_file.sudo () + '?=' + Gio.FileType.DIRECTORY);
107             
108             if (next_file.get_file_type() !=  FileType.DIRECTORY) {
109                 next_file = null;
110                 continue;
111             }
112             
113             if (next_file.get_file_type() ==  FileType.SYMBOLIC_LINK) {
114                 next_file = null;
115                 continue;
116             }
117             
118             if (next_file.get_display_name()[0] == '.') {
119                 next_file = null;
120                 continue;
121             }
122             var sp = dir+"/"+next_file.get_display_name();
123            
124             var gitdir = dir + "/" + next_file.get_display_name() + "/.git";
125             
126             if (!FileUtils.test(gitdir, FileTest.IS_DIR)) {
127                 continue;
128             }
129             
130                 var rep =  GitRepo.get(  sp );
131                 list_cache.append_val(rep);             
132             
133         }
134     
135         return list_cache;
136          
137         }
138         
139         public static GitRepo get(string path) 
140         {
141                 var cache = GitRepo.singleton().cache;
142                 if (cache.has_key(path)) {
143                         return cache.get(path);
144                 }
145                 return new GitRepo(path);
146         }
147         
148     private GitRepo.single() {
149                 // used to create the signleton
150         }
151     /**
152      * constructor:
153      * 
154      * @param {Object} cfg - Configuration
155      *     (basically repopath is currently only critical one.)
156      *
157      */
158      
159     private GitRepo(string path) 
160     {
161         // cal parent?
162         this.name =   File.new_for_path(path).get_basename();
163         this.ignore_files = new Gee.HashMap<string,bool>();
164         
165         this.git_working_dir = path;
166         this.gitdir = path + "/.git";
167         if (!FileUtils.test(this.gitdir , FileTest.IS_DIR)) {
168             this.gitdir = path; // naked...
169         }
170         this.cmds = new  Gee.ArrayList<GitMonitorQueue> ();
171         
172                 var cache = GitRepo.singleton().cache;
173         //Repo.superclass.constructor.call(this,cfg);
174                 if ( !cache.has_key(path) ) {
175                         cache.set( path, this);
176         }
177         
178         var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
179         var uri = new Soup.URI(r);      
180         this.host = uri.get_host();
181                 this.init_config();
182         
183         this.loadBranches();
184         this.loadActiveTicket();
185         this.loadStatus();
186     } 
187     
188     public bool is_master_branch()
189     {
190         // special branches that do not allow autopushing now...
191         return this.currentBranch.name == "master" || this.currentBranch.name == "roojs";
192                 
193     }
194     public void init_config()
195     {
196         this.config_cache = new Gee.HashMap<string,string>();
197         // managed = 
198         if (this.get_config("managed") == "") {
199                 this.set_config("managed", this.host == "git.roojs.com" ? "1" : "0");
200                 }
201         if (this.get_config("autocommit") == "") {
202                 this.set_config("autocommit", this.host == "git.roojs.com" ? "1" : "0");
203                 }
204         if (this.get_config("autopush") == "") {
205                 this.set_config("autopush", this.host == "git.roojs.com" ? "1" : "0");
206                 }
207                 
208     }
209     
210     
211     
212     public string get_config(string key) {
213     
214         if (this.config_cache.has_key(key)) {
215                 return this.config_cache.get(key);
216                 }
217         try {
218                 return  this.git({ "config" , "gitlive." + key });
219         } catch (Error e) {
220                 return ""; // happens when there is nothing set...
221         }
222
223         }
224     public void set_config(string key, string value) {
225         this.git({ "config" , "gitlive." + key, value });
226         this.config_cache.set(key,value);
227         }
228     
229     public bool is_managed()
230     {
231         return this.get_config("managed") == "1";
232     }
233     
234     
235     public bool is_autocommit ()
236     {           
237         return this.get_config("autocommit") == "1";            
238     }
239     
240     public void set_autocommit(bool val)
241     {
242                 this.set_config("autocommit", val ? "1" : "0");
243     
244     }
245     
246     public bool is_auto_branch ()
247     {
248         if (this.name == "gitlog") {
249                 return false;
250                 }
251                 // check remote...
252         if (this.is_managed()) {
253                 return true;
254                 }
255         return false;
256         
257  
258     }
259     
260     public void set_auto_branch(bool val)
261     {
262                 if (this.name == "gitlog") {
263                 return;
264                 }
265                 this.set_config("managed", val ? "1" : "0");
266     
267     }
268     public bool is_autopush ()
269     {
270         return this.get_config("autopush") == "1";
271     }
272     public void set_autopush(bool val)
273     {
274                 this.set_config("autopush", val ? "1" : "0");
275     }
276     
277     
278         public void loadStatus()
279         {
280                 var r = this.git({ "status" , "--porcelain" });
281                 this.git_status = r;
282                 this.has_local_changes = r.length > 0;
283                 
284                 var rs = this.git({ "status" , "-sb" });
285
286                 this.ahead_or_behind = rs.contains("[ahead") ? "A" : (rs.contains("[behind") ? "B" : "");
287                 
288                 
289                 this.git_diff  = this.git({ "diff" , "HEAD", "--no-color" });
290         }    
291
292     
293     public void loadBranches()
294     {
295
296         GitBranch.loadBranches(this);
297     }
298      
299     
300     
301     
302     public string branchesToString()
303     {
304         var ret = "";
305                 foreach( var br in this.branches.values) {
306                         if (br.name == "") {
307                                 continue; 
308                         }
309                         ret += ret.length > 0 ? "\n"  : "";
310                         ret += br.name;
311                 
312                 }
313                 return ret;
314         
315     }
316      public static void doMerges(string action, string ticket_id, string commit_message)
317     {
318        GitMonitor.gitmonitor.stop();
319        
320        var commitrevs = "";
321        var sucess = true;
322        foreach(var  repo in GitRepo.singleton().cache.values) {
323                if (repo.activeTicket != null && repo.activeTicket.id == ticket_id) {
324                        var res = repo.doMerge(action,ticket_id, commit_message);
325                        if (!res) {
326                                sucess = false;
327                                continue;
328                        }
329                        commitrevs += commitrevs.length > 0 ? " " : "";
330                        commitrevs += repo.currentBranch.lastrev;
331                }
332        }
333        if (sucess && action == "CLOSE") {
334                RooTicket.singleton().getById(ticket_id).close(commitrevs);
335        }
336        GitMonitor.gitmonitor.start();
337     }
338      
339
340     public bool doMerge(string action, string ticket_id, string commit_message)
341     {
342        // in theory we should check to see if other repo's have got the same branch and merge all them at the same time.
343        // also need to decide which branch we will merge into?
344                    var ret = "";
345                    if (action == "CLOSE" || action == "LEAVE") {
346                                    
347                try {
348                    var oldbranch = this.currentBranch.name;
349                    this.setActiveTicket(null, "master");
350                            string [] cmd = { "merge",   "--squash",  oldbranch };
351                            this.git( cmd );
352                            cmd = { "commit",   "-a" , "-m",  commit_message };
353                            this.git( cmd );
354                            this.push();
355                            this.loadBranches(); // updates lastrev..
356                
357                        var notification = new Notify.Notification(
358                                "Merged branch %s to master".printf(oldbranch),
359                                "",
360                                 "dialog-information"
361                                
362                        );
363
364                        notification.set_timeout(5);
365                        notification.show();   
366                
367                // close ticket..
368                return true; 
369                
370            } catch (Error e) {
371
372                GitMonitor.gitmonitor.pauseError(e.message);
373                return false;
374            }
375            // error~?? -- show the error dialog...
376                    return false;
377        }
378        if (action == "MASTER") {
379                // merge master into ours..
380                        try {
381                        string[] cmd = { "merge",  "master" };
382                        this.git( cmd );
383                        var notification = new Notify.Notification(
384                                        "Merged code from master to %s".printf(this.currentBranch.name),
385                                        "",
386                                         "dialog-information"
387                                        
388                                );
389                                notification.set_timeout(5);
390                                notification.show();   
391                       
392                        return true;
393                        } catch (Error e) {
394                        GitMonitor.gitmonitor.pauseError(e.message);
395                        return false;
396                    }
397            }
398        if (action == "EXIT") {
399                        try {
400                        var oldbranch  = this.currentBranch.name;
401                          this.setActiveTicket(null, "master");
402                        this.loadBranches();
403                        var notification = new Notify.Notification(
404                                        "Left branch %s".printf(oldbranch),
405                                        "",
406                                         "dialog-information"
407                                        
408                                );
409                                notification.set_timeout(5);
410                                notification.show();   
411                        
412                        return true;
413                    } catch (Error e) {
414                        GitMonitor.gitmonitor.pauseError(e.message);
415
416                        return false;                   
417                    }
418                    // error~?? -- show the error dialog...
419
420        }
421        return false;
422     }
423         
424     public void loadActiveTicket()
425     {
426         this.activeTicket = null;
427                 var ticket_id = this.get_config("ticket");
428         
429         if (ticket_id.length < 1) {
430                 return;
431                 }
432                 this.activeTicket = RooTicket.singleton().getById(ticket_id.strip());
433         
434         
435     }
436     
437     
438     
439     public bool setActiveTicket(RooTicket? ticket, string branchname)
440     {
441         this.set_config("ticket", "");
442         if (!this.createBranchNamed(branchname)) {
443                 return false;
444                 }
445                 this.set_config("ticket", ticket == null ? "": ticket.id);
446         this.activeTicket = ticket;
447         return true;
448     }
449     
450     public bool createBranchNamed(string branchname)
451     {   
452                 
453
454                      if (this.branches.has_key(branchname)) {
455                         this.switchToExistingBranchNamed(branchname);
456                     
457                     } else {
458                                  this.createNewBranchNamed(branchname); 
459                             
460                     }
461                        var notification = new Notify.Notification(
462                        "Changed to branch %s".printf(branchname),
463                        "",
464                         "dialog-information"
465                        
466                );
467
468                notification.set_timeout(5);
469                notification.show();   
470        
471          
472          this.loadBranches(); // update branch list...
473          //GitMonitor.gitmonitor.runQueue(); // no point - we have hidden the queue..
474          return true;
475     }
476      bool switchToExistingBranchNamed(string branchname)
477      {
478                 var stash = false;
479                                          // this is where it get's tricky...
480                 string files = "";
481                 try {                   
482                                 string[] cmd = { "ls-files" ,  "-m" };                   // list the modified files..
483                                 files = this.git(cmd);
484                                 stash = files.length> 1 ;
485                                 
486                                 
487                                 cmd = { "stash" };                      
488                                 if (stash) { this.git(cmd); }
489                                 
490                                 this.pull();
491                                 
492                                 cmd = { "checkout", branchname  };
493                                 this.git(cmd);
494                   } catch(Error e) {
495                                 GitMonitor.gitmonitor.pauseError(e.message);
496                                 return false;           
497                   }
498                 try {
499                    if (branchname != "master") {
500                        string[] cmd = { "merge", "master"  };
501                             this.git(cmd);
502                             this.push();
503                        
504                     }
505                     
506                 } catch(Error e) {
507                     string[] cmd = { "checkout", "master"  };
508                     this.git(cmd);
509                         GitMonitor.gitmonitor.pauseError(
510                                 "Use\n\na) git checkout %s\nb) git mergetool\nc) git commit\nd) git push\n d) stash pop \ne) start gitlive again\n".printf(
511                                         branchname)
512                                  + e.message
513                         );
514                         return false;           
515                  
516                 }
517                 try {                                   
518                     string[]  cmd = { "stash", "pop"  };
519                     if (stash) { 
520                         this.git(cmd); 
521                         var fl = files.split("\n");
522                         cmd = { "commit", "-m" , "Changed " + string.joinv("",fl) };
523                         foreach(var f in fl) {
524                                 if (f.length < 1) continue;
525                                 cmd += f;
526                         }
527                         this.git(cmd);                              
528                 }
529              
530
531                    
532                 } catch(Error ee) {
533                         GitMonitor.gitmonitor.pauseError(ee.message);
534                         return false;           
535                 }
536        this.push();
537        return true;                             
538                  
539      }
540     
541     
542     
543      bool createNewBranchNamed(string branchname)
544      {
545                 var stash = false;
546                  try {                                  
547                                 string[] cmd = { "ls-files" ,  "-m" };                   // list the modified files..
548                                 var files = this.git(cmd);
549                                 stash = files.length> 1 ;
550                         
551                          cmd = { "checkout", "-b" , branchname  };
552                         this.git(cmd);
553
554                cmd = { "push", "-u" , "origin" ,"HEAD"  };
555                         this.git(cmd);
556                                 if (stash) { 
557
558                                 var fl = files.split("\n");
559                                 cmd = { "commit", "-m" , "Changed " + string.joinv("",fl) };
560                                 foreach(var f in fl) {
561                                         if (f.length < 1) continue;
562                                         cmd += f;
563                                 }
564                                 this.git(cmd);  
565                                 this.push();                        
566                         }
567
568              
569                 } catch(Error ee) {
570                                 GitMonitor.gitmonitor.pauseError(ee.message);
571                                 return false;           
572                         }
573                         return true;
574      
575      }
576     
577     
578     
579     /**
580      * add:
581      * add files to track.
582      *
583      * @argument {Array} files the files to add.
584      */
585     public string add ( Gee.ArrayList<GitMonitorQueue> files ) throws Error, SpawnError
586     {
587         // should really find out if these are untracked files each..
588         // we run multiple versions to make sure that if one failes, it does not ignore the whole lot..
589         // not sure if that is how git works.. but just be certian.
590         var ret = "";
591         for (var i = 0; i < files.size;i++) {
592             var f = files.get(i).vname;
593             try {
594                 string[] cmd = { "add",    f  };
595                 this.git( cmd );
596             } catch (Error e) {
597                 ret += e.message  + "\n";
598             }        
599
600         }
601         return ret;
602     }
603         
604     public bool is_ignore(string fname) throws Error, SpawnError
605     {
606                 if (fname == ".gitignore") {
607                         this.ignore_files.clear();
608                 }
609                 
610                 if (this.ignore_files.has_key(fname)) {
611                         return this.ignore_files.get(fname);
612                 }
613                 
614                 try {
615                         var ret = this.git( { "check-ignore" , fname } );
616                         this.ignore_files.set(fname, ret.length >  0);
617                         return ret.length > 0;
618                 } catch (SpawnError e) {
619                         this.ignore_files.set(fname, false);
620                         return false;
621                 }
622                  
623     } 
624     
625     
626       /**
627      * remove:
628      * remove files to track.
629      *
630      * @argument {Array} files the files to add.
631      */
632     public string remove  ( Gee.ArrayList<GitMonitorQueue> files ) throws Error, SpawnError
633     {
634         // this may fail if files do not exist..
635         // should really find out if these are untracked files each..
636         // we run multiple versions to make sure that if one failes, it does not ignore the whole lot..
637         // not sure if that is how git works.. but just be certian.
638         var ret = "";
639
640         for (var i = 0; i < files.size;i++) {
641             var f = files.get(i).vname;
642             try {
643                 string[] cmd = { "rm",  "-f" ,  f  };
644                 this.git( cmd );
645             } catch (Error e) {
646                 ret += e.message  + "\n";
647             }        
648         }
649
650         return ret;
651
652     }
653     
654     
655     /**
656      * commit:
657      * perform a commit.
658      *
659      * @argument {Object} cfg commit configuration
660      * 
661      * @property {String} name (optional)
662      * @property {String} email (optional)
663      * @property {String} changed (date) (optional)
664      * @property {String} reason (optional)
665      * @property {Array} files - the files that have changed. 
666      * 
667      */
668      
669     public string commit ( string message, Gee.ArrayList<GitMonitorQueue> files  ) throws Error, SpawnError
670     {
671         
672
673         /*
674         var env = [];
675
676         if (typeof(cfg.name) != 'undefined') {
677             args.push( {
678                 'author' : cfg.name + ' <' + cfg.email + '>'
679             });
680             env.push(
681                 "GIT_COMMITTER_NAME" + cfg.name,
682                 "GIT_COMMITTER_EMAIL" + cfg.email
683             );
684         }
685
686         if (typeof(cfg.changed) != 'undefined') {
687             env.push("GIT_AUTHOR_DATE= " + cfg.changed )
688             
689         }
690         */
691         string[] args = { "commit", "-m" };
692         args +=  (message.length > 0  ? message : "Changed" );
693         for (var i = 0; i< files.size ; i++ ) {
694             args += files.get(i).vname; // full path?
695         }
696          
697         return this.git(args);
698     }
699     
700     /**
701      * pull:
702      * Fetch and merge remote repo changes into current branch..
703      *
704      * At present we just need this to update the current working branch..
705      * -- maybe later it will have a few options and do more stuff..
706      *
707      */
708     public string pull () throws Error, SpawnError
709     {
710         // should probably hand error conditions better... 
711         string[] cmd = { "pull" , "--no-edit" };
712         return this.git( cmd );
713
714         
715     }
716     
717     public delegate void GitAsyncCallback (GitRepo repo, int err, string str);
718     public void pull_async(GitAsyncCallback cb) 
719     {
720     
721          string[] cmd = { "pull" , "--no-edit" };
722          this.git_async( cmd , cb);
723          
724     
725     }
726     
727     /**
728      * push:
729      * Send local changes to remote repo(s)
730      *
731      * At present we just need this to push the current branch.
732      * -- maybe later it will have a few options and do more stuff..
733      *
734      */
735     public string push () throws Error, SpawnError
736     {
737         // should 
738         return this.git({ "push"  });
739         
740     }
741     
742     
743     
744      /**
745      * git:
746      * The meaty part.. run spawn.. with git..
747      *
748      *
749      */
750     
751     public string git(string[] args_in ) throws Error, SpawnError
752     {
753         // convert arguments.
754         
755         string[]  args = { "git" };
756         //args +=  "--git-dir";
757         //args +=  this.gitdir;
758         args +=  "--no-pager";
759  
760  
761         //if (this.gitdir != this.repopath) {
762         //    args +=   "--work-tree";
763          //   args += this.repopath; 
764         //}
765         for (var i = 0; i < args_in.length;i++) {
766             args += args_in[i];
767         }            
768
769         //this.lastCmd = args.join(" ");
770         //if(this.debug) {
771             GLib.debug( "CWD=%s",  this.git_working_dir ); 
772             GLib.debug( "cmd: %s", string.joinv (" ", args)); 
773         //}
774
775         string[]   env = {};
776         string  home = "HOME=" + Environment.get_home_dir() ;
777         env +=  home ;
778         // do not need to set gitpath..
779         //if (File.exists(this.repo + '/.git/config')) {
780             //env.push("GITPATH=" + this.repo );
781         //}
782           
783         var cfg = new SpawnConfig(this.git_working_dir , args , env);
784         //cfg.debug = true;
785
786        // may throw error...
787         var sp = new Spawn(cfg);
788       
789              //GLib.debug( "GOT result: %d" , sp.result);
790       
791         // diff output is a bit big..
792                 if (args_in[0] != "diff") {
793                 GLib.debug( "GOT: %s" , sp.output);
794         }
795         // parse output for some commands ?
796         return sp.output;
797     }
798         
799    unowned GitAsyncCallback git_async_on_callback;
800         public void  git_async( string[] args_in,   GitAsyncCallback cb ) throws Error, SpawnError
801     {
802         // convert arguments.
803        this.git_async_on_callback = cb;
804         string[]  args = { "git" };
805         //args +=  "--git-dir";
806         //args +=  this.gitdir;
807         args +=  "--no-pager";
808  
809  
810         //if (this.gitdir != this.repopath) {
811         //    args +=   "--work-tree";
812          //   args += this.repopath; 
813         //}
814         for (var i = 0; i < args_in.length;i++) {
815             args += args_in[i];
816         }            
817
818         //this.lastCmd = args.join(" ");
819         //if(this.debug) {
820             GLib.debug( "CWD=%s",  this.git_working_dir ); 
821             //print( "cmd: %s\n", string.joinv (" ", args)); 
822         //}
823
824         string[]   env = {};
825         string  home = "HOME=" + Environment.get_home_dir() ;
826         env +=  home ;
827         // do not need to set gitpath..
828         //if (File.exists(this.repo + '/.git/config')) {
829             //env.push("GITPATH=" + this.repo );
830         //}
831         
832
833         var cfg = new SpawnConfig(this.git_working_dir , args , env);
834         cfg.async = true;
835        
836
837        // may throw error...
838         var sp = new Spawn(cfg);
839                 //sp.ref();
840         //this.ref();
841         sp.run(this.git_async_on_complete); 
842          
843     }
844     
845     void git_async_on_complete(int err, string output)
846     {
847                 GLib.debug("GOT %d : %s", err, output);
848                 this.git_async_on_callback(this, err, output);
849 //              this.unref();   
850         //      sp.unref();             
851     
852     
853     }
854     
855  
856          
857     
858  
859     public void update_async(GitAsyncCallback cb) 
860     {
861          string[] cmd = { "fetch" , "--all" };
862          this.git_async( cmd , cb);
863          
864     }
865     
866     
867     static uint update_all_total = 0;
868     static string update_all_after = "";
869      
870     public static void updateAll(string after)
871     {
872                 update_all_after = after;
873                 var tr =  GitRepo.singleton().cache;
874             
875         
876        update_all_total = tr.size;
877        foreach(var repo  in tr.values) {
878                 if (!repo.is_managed()) {
879                         update_all_total--;                     
880                         continue;
881                 }
882            repo.update_async(updateAllCallback); 
883         } 
884                 GLib.debug("calls total = %d", (int) update_all_total);
885     }
886     public static void  updateAllCallback(GitRepo repo, int err, string res)
887     {
888         repo.loadBranches();
889         repo.loadStatus();
890         
891         update_all_total--;
892                 GLib.debug("calls remaining = %d", (int)update_all_total);      
893         if (update_all_total > 0 ) {
894
895                 return;
896                 }
897                 switch (update_all_after) {
898                         case "show_clones":
899                                 Clones.singleton().show();
900                                 break;
901                         default:
902                                 break;
903                 }
904                 return;
905     }
906     
907     
908     
909 }