mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
BOOM two new awesome levels before rebase 9000
This commit is contained in:
parent
542d68a975
commit
d4d7fb21c7
11 changed files with 612 additions and 29 deletions
|
@ -413,7 +413,8 @@ commandConfig = {
|
|||
rebase: {
|
||||
sc: /^gr($|\s)/,
|
||||
options: [
|
||||
'-i'
|
||||
'-i',
|
||||
'--aboveAll'
|
||||
],
|
||||
regex: /^git +rebase($|\s)/,
|
||||
execute: function(engine, command) {
|
||||
|
@ -423,7 +424,12 @@ commandConfig = {
|
|||
if (commandOptions['-i']) {
|
||||
var args = commandOptions['-i'];
|
||||
command.twoArgsImpliedHead(args, ' -i');
|
||||
engine.rebaseInteractive(args[0], args[1]);
|
||||
engine.rebaseInteractive(
|
||||
args[0],
|
||||
args[1], {
|
||||
aboveAll: !!commandOptions['--aboveAll']
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1397,7 +1397,8 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation, options) {
|
|||
return this.rebaseFinish(toRebaseRough, stopSet, targetSource, currentLocation, options);
|
||||
};
|
||||
|
||||
GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation) {
|
||||
GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation, options) {
|
||||
options = options || {};
|
||||
// there are a reduced set of checks now, so we can't exactly use parts of the rebase function
|
||||
// but it will look similar.
|
||||
|
||||
|
@ -1469,7 +1470,8 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation)
|
|||
// interactive rebase view will reject or resolve our promise
|
||||
new InteractiveRebaseView({
|
||||
deferred: deferred,
|
||||
toRebase: toRebase
|
||||
toRebase: toRebase,
|
||||
aboveAll: options.aboveAll
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ var InteractiveRebaseView = ContainedBase.extend({
|
|||
this.deferred = options.deferred;
|
||||
this.rebaseMap = {};
|
||||
this.entryObjMap = {};
|
||||
this.options = options;
|
||||
|
||||
this.rebaseEntries = new RebaseEntryCollection();
|
||||
options.toRebase.reverse();
|
||||
|
@ -38,10 +39,23 @@ var InteractiveRebaseView = ContainedBase.extend({
|
|||
|
||||
// show the dialog holder
|
||||
this.show();
|
||||
|
||||
if (options.aboveAll) {
|
||||
// TODO fix this :(
|
||||
$('#canvasHolder').css('display', 'none');
|
||||
}
|
||||
},
|
||||
|
||||
restoreVis: function() {
|
||||
// restore the absolute position canvases
|
||||
$('#canvasHolder').css('display', 'inherit');
|
||||
},
|
||||
|
||||
confirm: function() {
|
||||
this.die();
|
||||
if (this.options.aboveAll) {
|
||||
this.restoreVis();
|
||||
}
|
||||
|
||||
// get our ordering
|
||||
var uiOrder = [];
|
||||
|
@ -92,6 +106,15 @@ var InteractiveRebaseView = ContainedBase.extend({
|
|||
this.makeButtons();
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
// empty array does nothing, just like in git
|
||||
this.hide();
|
||||
if (this.options.aboveAll) {
|
||||
this.restoreVis();
|
||||
}
|
||||
this.deferred.resolve([]);
|
||||
},
|
||||
|
||||
makeButtons: function() {
|
||||
// control for button
|
||||
var deferred = Q.defer();
|
||||
|
@ -100,9 +123,7 @@ var InteractiveRebaseView = ContainedBase.extend({
|
|||
this.confirm();
|
||||
}, this))
|
||||
.fail(_.bind(function() {
|
||||
// empty array does nothing, just like in git
|
||||
this.hide();
|
||||
this.deferred.resolve([]);
|
||||
this.cancel();
|
||||
}, this))
|
||||
.done();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue