addons/isl/src/operations/PushOperation.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
b69ab3112export class PushOperation extends Operation {
b69ab3113 static opName = 'Push';
b69ab3114
b69ab3115 constructor(
b69ab3116 private topOfStackRev: SucceedableRevset | ExactRevset | OptimisticRevset,
b69ab3117 private toBranchName: string,
b69ab3118 private destination?: string,
b69ab3119 ) {
b69ab3120 super('PushOperation');
b69ab3121 }
b69ab3122
b69ab3123 getArgs() {
b69ab3124 const args = ['push', '--rev', this.topOfStackRev, '--to', this.toBranchName];
b69ab3125 if (this.destination) {
b69ab3126 args.push(this.destination);
b69ab3127 }
b69ab3128 return args;
b69ab3129 }
b69ab3130}