X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Git.vala;h=63c03c7e722fb7056c41c7034c56a5ba1f2c1347;hb=556661ee18a4b114d63e652935773a54362a4af1;hp=f98ae69a7414128182ccbafc59d68c698c568a85;hpb=d16d7a7ed42bc9d08372bc2a7b77fc536ac45880;p=gitlive diff --git a/Git.vala b/Git.vala index f98ae69a..63c03c7e 100644 --- a/Git.vala +++ b/Git.vala @@ -1,7 +1,6 @@ // valac -o /tmp/ggit Git.vala --pkg libgit2-glib-1.0 --pkg libsoup-2.4 --pkg gee-0.8 -g - - + void main() { @@ -17,21 +16,24 @@ void main() } ); - Ggit.init(); - - GLib.Timeout.add (50, () => { + Ggit.init(); + var a = new GitLive.Repo("/home/alan/gitlive/web.Texon"); + a.fetchAll(); + return; + /* + GLib.Timeout.add (1, () => { GLib.debug("Meanwhile"); - return false; - }, GLib.Priority.DEFAULT); + return true; + }, GLib.Priority.HIGH); var loop = new MainLoop(); - - var a = new GitLive.Repo("/home/alan/gitlive/gitlive"); - + + var a = new GitLive.Repo("/home/alan/gitlive/web.coba"); + GLib.debug("Starting"); a.loadRemoteHeads.begin(true, (obj,res) => { a.loadRemoteHeads.end(res); - print("got results"); + GLib.debug("got results"); a.loadLocalBranches(); loop.quit(); }); @@ -104,19 +106,29 @@ namespace GitLive { var r = this.repo.enumerate_branches(Ggit.BranchType.LOCAL); while (r.next()) { var br = r.get() as Ggit.Branch; + if (br == null) { + continue; + } + if (br.is_tag()) { + continue; + } + //var head = this.repo.revparse("refs/heads/" + br.get_name() ).get_id(); //var rhead = this.repo.revparse(br.get_upstream().get_name() ).get_id(); - GLib.debug("got branch: H=%s name = %s upstream = %s oid = %s ", - br.is_head() ? "Y" : "n", - br.get_name(), - br.get_upstream().get_name().substring(20), - br.get_target().to_string()); - this.branches.add(br); - if (br.is_head()) { - GLib.debug("HEAD= %s", br.get_name()); - this.head = br; + try { + GLib.debug("got branch: N=%s", br.get_name() ); + GLib.debug("is_head %s", br.is_head() ? "Y" : "n"); + + GLib.debug("upstream = %s", br.get_upstream() == null ? "??" : br.get_upstream().get_name().substring(20)); + GLib.debug("oid = %s",br.get_target().to_string()); + this.branches.add(br); + if (br.is_head()) { + GLib.debug("HEAD= %s", br.get_name()); + this.head = br; + } + } catch (Error e) { + GLib.debug("Skip branch"); } - } @@ -313,6 +325,7 @@ namespace GitLive { } var r = this.repo.lookup_remote("origin"); r.connect(Ggit.Direction.FETCH, this.callbacks, null, null); + yield; this.remote_heads = r.list(); foreach(var br in this.remote_heads) { @@ -321,7 +334,7 @@ namespace GitLive { } GLib.debug("Remote: name=%s oid=%s local_oid=%s is_local=%s", - br.get_name().substring(11), + br.get_name(), br.get_oid().to_string(), br.get_local_oid().to_string(), br.is_local() ? "Y" : "n" @@ -330,7 +343,7 @@ namespace GitLive { Idle.add((owned) callback); return true;; }; - new Thread("thread-example", run); + new Thread("loadRemoteHeads-" , run); yield;