addons/isl/src/operations/RebaseKeepOperation.tsblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import type {ExactRevset, OptimisticRevset, SucceedableRevset} from '../types';
b69ab319
b69ab3110import {Operation} from './Operation';
b69ab3111
b69ab3112/** Like rebase, but leave the source in place, and don't rebase children.
b69ab3113 * Behaves more like "Graft" than rebase, but without going to the result. Useful for copying public commits.
b69ab3114 * Note: does not use the latest successor by default, rather the exact source revset. */
b69ab3115export class RebaseKeepOperation extends Operation {
b69ab3116 constructor(
b69ab3117 protected source: SucceedableRevset | ExactRevset | OptimisticRevset,
b69ab3118 protected destination: SucceedableRevset | ExactRevset | OptimisticRevset,
b69ab3119 ) {
b69ab3120 super('RebaseKeepOperation');
b69ab3121 }
b69ab3122
b69ab3123 static opName = 'Rebase (keep)';
b69ab3124
b69ab3125 getArgs() {
b69ab3126 return ['rebase', '--keep', '--rev', this.source, '--dest', this.destination];
b69ab3127 }
b69ab3128
b69ab3129 // TODO: Support optimistic state. Presently not an issue because its use case in "Download Commits"
b69ab3130 // doesn't support optimistic state anyway.
b69ab3131}