Skip to content

Update "start" command to support base on remote

What does this MR do and why?

Related issue: https://jihulab.com/gitlab-cn/gitlab/-/issues/3155

What

为极狐 GitLab 适配 mono start 命令。

在此 MR 之前,mono start 的大多数功能已经可以在极狐 GitLab 上正常使用,此 MR 只针对其中的一个小场景做优化:

Before After
mono start 总是基于主分支创建新的分支 mono start 检查要创建的分支是否已经在服务端存在,如果存在,就使用服务端的分支

Why

为什么要改造 start 命令?

原生的 Gerrit start 命令逻辑太简单,不适合极狐 GitLab。在新建分支时,Gerrit start 直接基于主分支来创建,这是因为在 Gerrit 的服务端不保存其他分支。

而在极狐 GitLab,我们应该在创建分支时,检查服务端是否有同名分支,如果有,就使用同名分支,以获取该分支最新的代码,而不是基于主分支创建一个新的。

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

一般场景

  1. 安装步骤 完成 Mono client 的安装

  2. 手动将 mono 分支切换为当前 MR 的 start-cmd-support-base-on-remote-branch

    $ cd .repo/repo/ && git checkout start-cmd-support-base-on-remote-branch && cd -
  3. 使用 mono start 创建新的分支

    $ mono start feature1 --all
  4. 进入具体的项目执行 git statusgit branch,期望看到分支创建成功

特殊场景

iShot_2023-07-07_02.18.16

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

路志远 编辑于

合并请求报告