mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-10 14:44:28 +02:00
ordering on rebase -i
This commit is contained in:
parent
25d2115ecd
commit
5c73cfb5c1
4 changed files with 20 additions and 2 deletions
12
src/git.js
12
src/git.js
|
@ -488,6 +488,10 @@ GitEngine.prototype.commit = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.resolveID = function(idOrTarget) {
|
||||
if (idOrTarget === null || idOrTarget === undefined) {
|
||||
throw new Error('Dont call this with null / undefined');
|
||||
}
|
||||
|
||||
if (typeof idOrTarget !== 'string') {
|
||||
return idOrTarget;
|
||||
}
|
||||
|
@ -538,6 +542,7 @@ GitEngine.prototype.resolveStringRef = function(ref) {
|
|||
|
||||
GitEngine.prototype.getCommitFromRef = function(ref) {
|
||||
var start = this.resolveID(ref);
|
||||
|
||||
// works for both HEAD and just a single layer. aka branch
|
||||
while (start.get('type') !== 'commit') {
|
||||
start = start.get('target');
|
||||
|
@ -644,7 +649,12 @@ GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
|||
|
||||
while (pQueue.length && numBack !== 0) {
|
||||
var popped = pQueue.shift(0);
|
||||
pQueue = pQueue.concat(popped.get('parents'));
|
||||
var parents = popped.get('parents');
|
||||
|
||||
if (parents && parents.length) {
|
||||
pQueue = pQueue.concat(parents);
|
||||
}
|
||||
|
||||
pQueue.sort(this.idSortFunc);
|
||||
numBack--;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ var InteractiveRebaseView = Backbone.View.extend({
|
|||
this.rebaseMap = {};
|
||||
this.entryObjMap = {};
|
||||
|
||||
this.rebaseArray.reverse();
|
||||
// make basic models for each commit
|
||||
_.each(this.rebaseArray, function(commit) {
|
||||
var id = commit.get('id');
|
||||
|
@ -51,7 +52,7 @@ var InteractiveRebaseView = Backbone.View.extend({
|
|||
_.each(uiOrder, function(id) {
|
||||
// the model
|
||||
if (this.entryObjMap[id].get('pick')) {
|
||||
toRebase.push(this.rebaseMap[id]);
|
||||
toRebase.lshift(this.rebaseMap[id]);
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
|
|
@ -328,6 +328,11 @@ p.commandLine span.prompt {
|
|||
li.rebaseEntry {
|
||||
margin: 10px;
|
||||
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
li.rebaseEntry a#toggleButton {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
li.rebaseEntry.notPicked {
|
||||
|
@ -478,3 +483,4 @@ li.rebaseEntry.notPicked {
|
|||
border-top-color: #9bcbeb;
|
||||
background: #9bcbeb;
|
||||
}
|
||||
|
||||
|
|
|
@ -468,6 +468,7 @@ GitVisuals.prototype.addEdge = function(idTail, idHead) {
|
|||
GitVisuals.prototype.collectionChanged = function() {
|
||||
console.log('git visuals... collection was changed');
|
||||
// redo stuff
|
||||
// TODO
|
||||
};
|
||||
|
||||
GitVisuals.prototype.zIndexReflow = function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue