mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 07:28:35 +02:00
Added extra flag to interactive rebase which accepts a list of commits (ordering counts). This list will then be shown to the user when the rebase dialog shows up when showing a solution that does an interactive rebase. This is so the user doesn't have to guess about what commits were picked and how they were ordered for the solution
This commit is contained in:
parent
2423646199
commit
00cc6349d0
3 changed files with 71 additions and 7 deletions
|
@ -2178,12 +2178,43 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation,
|
|||
this.animationQueue.start();
|
||||
}, this))
|
||||
.done();
|
||||
|
||||
// If we have a solution provided, set up the GUI to display it by default
|
||||
var initialCommitOrdering;
|
||||
if (options.initialCommitOrdering && options.initialCommitOrdering.length > 0) {
|
||||
var rebaseMap = {};
|
||||
_.each(toRebase, function(commit) {
|
||||
var id = commit.get('id');
|
||||
rebaseMap[id] = commit;
|
||||
});
|
||||
|
||||
// Verify each chosen commit exists in the list of commits given to the user
|
||||
var extraCommits = [];
|
||||
initialCommitOrdering = [];
|
||||
_.each(options.initialCommitOrdering[0].split(','), function(id) {
|
||||
if (id in rebaseMap) {
|
||||
initialCommitOrdering.push(rebaseMap[id]);
|
||||
} else {
|
||||
extraCommits.push(id);
|
||||
}
|
||||
});
|
||||
|
||||
if (extraCommits.length > 0) {
|
||||
throw new GitError({
|
||||
msg: intl.todo('Hey those commits dont exist in the set!')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// The rebase view expects the commits reversed, so do that here
|
||||
toRebase.reverse();
|
||||
|
||||
var InteractiveRebaseView = require('../views/rebaseView').InteractiveRebaseView;
|
||||
// interactive rebase view will reject or resolve our promise
|
||||
new InteractiveRebaseView({
|
||||
deferred: deferred,
|
||||
toRebase: toRebase,
|
||||
initialCommitOrdering: initialCommitOrdering,
|
||||
aboveAll: options.aboveAll
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue