omg finally works

This commit is contained in:
Peter Cottle 2012-12-17 10:24:55 -08:00
parent aadeab8299
commit f34c606d87
12 changed files with 496 additions and 251 deletions

View file

@ -4385,7 +4385,17 @@ require.define("/node_modules/backbone/node_modules/underscore/underscore.js",fu
}); });
require.define("/src/js/visuals/index.js",function(require,module,exports,__dirname,__filename,process,global){var Main = require('../app'); require.define("/src/js/visuals/index.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var GRAPHICS = require('../util/constants').GRAPHICS; var GRAPHICS = require('../util/constants').GRAPHICS;
var GLOBAL = require('../util/constants').GLOBAL; var GLOBAL = require('../util/constants').GLOBAL;
@ -4414,6 +4424,7 @@ var Visualization = Backbone.View.extend({
paperInitialize: function(paper, options) { paperInitialize: function(paper, options) {
this.paper = paper; this.paper = paper;
var Main = require('../app');
this.events = Main.getEvents(); this.events = Main.getEvents();
this.commitCollection = new CommitCollection(); this.commitCollection = new CommitCollection();
@ -4480,7 +4491,8 @@ function GitVisuals(options) {
this.branchCollection.on('remove', this.removeBranch, this); this.branchCollection.on('remove', this.removeBranch, this);
this.deferred = []; this.deferred = [];
Main.getEvents().on('refreshTree', _.bind( this.events = require('../app').getEvents();
this.events.on('refreshTree', _.bind(
this.refreshTree, this this.refreshTree, this
)); ));
} }
@ -4925,7 +4937,7 @@ GitVisuals.prototype.calcDepthRecursive = function(commit, depth) {
GitVisuals.prototype.canvasResize = _.debounce(function(width, height) { GitVisuals.prototype.canvasResize = _.debounce(function(width, height) {
// refresh when we are ready // refresh when we are ready
if (GLOBAL.isAnimating) { if (GLOBAL.isAnimating) {
Main.getEvents().trigger('processCommandFromEvent', 'refresh'); this.events.trigger('processCommandFromEvent', 'refresh');
} else { } else {
this.refreshTree(); this.refreshTree();
} }
@ -5070,69 +5082,77 @@ exports.GitVisuals = GitVisuals;
}); });
require.define("/src/js/app/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore'); require.define("/src/js/util/index.js",function(require,module,exports,__dirname,__filename,process,global){exports.isBrowser = function() {
var Backbone = require('backbone'); var inBrowser = String(typeof window) !== 'undefined';
return inBrowser;
};
/**
* Globals
*/
var events = _.clone(Backbone.Events);
var ui = null;
var mainVis = null;
///////////////////////////////////////////////////////////////////////
$(document).ready(function(){
var Visuals = require('../visuals');
ui = new UI();
mainVis = new Visuals.Visualization({
el: $('#canvasWrapper')[0]
});
if (/\?demo/.test(window.location.href)) {
setTimeout(function() {
events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
}, 500);
}
}); });
function UI() { require.define("/src/js/util/constants.js",function(require,module,exports,__dirname,__filename,process,global){/**
var Collections = require('../models/collections'); * Constants....!!!
var CommandViews = require('../views/commandViews'); */
var TIME = {
betweenCommandsDelay: 400
};
this.commandCollection = new Collections.CommandCollection(); // useful for locks, etc
var GLOBAL = {
isAnimating: false
};
this.commandBuffer = new Collections.CommandBuffer({ var GRAPHICS = {
collection: this.commandCollection arrowHeadSize: 8,
});
this.commandPromptView = new CommandViews.CommandPromptView({ nodeRadius: 17,
el: $('#commandLineBar'), curveControlPointOffset: 50,
collection: this.commandCollection defaultEasing: 'easeInOut',
}); defaultAnimationTime: 400,
this.commandLineHistoryView = new CommandViews.CommandLineHistoryView({
el: $('#commandLineHistory'),
collection: this.commandCollection
});
$('#commandTextField').focus(); //rectFill: '#FF3A3A',
rectFill: 'hsb(0.8816909813322127,0.7,1)',
headRectFill: '#2831FF',
rectStroke: '#FFF',
rectStrokeWidth: '3',
multiBranchY: 20,
upstreamHeadOpacity: 0.5,
upstreamNoneOpacity: 0.2,
edgeUpstreamHeadOpacity: 0.4,
edgeUpstreamNoneOpacity: 0.15,
visBranchStrokeWidth: 2,
visBranchStrokeColorNone: '#333',
defaultNodeFill: 'hsba(0.5,0.8,0.7,1)',
defaultNodeStrokeWidth: 2,
defaultNodeStroke: '#FFF',
orphanNodeFill: 'hsb(0.5,0.8,0.7)'
};
exports.GLOBAL = GLOBAL;
exports.TIME = TIME;
exports.GRAPHICS = GRAPHICS;
});
require.define("/src/js/models/collections.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
exports.getEvents = function() { var Commit = require('../git').Commit;
return events;
};
exports.getUI = function() {
return ui;
};
});
require.define("/src/js/models/collections.js",function(require,module,exports,__dirname,__filename,process,global){var Commit = require('../git').Commit;
var Branch = require('../git').Branch; var Branch = require('../git').Branch;
var Main = require('../app');
var Command = require('../models/commandModel').Command; var Command = require('../models/commandModel').Command;
var CommandEntry = require('../models/commandModel').CommandEntry; var CommandEntry = require('../models/commandModel').CommandEntry;
var TIME = require('../util/constants').TIME; var TIME = require('../util/constants').TIME;
@ -5151,9 +5171,15 @@ var BranchCollection = Backbone.Collection.extend({
var CommandEntryCollection = Backbone.Collection.extend({ var CommandEntryCollection = Backbone.Collection.extend({
model: CommandEntry, model: CommandEntry,
localStorage: new Backbone.LocalStorage('CommandEntries') localStorage: (Backbone.LocalStorage) ? new Backbone.LocalStorage('CommandEntries') : null
}); });
if (Backbone.LocalStorage) {
console.log('local storage there');
} else {
console.log('not htere');
}
var CommandBuffer = Backbone.Model.extend({ var CommandBuffer = Backbone.Model.extend({
defaults: { defaults: {
collection: null collection: null
@ -5205,6 +5231,7 @@ var CommandBuffer = Backbone.Model.extend({
} }
if (!popped.get('error')) { if (!popped.get('error')) {
// pass in a callback, so when this command is "done" we will process the next. // pass in a callback, so when this command is "done" we will process the next.
var Main = require('../app');
Main.getEvents().trigger('processCommand', popped, callback); Main.getEvents().trigger('processCommand', popped, callback);
} else { } else {
this.clear(); this.clear();
@ -5235,14 +5262,19 @@ exports.CommandBuffer = CommandBuffer;
}); });
require.define("/src/js/git/index.js",function(require,module,exports,__dirname,__filename,process,global){if (!require('../util').isBrowser()) { require.define("/src/js/git/index.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var _ = require('underscore'); var Backbone;
var Backbone = require('backbone'); // horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var AnimationFactoryModule = require('../visuals/animation/animationFactory'); var AnimationFactoryModule = require('../visuals/animation/animationFactory');
var AnimationQueue = require('../visuals/animation').AnimationQueue; var AnimationQueue = require('../visuals/animation').AnimationQueue;
var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView;
var Errors = require('../util/errors'); var Errors = require('../util/errors');
var GitError = Errors.GitError; var GitError = Errors.GitError;
@ -6256,6 +6288,7 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation)
this.animationQueue.start(); this.animationQueue.start();
}, this); }, this);
var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView;
new InteractiveRebaseView({ new InteractiveRebaseView({
callback: callback, callback: callback,
toRebase: toRebase, toRebase: toRebase,
@ -6891,14 +6924,21 @@ exports.Ref = Ref;
}); });
require.define("/src/js/util/index.js",function(require,module,exports,__dirname,__filename,process,global){exports.isBrowser = function() { require.define("/src/js/visuals/animation/animationFactory.js",function(require,module,exports,__dirname,__filename,process,global){var _;
return (typeof window === undefined); var Backbone;
}; // horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var Animation = require('./index').Animation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
}); /******************
require.define("/src/js/visuals/animation/animationFactory.js",function(require,module,exports,__dirname,__filename,process,global){/******************
* This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time. * This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time.
* The tricky thing is that when a new commit has to be "born," say in the middle of a rebase * The tricky thing is that when a new commit has to be "born," say in the middle of a rebase
* or something, it must animate out from the parent position to it's birth position. * or something, it must animate out from the parent position to it's birth position.
@ -6908,14 +6948,6 @@ require.define("/src/js/visuals/animation/animationFactory.js",function(require,
* and then essentially animate the entire tree too. * and then essentially animate the entire tree too.
*/ */
var Animation = require('./index').Animation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
if (!require('../../util').isBrowser()) {
var _ = require('underscore');
var Backbone = require('backbone');
}
// essentially a static class // essentially a static class
var AnimationFactory = function() { var AnimationFactory = function() {
@ -7164,9 +7196,15 @@ exports.AnimationFactory = AnimationFactory;
require.define("/src/js/visuals/animation/index.js",function(require,module,exports,__dirname,__filename,process,global){var GLOBAL = require('../../util/constants').GLOBAL; require.define("/src/js/visuals/animation/index.js",function(require,module,exports,__dirname,__filename,process,global){var GLOBAL = require('../../util/constants').GLOBAL;
if (!require('../../util').isBrowser()) { var _;
var _ = require('underscore'); var Backbone;
var Backbone = require('backbone'); // horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var Animation = Backbone.Model.extend({ var Animation = Backbone.Model.extend({
@ -7252,64 +7290,68 @@ var AnimationQueue = Backbone.Model.extend({
exports.Animation = Animation; exports.Animation = Animation;
exports.AnimationQueue = AnimationQueue; exports.AnimationQueue = AnimationQueue;
}); });
require.define("/src/js/util/constants.js",function(require,module,exports,__dirname,__filename,process,global){/** require.define("/src/js/util/errors.js",function(require,module,exports,__dirname,__filename,process,global){var _;
* Constants....!!! var Backbone;
*/ // horrible hack to get localStorage Backbone plugin
var TIME = { if (!require('../util').isBrowser()) {
betweenCommandsDelay: 400 _ = require('underscore');
}; Backbone = require('backbone');
} else {
// useful for locks, etc Backbone = window.Backbone;
var GLOBAL = { _ = window._;
isAnimating: false
};
var GRAPHICS = {
arrowHeadSize: 8,
nodeRadius: 17,
curveControlPointOffset: 50,
defaultEasing: 'easeInOut',
defaultAnimationTime: 400,
//rectFill: '#FF3A3A',
rectFill: 'hsb(0.8816909813322127,0.7,1)',
headRectFill: '#2831FF',
rectStroke: '#FFF',
rectStrokeWidth: '3',
multiBranchY: 20,
upstreamHeadOpacity: 0.5,
upstreamNoneOpacity: 0.2,
edgeUpstreamHeadOpacity: 0.4,
edgeUpstreamNoneOpacity: 0.15,
visBranchStrokeWidth: 2,
visBranchStrokeColorNone: '#333',
defaultNodeFill: 'hsba(0.5,0.8,0.7,1)',
defaultNodeStrokeWidth: 2,
defaultNodeStroke: '#FFF',
orphanNodeFill: 'hsb(0.5,0.8,0.7)'
};
exports.GLOBAL = GLOBAL;
exports.TIME = TIME;
exports.GRAPHICS = GRAPHICS;
});
require.define("/src/js/views/miscViews.js",function(require,module,exports,__dirname,__filename,process,global){if (!require('../util').isBrowser()) {
var _ = require('underscore');
var Backbone = require('backbone');
} }
var InteractiveRebaseView = Backbone.View.extend({ var MyError = Backbone.Model.extend({
defaults: {
type: 'MyError',
msg: 'Unknown Error'
},
toString: function() {
return this.get('type') + ': ' + this.get('msg');
},
getMsg: function() {
return this.get('msg') || 'Unknown Error';
},
toResult: function() {
if (!this.get('msg').length) {
return '';
}
return '<p>' + this.get('msg').replace(/\n/g, '</p><p>') + '</p>';
}
});
var CommandProcessError = exports.CommandProcessError = MyError.extend({
defaults: {
type: 'Command Process Error'
}
});
var CommandResult = exports.CommandResult = MyError.extend({
defaults: {
type: 'Command Result'
}
});
var Warning = exports.Warning = MyError.extend({
defaults: {
type: 'Warning'
}
});
var GitError = exports.GitError = MyError.extend({
defaults: {
type: 'Git Error'
}
});
});
require.define("/src/js/views/miscViews.js",function(require,module,exports,__dirname,__filename,process,global){var InteractiveRebaseView = Backbone.View.extend({
tagName: 'div', tagName: 'div',
template: _.template($('#interactive-rebase-template').html()), template: _.template($('#interactive-rebase-template').html()),
@ -7459,55 +7501,18 @@ exports.InteractiveRebaseView = InteractiveRebaseView;
}); });
require.define("/src/js/util/errors.js",function(require,module,exports,__dirname,__filename,process,global){var MyError = Backbone.Model.extend({ require.define("/src/js/models/commandModel.js",function(require,module,exports,__dirname,__filename,process,global){var _;
defaults: { var Backbone;
type: 'MyError', // horrible hack to get localStorage Backbone plugin
msg: 'Unknown Error' if (!require('../util').isBrowser()) {
}, _ = require('underscore');
toString: function() { Backbone = require('backbone');
return this.get('type') + ': ' + this.get('msg'); } else {
}, Backbone = window.Backbone;
_ = window._;
}
getMsg: function() { var Errors = require('../util/errors');
return this.get('msg') || 'Unknown Error';
},
toResult: function() {
if (!this.get('msg').length) {
return '';
}
return '<p>' + this.get('msg').replace(/\n/g, '</p><p>') + '</p>';
}
});
var CommandProcessError = exports.CommandProcessError = MyError.extend({
defaults: {
type: 'Command Process Error'
}
});
var CommandResult = exports.CommandResult = MyError.extend({
defaults: {
type: 'Command Result'
}
});
var Warning = exports.Warning = MyError.extend({
defaults: {
type: 'Warning'
}
});
var GitError = exports.GitError = MyError.extend({
defaults: {
type: 'Git Error'
}
});
});
require.define("/src/js/models/commandModel.js",function(require,module,exports,__dirname,__filename,process,global){var Errors = require('../util/errors');
var CommandProcessError = Errors.CommandProcessError; var CommandProcessError = Errors.CommandProcessError;
var GitError = Errors.GitError; var GitError = Errors.GitError;
@ -7872,13 +7877,75 @@ var CommandEntry = Backbone.Model.extend({
defaults: { defaults: {
text: '' text: ''
}, },
localStorage: new Backbone.LocalStorage('CommandEntries') // stub out if no plugin available
localStorage: (Backbone.LocalStorage) ? new Backbone.LocalStorage('CommandEntries') : null
}); });
exports.CommandEntry = CommandEntry; exports.CommandEntry = CommandEntry;
exports.Command = Command; exports.Command = Command;
});
require.define("/src/js/app/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
var Backbone = require('backbone');
/**
* Globals
*/
var events = _.clone(Backbone.Events);
var ui = null;
var mainVis = null;
///////////////////////////////////////////////////////////////////////
var init = function(){
var Visuals = require('../visuals');
ui = new UI();
mainVis = new Visuals.Visualization({
el: $('#canvasWrapper')[0]
});
if (/\?demo/.test(window.location.href)) {
setTimeout(function() {
events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
}, 500);
}
};
$(document).ready(init);
function UI() {
var Collections = require('../models/collections');
var CommandViews = require('../views/commandViews');
this.commandCollection = new Collections.CommandCollection();
this.commandBuffer = new Collections.CommandBuffer({
collection: this.commandCollection
});
this.commandPromptView = new CommandViews.CommandPromptView({
el: $('#commandLineBar'),
collection: this.commandCollection
});
this.commandLineHistoryView = new CommandViews.CommandLineHistoryView({
el: $('#commandLineHistory'),
collection: this.commandCollection
});
$('#commandTextField').focus();
}
exports.getEvents = function() {
return events;
};
exports.getUI = function() {
return ui;
};
exports.init = init;
}); });
@ -8278,7 +8345,17 @@ exports.CommandLineHistoryView = CommandLineHistoryView;
}); });
require.define("/src/js/visuals/tree.js",function(require,module,exports,__dirname,__filename,process,global){var Main = require('../app'); require.define("/src/js/visuals/tree.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var GRAPHICS = require('../util/constants').GRAPHICS; var GRAPHICS = require('../util/constants').GRAPHICS;
var randomHueString = function() { var randomHueString = function() {
@ -8992,6 +9069,7 @@ var VisNode = VisBase.extend({
attachClickHandlers: function() { attachClickHandlers: function() {
var commandStr = 'git show ' + this.get('commit').get('id'); var commandStr = 'git show ' + this.get('commit').get('id');
var Main = require('../app');
_.each([this.get('circle'), this.get('text')], function(rObj) { _.each([this.get('circle'), this.get('text')], function(rObj) {
rObj.click(function() { rObj.click(function() {
Main.getEvents().trigger('processCommandFromEvent', commandStr); Main.getEvents().trigger('processCommandFromEvent', commandStr);
@ -9343,7 +9421,18 @@ exports.TreeCompare = TreeCompare;
}); });
require.define("/src/js/git/headless.js",function(require,module,exports,__dirname,__filename,process,global){var GitEngine = require('../git').GitEngine; require.define("/src/js/git/headless.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var GitEngine = require('../git').GitEngine;
var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory; var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory;
var GitVisuals = require('../visuals').GitVisuals; var GitVisuals = require('../visuals').GitVisuals;
@ -9370,7 +9459,8 @@ HeadlessGit.prototype.init = function() {
collection: this.commitCollection, collection: this.commitCollection,
branches: this.branchCollection, branches: this.branchCollection,
gitVisuals: gitVisuals, gitVisuals: gitVisuals,
animationFactory: animationFactory animationFactory: animationFactory,
events: _.clone(Backbone.Events)
}); });
this.gitEngine.init(); this.gitEngine.init();
}; };
@ -9392,7 +9482,7 @@ var mainVis = null;
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
$(document).ready(function(){ var init = function(){
var Visuals = require('../visuals'); var Visuals = require('../visuals');
ui = new UI(); ui = new UI();
@ -9405,7 +9495,9 @@ $(document).ready(function(){
events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix"); events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
}, 500); }, 500);
} }
}); };
$(document).ready(init);
function UI() { function UI() {
var Collections = require('../models/collections'); var Collections = require('../models/collections');
@ -9435,12 +9527,25 @@ exports.getEvents = function() {
exports.getUI = function() { exports.getUI = function() {
return ui; return ui;
}; };
exports.init = init;
}); });
require("/src/js/app/index.js"); require("/src/js/app/index.js");
require.define("/src/js/git/headless.js",function(require,module,exports,__dirname,__filename,process,global){var GitEngine = require('../git').GitEngine; require.define("/src/js/git/headless.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var GitEngine = require('../git').GitEngine;
var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory; var AnimationFactory = require('../visuals/animation/animationFactory').AnimationFactory;
var GitVisuals = require('../visuals').GitVisuals; var GitVisuals = require('../visuals').GitVisuals;
@ -9467,7 +9572,8 @@ HeadlessGit.prototype.init = function() {
collection: this.commitCollection, collection: this.commitCollection,
branches: this.branchCollection, branches: this.branchCollection,
gitVisuals: gitVisuals, gitVisuals: gitVisuals,
animationFactory: animationFactory animationFactory: animationFactory,
events: _.clone(Backbone.Events)
}); });
this.gitEngine.init(); this.gitEngine.init();
}; };
@ -9478,14 +9584,19 @@ exports.HeadlessGit = HeadlessGit;
}); });
require("/src/js/git/headless.js"); require("/src/js/git/headless.js");
require.define("/src/js/git/index.js",function(require,module,exports,__dirname,__filename,process,global){if (!require('../util').isBrowser()) { require.define("/src/js/git/index.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var _ = require('underscore'); var Backbone;
var Backbone = require('backbone'); // horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var AnimationFactoryModule = require('../visuals/animation/animationFactory'); var AnimationFactoryModule = require('../visuals/animation/animationFactory');
var AnimationQueue = require('../visuals/animation').AnimationQueue; var AnimationQueue = require('../visuals/animation').AnimationQueue;
var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView;
var Errors = require('../util/errors'); var Errors = require('../util/errors');
var GitError = Errors.GitError; var GitError = Errors.GitError;
@ -10499,6 +10610,7 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation)
this.animationQueue.start(); this.animationQueue.start();
}, this); }, this);
var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView;
new InteractiveRebaseView({ new InteractiveRebaseView({
callback: callback, callback: callback,
toRebase: toRebase, toRebase: toRebase,
@ -11225,10 +11337,20 @@ exports.TreeCompare = TreeCompare;
}); });
require("/src/js/git/treeCompare.js"); require("/src/js/git/treeCompare.js");
require.define("/src/js/models/collections.js",function(require,module,exports,__dirname,__filename,process,global){var Commit = require('../git').Commit; require.define("/src/js/models/collections.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var Commit = require('../git').Commit;
var Branch = require('../git').Branch; var Branch = require('../git').Branch;
var Main = require('../app');
var Command = require('../models/commandModel').Command; var Command = require('../models/commandModel').Command;
var CommandEntry = require('../models/commandModel').CommandEntry; var CommandEntry = require('../models/commandModel').CommandEntry;
var TIME = require('../util/constants').TIME; var TIME = require('../util/constants').TIME;
@ -11247,9 +11369,15 @@ var BranchCollection = Backbone.Collection.extend({
var CommandEntryCollection = Backbone.Collection.extend({ var CommandEntryCollection = Backbone.Collection.extend({
model: CommandEntry, model: CommandEntry,
localStorage: new Backbone.LocalStorage('CommandEntries') localStorage: (Backbone.LocalStorage) ? new Backbone.LocalStorage('CommandEntries') : null
}); });
if (Backbone.LocalStorage) {
console.log('local storage there');
} else {
console.log('not htere');
}
var CommandBuffer = Backbone.Model.extend({ var CommandBuffer = Backbone.Model.extend({
defaults: { defaults: {
collection: null collection: null
@ -11301,6 +11429,7 @@ var CommandBuffer = Backbone.Model.extend({
} }
if (!popped.get('error')) { if (!popped.get('error')) {
// pass in a callback, so when this command is "done" we will process the next. // pass in a callback, so when this command is "done" we will process the next.
var Main = require('../app');
Main.getEvents().trigger('processCommand', popped, callback); Main.getEvents().trigger('processCommand', popped, callback);
} else { } else {
this.clear(); this.clear();
@ -11332,7 +11461,18 @@ exports.CommandBuffer = CommandBuffer;
}); });
require("/src/js/models/collections.js"); require("/src/js/models/collections.js");
require.define("/src/js/models/commandModel.js",function(require,module,exports,__dirname,__filename,process,global){var Errors = require('../util/errors'); require.define("/src/js/models/commandModel.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var Errors = require('../util/errors');
var CommandProcessError = Errors.CommandProcessError; var CommandProcessError = Errors.CommandProcessError;
var GitError = Errors.GitError; var GitError = Errors.GitError;
@ -11697,14 +11837,13 @@ var CommandEntry = Backbone.Model.extend({
defaults: { defaults: {
text: '' text: ''
}, },
localStorage: new Backbone.LocalStorage('CommandEntries') // stub out if no plugin available
localStorage: (Backbone.LocalStorage) ? new Backbone.LocalStorage('CommandEntries') : null
}); });
exports.CommandEntry = CommandEntry; exports.CommandEntry = CommandEntry;
exports.Command = Command; exports.Command = Command;
}); });
require("/src/js/models/commandModel.js"); require("/src/js/models/commandModel.js");
@ -11782,7 +11921,18 @@ window.events = toGlobalize.Main.getEvents();
}); });
require("/src/js/util/debug.js"); require("/src/js/util/debug.js");
require.define("/src/js/util/errors.js",function(require,module,exports,__dirname,__filename,process,global){var MyError = Backbone.Model.extend({ require.define("/src/js/util/errors.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var MyError = Backbone.Model.extend({
defaults: { defaults: {
type: 'MyError', type: 'MyError',
msg: 'Unknown Error' msg: 'Unknown Error'
@ -11832,7 +11982,8 @@ var GitError = exports.GitError = MyError.extend({
require("/src/js/util/errors.js"); require("/src/js/util/errors.js");
require.define("/src/js/util/index.js",function(require,module,exports,__dirname,__filename,process,global){exports.isBrowser = function() { require.define("/src/js/util/index.js",function(require,module,exports,__dirname,__filename,process,global){exports.isBrowser = function() {
return (typeof window === undefined); var inBrowser = String(typeof window) !== 'undefined';
return inBrowser;
}; };
@ -12250,12 +12401,7 @@ exports.CommandLineHistoryView = CommandLineHistoryView;
}); });
require("/src/js/views/commandViews.js"); require("/src/js/views/commandViews.js");
require.define("/src/js/views/miscViews.js",function(require,module,exports,__dirname,__filename,process,global){if (!require('../util').isBrowser()) { require.define("/src/js/views/miscViews.js",function(require,module,exports,__dirname,__filename,process,global){var InteractiveRebaseView = Backbone.View.extend({
var _ = require('underscore');
var Backbone = require('backbone');
}
var InteractiveRebaseView = Backbone.View.extend({
tagName: 'div', tagName: 'div',
template: _.template($('#interactive-rebase-template').html()), template: _.template($('#interactive-rebase-template').html()),
@ -12406,7 +12552,21 @@ exports.InteractiveRebaseView = InteractiveRebaseView;
}); });
require("/src/js/views/miscViews.js"); require("/src/js/views/miscViews.js");
require.define("/src/js/visuals/animation/animationFactory.js",function(require,module,exports,__dirname,__filename,process,global){/****************** require.define("/src/js/visuals/animation/animationFactory.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var Animation = require('./index').Animation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
/******************
* This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time. * This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time.
* The tricky thing is that when a new commit has to be "born," say in the middle of a rebase * The tricky thing is that when a new commit has to be "born," say in the middle of a rebase
* or something, it must animate out from the parent position to it's birth position. * or something, it must animate out from the parent position to it's birth position.
@ -12416,14 +12576,6 @@ require.define("/src/js/visuals/animation/animationFactory.js",function(require,
* and then essentially animate the entire tree too. * and then essentially animate the entire tree too.
*/ */
var Animation = require('./index').Animation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
if (!require('../../util').isBrowser()) {
var _ = require('underscore');
var Backbone = require('backbone');
}
// essentially a static class // essentially a static class
var AnimationFactory = function() { var AnimationFactory = function() {
@ -12673,9 +12825,15 @@ require("/src/js/visuals/animation/animationFactory.js");
require.define("/src/js/visuals/animation/index.js",function(require,module,exports,__dirname,__filename,process,global){var GLOBAL = require('../../util/constants').GLOBAL; require.define("/src/js/visuals/animation/index.js",function(require,module,exports,__dirname,__filename,process,global){var GLOBAL = require('../../util/constants').GLOBAL;
if (!require('../../util').isBrowser()) { var _;
var _ = require('underscore'); var Backbone;
var Backbone = require('backbone'); // horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var Animation = Backbone.Model.extend({ var Animation = Backbone.Model.extend({
@ -12761,11 +12919,20 @@ var AnimationQueue = Backbone.Model.extend({
exports.Animation = Animation; exports.Animation = Animation;
exports.AnimationQueue = AnimationQueue; exports.AnimationQueue = AnimationQueue;
}); });
require("/src/js/visuals/animation/index.js"); require("/src/js/visuals/animation/index.js");
require.define("/src/js/visuals/index.js",function(require,module,exports,__dirname,__filename,process,global){var Main = require('../app'); require.define("/src/js/visuals/index.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var GRAPHICS = require('../util/constants').GRAPHICS; var GRAPHICS = require('../util/constants').GRAPHICS;
var GLOBAL = require('../util/constants').GLOBAL; var GLOBAL = require('../util/constants').GLOBAL;
@ -12794,6 +12961,7 @@ var Visualization = Backbone.View.extend({
paperInitialize: function(paper, options) { paperInitialize: function(paper, options) {
this.paper = paper; this.paper = paper;
var Main = require('../app');
this.events = Main.getEvents(); this.events = Main.getEvents();
this.commitCollection = new CommitCollection(); this.commitCollection = new CommitCollection();
@ -12860,7 +13028,8 @@ function GitVisuals(options) {
this.branchCollection.on('remove', this.removeBranch, this); this.branchCollection.on('remove', this.removeBranch, this);
this.deferred = []; this.deferred = [];
Main.getEvents().on('refreshTree', _.bind( this.events = require('../app').getEvents();
this.events.on('refreshTree', _.bind(
this.refreshTree, this this.refreshTree, this
)); ));
} }
@ -13305,7 +13474,7 @@ GitVisuals.prototype.calcDepthRecursive = function(commit, depth) {
GitVisuals.prototype.canvasResize = _.debounce(function(width, height) { GitVisuals.prototype.canvasResize = _.debounce(function(width, height) {
// refresh when we are ready // refresh when we are ready
if (GLOBAL.isAnimating) { if (GLOBAL.isAnimating) {
Main.getEvents().trigger('processCommandFromEvent', 'refresh'); this.events.trigger('processCommandFromEvent', 'refresh');
} else { } else {
this.refreshTree(); this.refreshTree();
} }
@ -13451,7 +13620,17 @@ exports.GitVisuals = GitVisuals;
}); });
require("/src/js/visuals/index.js"); require("/src/js/visuals/index.js");
require.define("/src/js/visuals/tree.js",function(require,module,exports,__dirname,__filename,process,global){var Main = require('../app'); require.define("/src/js/visuals/tree.js",function(require,module,exports,__dirname,__filename,process,global){var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var GRAPHICS = require('../util/constants').GRAPHICS; var GRAPHICS = require('../util/constants').GRAPHICS;
var randomHueString = function() { var randomHueString = function() {
@ -14165,6 +14344,7 @@ var VisNode = VisBase.extend({
attachClickHandlers: function() { attachClickHandlers: function() {
var commandStr = 'git show ' + this.get('commit').get('id'); var commandStr = 'git show ' + this.get('commit').get('id');
var Main = require('../app');
_.each([this.get('circle'), this.get('text')], function(rObj) { _.each([this.get('circle'), this.get('text')], function(rObj) {
rObj.click(function() { rObj.click(function() {
Main.getEvents().trigger('processCommandFromEvent', commandStr); Main.getEvents().trigger('processCommandFromEvent', commandStr);

View file

@ -10,7 +10,7 @@ var mainVis = null;
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
$(document).ready(function(){ var init = function(){
var Visuals = require('../visuals'); var Visuals = require('../visuals');
ui = new UI(); ui = new UI();
@ -23,7 +23,9 @@ $(document).ready(function(){
events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix"); events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
}, 500); }, 500);
} }
}); };
$(document).ready(init);
function UI() { function UI() {
var Collections = require('../models/collections'); var Collections = require('../models/collections');
@ -53,4 +55,6 @@ exports.getEvents = function() {
exports.getUI = function() { exports.getUI = function() {
return ui; return ui;
}; };
exports.init = init;

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var GitEngine = require('../git').GitEngine; var GitEngine = require('../git').GitEngine;

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var AnimationFactoryModule = require('../visuals/animation/animationFactory'); var AnimationFactoryModule = require('../visuals/animation/animationFactory');

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var Commit = require('../git').Commit; var Commit = require('../git').Commit;
@ -27,6 +33,12 @@ var CommandEntryCollection = Backbone.Collection.extend({
localStorage: (Backbone.LocalStorage) ? new Backbone.LocalStorage('CommandEntries') : null localStorage: (Backbone.LocalStorage) ? new Backbone.LocalStorage('CommandEntries') : null
}); });
if (Backbone.LocalStorage) {
console.log('local storage there');
} else {
console.log('not htere');
}
var CommandBuffer = Backbone.Model.extend({ var CommandBuffer = Backbone.Model.extend({
defaults: { defaults: {
collection: null collection: null

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var Errors = require('../util/errors'); var Errors = require('../util/errors');

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var MyError = Backbone.Model.extend({ var MyError = Backbone.Model.extend({

View file

@ -1,4 +1,5 @@
exports.isBrowser = function() { exports.isBrowser = function() {
return (typeof window === undefined); var inBrowser = String(typeof window) !== 'undefined';
return inBrowser;
}; };

View file

@ -1,3 +1,17 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
}
var Animation = require('./index').Animation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
/****************** /******************
* This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time. * This class is responsible for a lot of the heavy lifting around creating an animation at a certain state in time.
* The tricky thing is that when a new commit has to be "born," say in the middle of a rebase * The tricky thing is that when a new commit has to be "born," say in the middle of a rebase
@ -8,14 +22,6 @@
* and then essentially animate the entire tree too. * and then essentially animate the entire tree too.
*/ */
var Animation = require('./index').Animation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
if (!require('../../util').isBrowser()) {
var _ = require('underscore');
var Backbone = require('backbone');
}
// essentially a static class // essentially a static class
var AnimationFactory = function() { var AnimationFactory = function() {

View file

@ -1,8 +1,14 @@
var GLOBAL = require('../../util/constants').GLOBAL; var GLOBAL = require('../../util/constants').GLOBAL;
if (!require('../../util').isBrowser()) { var _;
var _ = require('underscore'); var Backbone;
var Backbone = require('backbone'); // horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) {
_ = require('underscore');
Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var Animation = Backbone.Model.extend({ var Animation = Backbone.Model.extend({

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var GRAPHICS = require('../util/constants').GRAPHICS; var GRAPHICS = require('../util/constants').GRAPHICS;

View file

@ -1,6 +1,12 @@
var _;
var Backbone;
// horrible hack to get localStorage Backbone plugin
if (!require('../util').isBrowser()) { if (!require('../util').isBrowser()) {
var _ = require('underscore'); _ = require('underscore');
var Backbone = require('backbone'); Backbone = require('backbone');
} else {
Backbone = window.Backbone;
_ = window._;
} }
var GRAPHICS = require('../util/constants').GRAPHICS; var GRAPHICS = require('../util/constants').GRAPHICS;