3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
15 destroy_event : function (self, event) {
19 response : function (self, id) {
25 if (typeof(this.get('bug').getValue()) != 'object') {
32 //var val = this.get('bug').getValue();
49 //this.el.set_title("Merger - ??? ");
50 // this.el.set_title("Merger - " + this.repo.repopath);
55 this.get('/workingCombo').model.load(Merger.repo.branches);
60 //this.get('/ok_button').el.set_sensitive(false);
62 // block until we return.
63 var run_ret = this.el.run();
67 print("RUN RETURN : " + run_ret);
69 //print(JSON.stringify(this.get('bug').getValue()));
70 // return this.get('bug').getValue();
71 //this.success = c.success;
76 pack : function(p,e) {
77 p.el.get_content_area().pack_start(e.el,true,true,0)
82 pack : "pack_start,false,true",
87 clicked : function (self) {
91 var hist = Merger.repo.dayTree('/', false, 'rev', 'github..master');
92 this.get('/historyTreeStore').load(hist);
99 label : "Select Branch",
104 label : "Working Branch"
110 this.el = new Gtk.ComboBox.with_entry();
113 this.model = new XObject(this.model);
115 this.el.set_model(this.model.el);
116 this.el.set_entry_text_column (0);
117 XObject.prototype.init.call(this);
121 xtype: Gtk.ListStore,
125 //this.insert(citer,iter,0);
128 for(var i =0 ; i < tr.length; i++) {
131 //print(JSON.stringify(ret,null,4));
134 this.el.set_value(ret.iter, 0, '' + tr[i].name );
135 this.el.set_value(ret.iter, 1, '' + tr[i].rev );
141 XObject.prototype.init.call(this);
142 this.el.set_column_types ( 3, [
143 GObject.TYPE_STRING, // file
144 GObject.TYPE_STRING, // added
145 GObject.TYPE_STRING, // removed
152 label : "Release Branch"
158 this.el = new Gtk.ComboBox.with_entry();
161 this.model = new XObject(this.model);
163 this.el.set_model(this.model.el);
164 this.el.set_entry_text_column (0);
165 XObject.prototype.init.call(this);
169 xtype: Gtk.ListStore,
171 XObject.prototype.init.call(this);
172 this.el.set_column_types ( 3, [
173 GObject.TYPE_STRING, // file
174 GObject.TYPE_STRING, // added
175 GObject.TYPE_STRING, // removed
180 //this.insert(citer,iter,0);
183 for(var i =0 ; i < tr.length; i++) {
186 //print(JSON.stringify(ret,null,4));
189 this.el.set_value(ret.iter, 0, '' + tr[i].name );
190 this.el.set_value(ret.iter, 1, '' + tr[i].rev );
201 pack : "pack_end,true,true,0",
210 xtype: Gtk.ScrolledWindow,
212 XObject.prototype.init.call(this);
213 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
219 cursor_changed : function (self) {
221 if (this.el.get_selection().count_selected_rows() < 1) {
225 var model = this.get('/historyTreeStore');
227 var s = this.el.get_selection();
230 var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
231 print("OUT?" + value);// id..
232 // load the list in the right grid..
233 var Repo = imports.Scm.Git.Repo.Repo;
237 var files = Merger.repo.changedFiles('/', 'rev', 'github..' + value);
238 this.get('/changedFilesStore').load(files);
245 XObject.prototype.init.call(this);
246 var description = new Pango.FontDescription.c_new();
247 description.set_size(8000);
248 this.el.modify_font(description);
250 this.selection = this.el.get_selection();
251 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
255 781 // is this really needed??
256 782 this.selection.signal['changed'].connect(function() {
257 783 _this.get('/LeftTree.view').listeners.cursor_changed.apply(
258 784 _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']
266 xtype: Gtk.TreeStore,
267 id : "historyTreeStore",
270 XObject.prototype.init.call(this);
271 this.el.set_column_types ( 3, [
272 GObject.TYPE_STRING, // title
273 GObject.TYPE_STRING, // rev
276 load : function(tr,iter)
278 //this.insert(citer,iter,0);
283 for(var i =0 ; i < tr.length; i++) {
286 this.el.insert(ret ,iter,-1);
290 //print(JSON.stringify(ret,null,4));
293 this.el.set_value(ret.iter, 0, '' + tr[i].text );
294 this.el.set_value(ret.iter, 1, '' + tr[i].rev );
296 if (tr[i].children && tr[i].children.length) {
297 this.load(tr[i].children, ret.iter);
303 xtype: Gtk.TreeViewColumn,
304 pack : "append_column",
306 XObject.prototype.init.call(this);
307 this.el.add_attribute(this.items[0].el , 'markup', 0 );
312 xtype: Gtk.CellRendererText,
322 xtype: Gtk.ScrolledWindow,
324 XObject.prototype.init.call(this);
325 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
331 cursor_changed : function (self) {
332 // SEE SELECTION.CHANGED
333 if (this.el.get_selection().count_selected_rows() < 1) {
334 //nothing? - clea it?
338 var model = this.get('/changedFilesStore');
340 var s = this.el.get_selection();
342 s.selected_foreach(function(model,p,iter) {
344 files.push( model.get_value(iter, 0).value.get_string());
347 this.get('/patchview').showDiff(files);
348 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
349 //print("OUT?" + value);// id..
350 // load the list in the right grid..
356 id : "changedFilesView",
359 XObject.prototype.init.call(this);
360 var description = new Pango.FontDescription.c_new();
361 description.set_size(8000);
362 this.el.modify_font(description);
364 this.selection = this.el.get_selection();
365 this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);
367 this.selection.signal['changed'].connect(function() {
368 _this.listeners.cursor_changed.apply(
375 xtype: Gtk.ListStore,
376 id : "changedFilesStore",
379 XObject.prototype.init.call(this);
380 this.el.set_column_types ( 3, [
381 GObject.TYPE_STRING, // file
382 GObject.TYPE_STRING, // added
383 GObject.TYPE_STRING, // removed
388 //this.insert(citer,iter,0);
390 for(var i =0 ; i < tr.length; i++) {
395 //print(JSON.stringify(ret,null,4));
398 this.el.set_value(ret.iter, 0, '' + tr[i].filename );
399 this.el.set_value(ret.iter, 1, '' + tr[i].added );
400 this.el.set_value(ret.iter, 2, '' + tr[i].removed );
407 xtype: Gtk.TreeViewColumn,
410 pack : "append_column",
413 XObject.prototype.init.call(this);
414 this.el.add_attribute(this.items[0].el , 'markup', 0 );
419 xtype: Gtk.CellRendererText,
425 xtype: Gtk.TreeViewColumn,
427 pack : "append_column",
430 XObject.prototype.init.call(this);
431 this.el.add_attribute(this.items[0].el , 'markup', 1 );
436 xtype: Gtk.CellRendererText,
442 xtype: Gtk.TreeViewColumn,
444 pack : "append_column",
447 XObject.prototype.init.call(this);
448 this.el.add_attribute(this.items[0].el , 'markup', 2 );
453 xtype: Gtk.CellRendererText,
465 xtype: Gtk.ListStore,
479 pack : "pack_start,false,false,0",
483 label : "Commit diff (no merge)"
487 label : "Commit diff (merge after)"
492 xtype: Gtk.ScrolledWindow,
493 pack : "pack_end,true,true,0",
495 XObject.prototype.init.call(this);
496 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
500 xtype: WebKit.WebView,
503 showDiff : function(files) {
506 var diff = Merger.repo.diff(files, 'github', 'master');
509 var s = "document.body.textContent='';var pre = document.createElement('pre'); document.body.appendChild(pre);";
510 s += "pre.textContent = " +
511 JSON.stringify(repo.lastCmd + "\n") + '+ ' +
512 JSON.stringify(diff) + ";";
515 this.el.execute_script(s);
534 pack : "add_action_widget,0"
540 pack : "add_action_widget,1"
545 XObject.cache['/Merger'] = Merger;