1 ///<script type="text/javascript">
3 var Gio = imports.gi.Gio;
4 var GLib = imports.gi.GLib;
6 var Spawn = imports.Spawn.Spawn;
10 * Class to handle git operations..???
14 * Git = import.Git.Git;
16 * var g = new Git( '/home/me/git' );
18 * g.run('commit', { all : true , message : 'test' }, 'filename',)
21 * print(Git.run('/home/me/git', 'log'))
30 * @param repo {String} directory that the repo is in, either bare or not.
34 //var prototypeInit = false;
37 if (!GLib.file_test(repo, GLib.FileTest.IS_DIR)) {
38 throw "Repo does not exist";
43 // proto type on set up yet..
44 // we could list this to generate methods.. /usr/lib/git-core/
45 var props = Gil.prototypeInit();
46 for (var i in props) {
58 * @arg command {String} command to run
59 * @arg arguments.... {String|Object} arguments to send to command
66 for (var i=0;i< arguments.length;i++) {
67 if (typeof(arguments[i]) == 'string') {
68 args.push(arguments[i]);
71 if (typeof(arguments[i]) == 'object') {
72 for(var k in arguments[i]) {
73 var v = arguments[i][k];
85 env : [ "GITPATH=" + this.repo , "HOME=" + GLib.get_home_dir() ],
93 // parse output for some commands ?
101 * @arg command {String} command to run
102 * @arg arguments.... {String|Object} arguments to send to command
108 var args = Array.prototype.slice.call(arguments);
110 var repo = args.shift(args);
111 var x = new Git(repo);
113 return x.run.apply(x, args);
120 //print(run('/home/alan/gitlive/gitlive', 'log'));