addons/isl/src/operations/GraftOperation.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 {t} from '../i18n';
b69ab3111import {Operation} from './Operation';
b69ab3112
b69ab3113/** Graft (copy) a commit onto the current commit. Like Rebasing, without affecting the original commit.
b69ab3114 * Useful for public commits. */
b69ab3115export class GraftOperation extends Operation {
b69ab3116 constructor(private source: SucceedableRevset | ExactRevset | OptimisticRevset) {
b69ab3117 super('GraftOperation');
b69ab3118 }
b69ab3119
b69ab3120 static opName = 'Graft';
b69ab3121
b69ab3122 getArgs() {
b69ab3123 return ['graft', this.source];
b69ab3124 }
b69ab3125
b69ab3126 private hash() {
b69ab3127 return this.source.type === 'optimistic-revset' ? this.source.fake : this.source.revset;
b69ab3128 }
b69ab3129
b69ab3130 getInitialInlineProgress(): Array<[string, string]> {
b69ab3131 // TODO: successions
b69ab3132 return [[this.hash(), t('grafting...')]];
b69ab3133 }
b69ab3134
b69ab3135 // TODO: Optimistic State
b69ab3136}