Ggit.init();
var a = new GitLive.Repo("/home/alan/gitlive/gitlive");
+ a.walkDiff();
+ return;
a.is_managed();
a.is_autocommit();
a.loadLocalBranches();
public class Repo : Object {
+ string name = "";
public Ggit.Repository repo;
Callbacks callbacks;
}
public void set_autocommit(bool val)
{
- this.repo.get_config().set_int32("gitlive.autocommit", val ? "1" : "0");
+ this.repo.get_config().set_int32("gitlive.autocommit", val ? 1 : 0);
}
+ public void walkDiff()
+ {
+ this.loadLocalBranches();
+
+ var oid = this.repo.revparse(this.head.get_name() ).get_id() ;
+ var moid = this.repo.revparse("refs/heads/master" ).get_id() ;
+
+ var a = new Ggit.RevisionWalker(this.repo);
+ a.set_sort_mode(Ggit.SortMode.TOPOLOGICAL);
+ a.push(oid);
+ a.hide(moid);
+ var last = oid;
+ for (var noid = a.next(); noid != null; noid= a.next()) {
+ //var commit = this.repo.lookup(noid, typeof(Ggit.Commit)) as Ggit.Commit;
+ GLib.debug("rev: %s",
+ noid.to_string()
+ );
+ last = noid;
+ }
+ var commit = this.repo.lookup(last, typeof(Ggit.Commit)) as Ggit.Commit;
+ var parent = commit.get_parents();
+ GLib.debug("parent = %s", parent.get_id(0).to_string());
+ var master_rev = parent.get_id(0);
+ var master_commit = this.repo.lookup(master_rev, typeof(Ggit.Commit)) as Ggit.Commit;
+
+ var head_commit = this.repo.lookup(oid, typeof(Ggit.Commit)) as Ggit.Commit;
+
+ var master_tree = master_commit.get_tree();
+ var head_tree = head_commit.get_tree();
+
+ var diff = new Ggit.Diff.tree_to_tree(this.repo, master_tree, head_tree, new Ggit.DiffOptions());
+
+ diff.print(Ggit.DiffFormatType.PATCH, ( delta, hunk, line) => {
+ GLib.debug("%d: %s, %s", line.get_new_lineno(), line.get_origin().to_string(), line.get_text());
+ return 1;
+ });
+
+// noid = a.next()
+ // while (noid != null) {
+
+
+ // noid = a.next();
+ // }
+
+
+
+ }
+
+ /*
public bool doMergeClose(string commit_message)
{
this.loadLocalBranches(true);
var oldbranch = this.head.get_name();
-
+ // going to asume this is merge trees..
string [] cmd = { "merge", "--squash", oldbranch };
this.git( cmd );
cmd = { "commit", "-a" , "-m", commit_message };
notification.show();
+ }
+ */
public bool is_auto_branch ()