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                 var ret =   this.git({ "config" , "gitlive." + key });
219                 this.config_cache.set(key, ret);
220                 return ret;
221         } catch (Error e) {
222                 this.config_cache.set(key, "");
223                 return ""; // happens when there is nothing set...
224         }
225
226         }
227     public void set_config(string key, string value) {
228         this.git({ "config" , "gitlive." + key, value });
229         this.config_cache.set(key,value);
230         }
231     
232     public bool is_managed()
233     {
234         return this.get_config("managed") == "1";
235     }
236     
237     
238     public bool is_autocommit ()
239     {           
240         return this.get_config("autocommit") == "1";            
241     }
242     
243     public void set_autocommit(bool val)
244     {
245                 this.set_config("autocommit", val ? "1" : "0");
246     
247     }
248     
249     public bool is_auto_branch ()
250     {
251         if (this.name == "gitlog") {
252                 return false;
253                 }
254                 // check remote...
255         if (this.is_managed()) {
256                 return true;
257                 }
258         return false;
259         
260  
261     }
262     
263     public void set_auto_branch(bool val)
264     {
265                 if (this.name == "gitlog") {
266                 return;
267                 }
268                 this.set_config("managed", val ? "1" : "0");
269     
270     }
271     public bool is_autopush ()
272     {
273         return this.get_config("autopush") == "1";
274     }
275     public void set_autopush(bool val)
276     {
277                 this.set_config("autopush", val ? "1" : "0");
278     }
279     
280     
281         public void loadStatus()
282         {
283                 var r = this.git({ "status" , "--porcelain" });
284                 this.git_status = r;
285                 this.has_local_changes = r.length > 0;
286                 
287                 var rs = this.git({ "status" , "-sb" });
288
289                 this.ahead_or_behind = rs.contains("[ahead") ? "A" : (rs.contains("[behind") ? "B" : "");
290                 
291                 
292                 this.git_diff  = this.git({ "diff" , "HEAD", "--no-color" });
293         }    
294
295     
296     public void loadBranches()
297     {
298
299         GitBranch.loadBranches(this);
300     }
301      
302     
303     
304     
305     public string branchesToString()
306     {
307         var ret = "";
308                 foreach( var br in this.branches.values) {
309                         if (br.name == "") {
310                                 continue; 
311                         }
312                         ret += ret.length > 0 ? "\n"  : "";
313                         ret += br.name;
314                 
315                 }
316                 return ret;
317         
318     }
319      public static void doMerges(string action, string ticket_id, string commit_message)
320     {
321        GitMonitor.gitmonitor.stop();
322        
323        var commitrevs = "";
324        var sucess = true;
325        foreach(var  repo in GitRepo.singleton().cache.values) {
326                if (repo.activeTicket != null && repo.activeTicket.id == ticket_id) {
327                        var res = repo.doMerge(action,ticket_id, commit_message);
328                        if (!res) {
329                                sucess = false;
330                                continue;
331                        }
332                        commitrevs += commitrevs.length > 0 ? " " : "";
333                        commitrevs += repo.currentBranch.lastrev;
334                }
335        }
336        if (sucess && action == "CLOSE") {
337                RooTicket.singleton().getById(ticket_id).close(commitrevs);
338        }
339        GitMonitor.gitmonitor.start();
340     }
341      
342
343     public bool doMerge(string action, string ticket_id, string commit_message)
344     {
345        // in theory we should check to see if other repo's have got the same branch and merge all them at the same time.
346        // also need to decide which branch we will merge into?
347                    var ret = "";
348                    if (action == "CLOSE" || action == "LEAVE") {
349                                    
350                try {
351                    var oldbranch = this.currentBranch.name;
352                    this.setActiveTicket(null, "master");
353                            string [] cmd = { "merge",   "--squash",  oldbranch };
354                            this.git( cmd );
355                            cmd = { "commit",   "-a" , "-m",  commit_message };
356                            this.git( cmd );
357                            this.push();
358                            this.loadBranches(); // updates lastrev..
359                
360                        var notification = new Notify.Notification(
361                                "Merged branch %s to master".printf(oldbranch),
362                                "",
363                                 "dialog-information"
364                                
365                        );
366
367                        notification.set_timeout(5);
368                        notification.show();   
369                
370                // close ticket..
371                return true; 
372                
373            } catch (Error e) {
374
375                GitMonitor.gitmonitor.pauseError(e.message);
376                return false;
377            }
378            // error~?? -- show the error dialog...
379                    return false;
380        }
381        if (action == "MASTER") {
382                // merge master into ours..
383                        try {
384                        string[] cmd = { "merge",  "master" };
385                        this.git( cmd );
386                        var notification = new Notify.Notification(
387                                        "Merged code from master to %s".printf(this.currentBranch.name),
388                                        "",
389                                         "dialog-information"
390                                        
391                                );
392                                notification.set_timeout(5);
393                                notification.show();   
394                       
395                        return true;
396                        } catch (Error e) {
397                        GitMonitor.gitmonitor.pauseError(e.message);
398                        return false;
399                    }
400            }
401        if (action == "EXIT") {
402                        try {
403                        var oldbranch  = this.currentBranch.name;
404                          this.setActiveTicket(null, "master");
405                        this.loadBranches();
406                        var notification = new Notify.Notification(
407                                        "Left branch %s".printf(oldbranch),
408                                        "",
409                                         "dialog-information"
410                                        
411                                );
412                                notification.set_timeout(5);
413                                notification.show();   
414                        
415                        return true;
416                    } catch (Error e) {
417                        GitMonitor.gitmonitor.pauseError(e.message);
418
419                        return false;                   
420                    }
421                    // error~?? -- show the error dialog...
422
423        }
424        return false;
425     }
426         
427     public void loadActiveTicket()
428     {
429         this.activeTicket = null;
430                 var ticket_id = this.get_config("ticket");
431         
432         if (ticket_id.length < 1) {
433                 return;
434                 }
435                 this.activeTicket = RooTicket.singleton().getById(ticket_id.strip());
436         
437         
438     }
439     
440     
441     
442     public bool setActiveTicket(RooTicket? ticket, string branchname)
443     {
444         this.set_config("ticket", "");
445         if (!this.createBranchNamed(branchname)) {
446                 return false;
447                 }
448                 this.set_config("ticket", ticket == null ? "": ticket.id);
449         this.activeTicket = ticket;
450         return true;
451     }
452     
453     public bool createBranchNamed(string branchname)
454     {   
455                 
456
457                      if (this.branches.has_key(branchname)) {
458                         this.switchToExistingBranchNamed(branchname);
459                     
460                     } else {
461                                  this.createNewBranchNamed(branchname); 
462                             
463                     }
464                        var notification = new Notify.Notification(
465                        "Changed to branch %s".printf(branchname),
466                        "",
467                         "dialog-information"
468                        
469                );
470
471                notification.set_timeout(5);
472                notification.show();   
473        
474          
475          this.loadBranches(); // update branch list...
476          //GitMonitor.gitmonitor.runQueue(); // no point - we have hidden the queue..
477          return true;
478     }
479      bool switchToExistingBranchNamed(string branchname)
480      {
481                 var stash = false;
482                                          // this is where it get's tricky...
483                 string files = "";
484                 try {                   
485                                 string[] cmd = { "ls-files" ,  "-m" };                   // list the modified files..
486                                 files = this.git(cmd);
487                                 stash = files.length> 1 ;
488                                 
489                                 
490                                 cmd = { "stash" };                      
491                                 if (stash) { this.git(cmd); }
492                                 
493                                 this.pull();
494                                 
495                                 cmd = { "checkout", branchname  };
496                                 this.git(cmd);
497                   } catch(Error e) {
498                                 GitMonitor.gitmonitor.pauseError(e.message);
499                                 return false;           
500                   }
501                 try {
502                    if (branchname != "master") {
503                        string[] cmd = { "merge", "master"  };
504                             this.git(cmd);
505                             this.push();
506                        
507                     }
508                     
509                 } catch(Error e) {
510                     string[] cmd = { "checkout", "master"  };
511                     this.git(cmd);
512                         GitMonitor.gitmonitor.pauseError(
513                                 "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(
514                                         branchname)
515                                  + e.message
516                         );
517                         return false;           
518                  
519                 }
520                 try {                                   
521                     string[]  cmd = { "stash", "pop"  };
522                     if (stash) { 
523                         this.git(cmd); 
524                         var fl = files.split("\n");
525                         cmd = { "commit", "-m" , "Changed " + string.joinv("",fl) };
526                         foreach(var f in fl) {
527                                 if (f.length < 1) continue;
528                                 cmd += f;
529                         }
530                         this.git(cmd);                              
531                 }
532              
533
534                    
535                 } catch(Error ee) {
536                         GitMonitor.gitmonitor.pauseError(ee.message);
537                         return false;           
538                 }
539        this.push();
540        return true;                             
541                  
542      }
543     
544     
545     
546      bool createNewBranchNamed(string branchname)
547      {
548                 var stash = false;
549                  try {                                  
550                                 string[] cmd = { "ls-files" ,  "-m" };                   // list the modified files..
551                                 var files = this.git(cmd);
552                                 stash = files.length> 1 ;
553                         
554                          cmd = { "checkout", "-b" , branchname  };
555                         this.git(cmd);
556
557                cmd = { "push", "-u" , "origin" ,"HEAD"  };
558                         this.git(cmd);
559                                 if (stash) { 
560
561                                 var fl = files.split("\n");
562                                 cmd = { "commit", "-m" , "Changed " + string.joinv("",fl) };
563                                 foreach(var f in fl) {
564                                         if (f.length < 1) continue;
565                                         cmd += f;
566                                 }
567                                 this.git(cmd);  
568                                 this.push();                        
569                         }
570
571              
572                 } catch(Error ee) {
573                                 GitMonitor.gitmonitor.pauseError(ee.message);
574                                 return false;           
575                         }
576                         return true;
577      
578      }
579     
580     
581     
582     /**
583      * add:
584      * add files to track.
585      *
586      * @argument {Array} files the files to add.
587      */
588     public string add ( Gee.ArrayList<GitMonitorQueue> files ) throws Error, SpawnError
589     {
590         // should really find out if these are untracked files each..
591         // we run multiple versions to make sure that if one failes, it does not ignore the whole lot..
592         // not sure if that is how git works.. but just be certian.
593         var ret = "";
594         for (var i = 0; i < files.size;i++) {
595             var f = files.get(i).vname;
596             try {
597                 string[] cmd = { "add",    f  };
598                 this.git( cmd );
599             } catch (Error e) {
600                 ret += e.message  + "\n";
601             }        
602
603         }
604         return ret;
605     }
606         
607     public bool is_ignore(string fname) throws Error, SpawnError
608     {
609                 if (fname == ".gitignore") {
610                         this.ignore_files.clear();
611                 }
612                 
613                 if (this.ignore_files.has_key(fname)) {
614                         return this.ignore_files.get(fname);
615                 }
616                 
617                 try {
618                         var ret = this.git( { "check-ignore" , fname } );
619                         this.ignore_files.set(fname, ret.length >  0);
620                         return ret.length > 0;
621                 } catch (SpawnError e) {
622                         this.ignore_files.set(fname, false);
623                         return false;
624                 }
625                  
626     } 
627     
628     
629       /**
630      * remove:
631      * remove files to track.
632      *
633      * @argument {Array} files the files to add.
634      */
635     public string remove  ( Gee.ArrayList<GitMonitorQueue> files ) throws Error, SpawnError
636     {
637         // this may fail if files do not exist..
638         // should really find out if these are untracked files each..
639         // we run multiple versions to make sure that if one failes, it does not ignore the whole lot..
640         // not sure if that is how git works.. but just be certian.
641         var ret = "";
642
643         for (var i = 0; i < files.size;i++) {
644             var f = files.get(i).vname;
645             try {
646                 string[] cmd = { "rm",  "-f" ,  f  };
647                 this.git( cmd );
648             } catch (Error e) {
649                 ret += e.message  + "\n";
650             }        
651         }
652
653         return ret;
654
655     }
656     
657     
658     /**
659      * commit:
660      * perform a commit.
661      *
662      * @argument {Object} cfg commit configuration
663      * 
664      * @property {String} name (optional)
665      * @property {String} email (optional)
666      * @property {String} changed (date) (optional)
667      * @property {String} reason (optional)
668      * @property {Array} files - the files that have changed. 
669      * 
670      */
671      
672     public string commit ( string message, Gee.ArrayList<GitMonitorQueue> files  ) throws Error, SpawnError
673     {
674         
675
676         /*
677         var env = [];
678
679         if (typeof(cfg.name) != 'undefined') {
680             args.push( {
681                 'author' : cfg.name + ' <' + cfg.email + '>'
682             });
683             env.push(
684                 "GIT_COMMITTER_NAME" + cfg.name,
685                 "GIT_COMMITTER_EMAIL" + cfg.email
686             );
687         }
688
689         if (typeof(cfg.changed) != 'undefined') {
690             env.push("GIT_AUTHOR_DATE= " + cfg.changed )
691             
692         }
693         */
694         string[] args = { "commit", "-m" };
695         args +=  (message.length > 0  ? message : "Changed" );
696         for (var i = 0; i< files.size ; i++ ) {
697             args += files.get(i).vname; // full path?
698         }
699          
700         return this.git(args);
701     }
702     
703     /**
704      * pull:
705      * Fetch and merge remote repo changes into current branch..
706      *
707      * At present we just need this to update the current working branch..
708      * -- maybe later it will have a few options and do more stuff..
709      *
710      */
711     public string pull () throws Error, SpawnError
712     {
713         // should probably hand error conditions better... 
714         string[] cmd = { "pull" , "--no-edit" };
715         return this.git( cmd );
716
717         
718     }
719     
720     public delegate void GitAsyncCallback (GitRepo repo, int err, string str);
721     public void pull_async(GitAsyncCallback cb) 
722     {
723     
724          string[] cmd = { "pull" , "--no-edit" };
725          this.git_async( cmd , cb);
726          
727     
728     }
729     
730     /**
731      * push:
732      * Send local changes to remote repo(s)
733      *
734      * At present we just need this to push the current branch.
735      * -- maybe later it will have a few options and do more stuff..
736      *
737      */
738     public string push () throws Error, SpawnError
739     {
740         // should 
741         return this.git({ "push"  });
742         
743     }
744     
745     
746     
747      /**
748      * git:
749      * The meaty part.. run spawn.. with git..
750      *
751      *
752      */
753     
754     public string git(string[] args_in ) throws Error, SpawnError
755     {
756         // convert arguments.
757         
758         string[]  args = { "git" };
759         //args +=  "--git-dir";
760         //args +=  this.gitdir;
761         args +=  "--no-pager";
762  
763  
764         //if (this.gitdir != this.repopath) {
765         //    args +=   "--work-tree";
766          //   args += this.repopath; 
767         //}
768         for (var i = 0; i < args_in.length;i++) {
769             args += args_in[i];
770         }            
771
772         //this.lastCmd = args.join(" ");
773         //if(this.debug) {
774             GLib.debug( "CWD=%s",  this.git_working_dir ); 
775             GLib.debug( "cmd: %s", string.joinv (" ", args)); 
776         //}
777
778         string[]   env = {};
779         string  home = "HOME=" + Environment.get_home_dir() ;
780         env +=  home ;
781         // do not need to set gitpath..
782         //if (File.exists(this.repo + '/.git/config')) {
783             //env.push("GITPATH=" + this.repo );
784         //}
785           
786         var cfg = new SpawnConfig(this.git_working_dir , args , env);
787         //cfg.debug = true;
788
789        // may throw error...
790         var sp = new Spawn(cfg);
791       
792              //GLib.debug( "GOT result: %d" , sp.result);
793       
794         // diff output is a bit big..
795                 if (args_in[0] != "diff") {
796                 GLib.debug( "GOT: %s" , sp.output);
797         }
798         // parse output for some commands ?
799         return sp.output;
800     }
801         
802    unowned GitAsyncCallback git_async_on_callback;
803         public void  git_async( string[] args_in,   GitAsyncCallback cb ) throws Error, SpawnError
804     {
805         // convert arguments.
806        this.git_async_on_callback = cb;
807         string[]  args = { "git" };
808         //args +=  "--git-dir";
809         //args +=  this.gitdir;
810         args +=  "--no-pager";
811  
812  
813         //if (this.gitdir != this.repopath) {
814         //    args +=   "--work-tree";
815          //   args += this.repopath; 
816         //}
817         for (var i = 0; i < args_in.length;i++) {
818             args += args_in[i];
819         }            
820
821         //this.lastCmd = args.join(" ");
822         //if(this.debug) {
823             GLib.debug( "CWD=%s",  this.git_working_dir ); 
824             //print( "cmd: %s\n", string.joinv (" ", args)); 
825         //}
826
827         string[]   env = {};
828         string  home = "HOME=" + Environment.get_home_dir() ;
829         env +=  home ;
830         // do not need to set gitpath..
831         //if (File.exists(this.repo + '/.git/config')) {
832             //env.push("GITPATH=" + this.repo );
833         //}
834         
835
836         var cfg = new SpawnConfig(this.git_working_dir , args , env);
837         cfg.async = true;
838        
839
840        // may throw error...
841         var sp = new Spawn(cfg);
842                 //sp.ref();
843         //this.ref();
844         sp.run(this.git_async_on_complete); 
845          
846     }
847     
848     void git_async_on_complete(int err, string output)
849     {
850                 GLib.debug("GOT %d : %s", err, output);
851                 this.git_async_on_callback(this, err, output);
852 //              this.unref();   
853         //      sp.unref();             
854     
855     
856     }
857     
858  
859          
860     
861  
862     public void update_async(GitAsyncCallback cb) 
863     {
864          string[] cmd = { "fetch" , "--all" };
865          this.git_async( cmd , cb);
866          
867     }
868     
869     
870     static uint update_all_total = 0;
871     static string update_all_after = "";
872      
873     public static void updateAll(string after)
874     {
875                 update_all_after = after;
876                 var tr =  GitRepo.singleton().cache;
877             
878         
879        update_all_total = tr.size;
880        foreach(var repo  in tr.values) {
881                 if (!repo.is_managed()) {
882                         update_all_total--;                     
883                         continue;
884                 }
885            repo.update_async(updateAllCallback); 
886         } 
887                 GLib.debug("calls total = %d", (int) update_all_total);
888     }
889     public static void  updateAllCallback(GitRepo repo, int err, string res)
890     {
891         repo.loadBranches();
892         repo.loadStatus();
893         
894         update_all_total--;
895                 GLib.debug("calls remaining = %d", (int)update_all_total);      
896         if (update_all_total > 0 ) {
897
898                 return;
899                 }
900
901                 
902                 switch (update_all_after) {
903                         case "show_clones":
904                                 Clones.singleton().show();
905                                 break;
906                         default:
907                                 GLib.debug("Unkown call after load = %s", update_after_all);            
908                                 break;
909                 }
910                 return;
911     }
912     
913     
914     
915 }