rebase onto implemented

This commit is contained in:
Qusijue 2021-08-13 19:11:00 +05:00
parent 592399b1db
commit 521cc0e809
3 changed files with 41 additions and 8 deletions

View file

@ -2165,6 +2165,21 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation, options) {
return this.rebaseFinish(toRebaseRough, stopSet, targetSource, currentLocation, options);
};
GitEngine.prototype.rebaseOnto = function(targetSource, oldSource, unit, options) {
if (this.isUpstreamOf(unit, targetSource)) {
this.setTargetLocation(unit, this.getCommitFromRef(targetSource));
this.command.setResult(intl.str('git-result-fastforward'));
this.checkout(unit);
return;
}
var stopSet = Graph.getUpstreamSet(this, targetSource);
var oldBranchSet = Graph.getUpstreamSet(this, oldSource);
var toRebaseRough = this.getUpstreamDiffFromSet(oldBranchSet, unit);
return this.rebaseFinish(toRebaseRough, stopSet, targetSource, unit, options);
};
GitEngine.prototype.getUpstreamDiffSetFromSet = function(stopSet, location) {
var set = {};
this.getUpstreamDiffFromSet(stopSet, location).forEach(function (commit) {