“弧形移植”和“弧形修补”有什么区别?

2024-01-20

arc help --full | less揭示了这一点graft:

  graft revision

      Grafts revision and its dependencies (if any) onto your working tree.

      --force
          Do not run any sanity checks.

      --skip-landed
          Do not try to patch landed/closed diffs.

这对于patch:

  patch D12345
  patch --revision revision_id
  patch --diff diff_id
  patch --patch file
  patch --arcbundle bundlefile
      Supports: git, svn, hg
      Apply the changes in a Differential revision, patchfile, or arc
      bundle to the working copy.

      --arcbundle bundlefile
          Apply changes from an arc bundle generated with 'arc export'.

这对我来说很模糊。用“嫁接”这个词来描述“嫁接”的含义对我来说没有多大帮助。


对于那些不知道的人来说,arc(Arcanist) 是“Phabricator”内部的一个命令行工具,它的作用类似于 Git(甚至 Mercurial 和 Subversion)的高级包装器,以帮助大型软件项目的开发过程。以下是一些链接:

https://phacility.com/phabricator/ https://phacility.com/phabricator/

Phabricator 最初是作为 Facebook 的内部工具开发的。[7][8][9] Phabricator 的主要开发人员是 Evan Priestley。[1] Priestley 离开 Facebook,在一家名为 Phacility 的新公司继续 Phabricator 的开发。[2] https://en.wikipedia.org/wiki/Phabricator


2020 年 3 月 19 日更新:

注意arc flow and arc cascade显然不属于Pacility 奥术师的主流版本 https://github.com/phacility/arcanist。相反,它们只是其中的一部分奥术师的 Uber 分叉 https://github.com/uber/arcanist。一些arc flow找到源代码了here https://github.com/uber/arcanist/blob/master/src/flow/ICFlowSummary.php#L87, 例如。此外,arc cascade也只是 Uber 分叉奥术师功能,并且它的一些arc cascade找到源代码了here https://github.com/uber/arcanist/blob/master/src/flow/workflow/ICCascadeWorkflow.php#L75.
了解如何安装 Uber 的 arcanist 分支,以便开始在常规中使用这些功能git工作流程(如果不需要,您不需要使用奥术师的任何其他功能),跳到这个答案的底部.


2019 年 1 月原始答案:

因此,经过一些实验和反复试验后,我想我已经弄清楚了:

Both arc graft and arc patch use git cherry-pick在幕后,并完成类似的事情。然而,它们有一些细微的差别,有时arc patch失败,你必须使用arc graft--skip-landed标记代替(更新:或者也许arc patch--skip-dependencies标志也可以工作吗?)。

例子:

# cherry-pick their "D999" "diff" (branch) onto your current branch, while creating 
# a new single branch for you named "arcpatch-D999", skipping dependencies in case 
# they've already landed on the branch (ex: master) you currently have checked out.
arc patch --skip-dependencies D999 

OR

# cherry-pick their "D999" "diff" (branch), *as well as all parent branch(es) it 
# depends on*, onto your current branch, while creating the entire dependency tree 
# of branches for you, exactly as the submitter originally had on their local 
# machine, skipping any commits that have already landed on your local branch 
# (ex: master) you currently have checked out
arc graft --skip-landed D999 

想象一下你的arc flow依赖树仅包含“master”分支:

master

然而,一位同事有以下情况arc flow依赖树:

master                              
└──new_feature_1
   └──new_feature_2 

简而言之:什么是arc flow依赖树?并且:它是一个树结构,通过arc flow命令,它显示哪些分支依赖于什么。作为人类,手动跟踪是一件有点武断的事情,因为您知道一个功能依赖于另一个功能。要建立“依赖关系”,您有两种选择:

  1. Call arc flow new_branch_name在您当前签出要成为父分支的情况下创建新的子分支,或者:
  2. 使用 git 创建一个新分支,然后将其上游设置为您想要的父分支。前任:

    git branch new_branch_name
    git checkout new_branch_name # Or use `git checkout -b new_branch_name` to do both at once
    git branch --set-upstream-to=upstream_branch_name # or `git branch -u upstream_branch_name` for short
    

Now, arc flow将显示您的依赖树。这可以让你做类似的事情arc cascade从父级到子级,这只是执行从父级到子级的自动递归 git rebase(即:将子级重新设置为父级)。

一边结束。


无论如何,通过上面显示的依赖关系树,您的同事已签出“new_feature_2”,并且他们arc diff供您审查。您转到基于网络的“差异”工具并开始检查更改。但是,您想测试它。这意味着您需要将它们的差异拉到本地计算机上。您有两个选择:1。arc patch将它们的 diff(依赖关系树感知分支)复制到本地 master 上,或者 2。arc graft他们的差异到你当地的主人。

假设它们的差异是“D999”,并且您当前已签出“master”分支,则您的命令和生成的依赖关系树将如下所示:

  1. arc patch D999。现在您拥有了这棵树,其中新创建的“arcpatch-D999”是其“new_feature_2”分支:

    master
    └──arcpatch-D999 
    
  2. arc graft D999。你现在有了这棵树,就像他们一样:

    master                              
    └──new_feature_1
       └──new_feature_2 
    

然而,(我认为,根据我的问题)有时当他们有这样的多代依赖树时,arc patch将失败(给出错误“Cherry Pick Failed!”),在这种情况下您必须使用arc graft反而!然而,如果他们的主人与你的主人不完全相同(这几乎肯定不会,因为他们可能不久前拉了他们的主人,你应该拉你的主人以确保你拥有最新的),那么你的尝试移植或修补将会失败。失败很可能与以下事实有关:分支历史记录中的某些提交包含已经落地并存在于您的 master 中的更改。解决方案是使用arc graft D999 --skip-landed,这将允许你抓住他们的差异并将其拉下来,镜像他们arc flow依赖树。在这种情况下,arc patch D999可能会继续失败,直到他们拉出最新的主控并且arc cascade(或 git rebase 两次),然后重新arc diff将他们的更改推送到服务器,此时您可以arc patch D999成功到你的主人身上。因为你不能总是让他们变基/arc cascade但是,立即执行arc graft D999 --skip-landed现在就完成吧!让他们变基并重新arc diff当他们到达时。

然而,一个小问题是,如果您arc graft说得太多,可能会让人困惑谁创建了哪些分支(你,还是其他人?),所以我建议你养成移植到你自己命名的新分支上的习惯,如下所示,只是为了组织:

git checkout master # same as `arc flow master`
git pull origin master # pull latest master
arc flow graft-D999 # create and checkout a new child branch you are calling "graft-D999" (name it appropriately)
arc graft D999 --skip-landed # graft their entire dependency tree onto your branch "graft-D999"

您的依赖树现在如下所示:

master                              
└──graft-D999
   └──new_feature_1
      └──new_feature_2 

出色的!很好而且有组织。现在您可以查看“new_feature_2”并编译和测试它。但请注意,“master”和“graft-D999”将是完全相同的分支,但这没关系。

如何安装 Uber 的 arcanist 分支

(如果您想开始使用arc flow and arc cascade在你自己的 git 工作流程中):

注意:Arcanist 在 Windows 上运行(在适用于 Windows 的 git https://git-scm.com/download/wingit bash 终端)、Mac 和 Linux。我将仅介绍 Linux 安装说明。要获得在其他系统中安装的帮助,请首先查看下面的参考资料。

Linux Ubuntu 安装:

cd到您希望安装文件所在的位置,然后执行以下操作:

# 1. Obtain the Uber fork of the arcanist program by cloning it into an "uber" directory.
mkdir uber
git clone https://github.com/uber/arcanist.git uber
# 2. Symbolically link the `arc` program to your ~/bin directory so you can call `arc` from anywhere.
# - this assumes that ~/bin is in your PATH.
# Ensure the ~/bin dir exists; if just creating this dir for the first time you may need to log out of Ubuntu
# and log back in AFTER running the `mkdir` command below, in order to force your ~/.profile script to 
# automatically add ~/bin to your PATH (assuming your ~/.profile script does this, as default Ubuntu scripts do).
mkdir -p ~/bin
ln -s $PWD/uber/arcanist/bin/arc ~/bin

现在尝试运行arc。它应该失败并显示以下消息:

$ arc
ERROR: Unable to load libphutil. Put libphutil/ next to arcanist/, or update your PHP 'include_path' to include the parent directory of libphutil/, or symlink libphutil/ into arcanist/externals/includes/.

因此,请执行以下操作:

# 3. Obtain the libphutil program.
# - Note that git cloning it like this `git clone https://github.com/phacility/libphutil.git` will NOT work anymore
# for Uber's fork of arcanist because the libphutil project is now empty. So, do this instead:
sudo apt install libphutil
# 4. symbolically link the libphutil program into arcanist.
# First, we need to know where it is installed.
dpkg -L libphutil
# Now look at the output from the above command. Mine shows libphutil is installed in "/usr/share/libphutil/",
# so do the following:
ln -s /usr/share/libphutil uber/arcanist/externals/includes

现在测试arc命令,您应该看到以下内容:

$ arc
Usage Exception: No command provided. Try `arc help`.

Run arc help查看帮助菜单,或者arc help --full获取完整的帮助菜单。

让我们来看看flow and cascade证明它们仅出现在 Uber 分叉的帮助菜单中(但不适用于主要奥术师):

正在寻找flow在完整的帮助菜单中:

$ arc help --full | grep flow
          This workflow is primarily useful for writing scripts which integrate
              soft version of '' used by other workflows.
      flow [options]
      flow name [options]
      flow name upstream [options]
          step in the standard Differential pre-publish code review workflow.
          The workflow selects a target branch to land onto and a remote where
          Consulting mystical sources of power, the workflow makes a guess
          step in the standard Differential pre-publish code review workflow.
          The workflow selects a target branch to land onto and a remote where
          Consulting mystical sources of power, the workflow makes a guess
          code review workflow.
          The workflow selects a target branch to land onto and a remote where

And cascade在完整的帮助菜单中:

$ arc help --full | grep -A 4 cascade
      cascade [--halt-on-conflict] [rootbranch]

          Automates the process of rebasing and patching local working branches
          and their associated differential diffs. Cascades from current branch
          if branch is not specified.
--
              Rather than aborting any rebase attempts, cascade will drop the
              user
              into the conflicted branch in a rebase state.

参考:

  1. Pacility的奥术师(缺少arc flow and arc cascade特征):https://github.com/phacility/arcanist https://github.com/phacility/arcanist
  2. Uber 的 Arcanist 分叉(有arc flow and arc cascade添加的功能):https://github.com/uber/arcanist https://github.com/uber/arcanist
  3. 奥术师用户指南:https://secure.phabricator.com/book/phabricator/article/arcanist/ https://secure.phabricator.com/book/phabricator/article/arcanist/--> 请参阅“安装 Arcanist”部分,了解如何在 Windows、Mac、Linux 或 FreeBSD 中安装它的说明。
  4. 错误:无法加载 libphutil https://stackoverflow.com/questions/45278745/error-unable-to-load-libphutil/60764589#60764589

Related:

  1. 像时尚树一样的 git 分支的输出 https://stackoverflow.com/questions/2421011/output-of-git-branch-in-tree-like-fashion/54897514#54897514
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

“弧形移植”和“弧形修补”有什么区别? 的相关文章

  • 使用 Jenkins Git 插件中的 SSH 密钥在构建期间运行 Git 命令

    我们在 Jenkins 上的构建作业作为发布构建的一部分运行一些 git 命令 例如 git push 和 git pull 因此需要一种在构建期间从 shell 运行经过身份验证的 git 命令的方法 我们的詹金斯奴隶不持有任何凭证 因为
  • git 交互式变基:停止而不提交

    长话短说 有办法进去吗git rebase i停止编辑 没有提交 ID TLDR 更长的版本 背景 With git rebase i 我得到一个文本编辑器 我可以在其中定义命令列表 从pick COMMIT ID在每一行上 其中一个选项是
  • 没有共同的参考文献,也没有指定;什么也不做

    我有一个本地 git 项目 我想将其添加到 gitolite 中 显然这很难 所以我放弃了这个想法 我创建了一个新的 gitolite 存储库 将其添加到 gitolite admin conf gitolite conf 并提交并推送更改
  • 在 GitHub 上更新拉取请求后如何恢复审核流程?

    我分叉了 GitHub 存储库并创建了拉取请求 审稿人要求我修改 要求更改1 条评论请求由具有写入权限的审阅者进行更改 了解更多 https docs github com en github collaborating with issu
  • Azure DevOps/VSTS 始终在干净的存储库上报告“DETACHED HEAD”

    Friends 我现在厌倦了 Azure DevOps VSTS Jenkins 好多了 现在仍然如此 只是我的组织想要使用 Azure DevOps 我有一个谜团需要帮助来解决 以下是我的笔记本电脑上的存储库 它没有未跟踪或未提交的更改
  • 如何列出当前正在验证的拉取请求中更改的所有文件(在 VSTS 中)?

    我有一个 PR 验证版本 我想列出 PR 中更改的所有文件以及状态 源在每个构建上同步 因此 在合并 PR 更改之前 源位于修订版A 通常origin master 让我将 PR 合并提交指定为B 我当前的实现调用git diff tree
  • 从TFS迁移到GIT,共享项目到nuget

    我所在的软件团队由 4 5 名开发人员组成 他们从事一个 TFS 项目 我们正在考虑将整个代码库移至 GIT 该代码库由约 50 个 Visual Studio 2013 解决方案组成 分为约 300 个项目 引用项目中另一个程序集的首选过
  • 在 git 中编辑分支?

    我在 github 网站上创建了一个分支 该分支不在我的本地存储库中 如何将该分支带到我的本地计算机 对其进行编辑 然后将其推送回我的 github 帐户 在本地工作目录中输入 git fetch origin newbranch git
  • 合并分支时,Git 不显示已删除行的当前/传入更改

    我正在尝试了解有关 git 分支 合并的更多信息 一直以来只使用 master 分支 我分支两次 然后执行合并 为什么 git 只显示新的冲突行 我想知道为什么删除 熊 根本没有突出显示为更改 您已经在评论中介绍了其中的一些内容 但让我们把
  • 在 github 上查找强制推送的提交者

    在我们的项目 托管在 GitHub 上 中 每隔一段时间就会有人意外强制推送 master 没有人知道是否这样做 我想找出是谁干的 以及背后有什么样的错误配置的工具或坏习惯 那么问题来了 如何识别进行强制推送的用户呢 当我拉动时 我看到这样
  • git am:补丁格式检测失败

    我以前从未在 Git 中使用过补丁 我需要一些帮助 我正在尝试将补丁应用到 Git 存储库来测试 Wine 补丁 特别是这个补丁在这里 https bugs winehq org attachment cgi id 60752 所以我做了以
  • 如何将推送的分支复制到另一个目录?

    我有一个分支叫master 生产 另一个称为development 当我从 master 推送提交时 post receive 挂钩执行 git work tree var www mywebsite com git dir var rep
  • 如何在Windows Git shell中运行./script.sh?

    也许这很尴尬 但是当我在 Git shell 中工作时 我无法在 Windows 上运行 sh 文件 也许我必须安装一些东西 但我认为 Git 会支持 bash 命令 我知道 Windows 不使用 sh 文件 我正在执行安装步骤游戏结束
  • 如何在gitlab存储库中下载单个文件夹或文件

    我有一个存储库 在此存储库中 有多个文件夹可用 我只需要此存储库中的一个文件夹 我已经尝试遵循命令 但它不起作用 克隆 有没有办法只克隆 git 存储库子目录 https stackoverflow com questions 600079
  • 运行“git gui”时如何跳过“松散对象”弹出窗口

    当我运行 git gui 时 我会看到一个弹出窗口 上面写着 This repository currently has approximately 1500 loose objects 然后它建议压缩数据库 我之前已经这样做过 它将松散对
  • git-daemon 的日志保存在哪里? (Windows 上的 Git 使用 Cygwin)

    我正在将 git daemon 作为 Windows 服务运行 使用创建进程 服务中使用的命令是 git daemon reuseaddr base path data test work export all verbose enable
  • 使用 Dropbox 作为跨多台机器的 git 工作目录 - 提交不能完美同步

    首先 我想强调这个问题与在 Dropbox 上托管我的中央存储库无关 而且我对使用 git 还很陌生 我能找到的其他涉及 Dropbox 和 git 的问题都没有真正回答我的问题 它们要么是关于使用 Dropbox 托管您的存储库 要么是关
  • git stash 和编辑帅哥

    我完全喜欢git add p and git stash但我偶尔会遇到以下问题 该问题是通过以下命令序列重现的 git add p my file 然后我手动编辑大块 using e 因为 git 建议的分割不适合我 git stash k
  • Git:检查文件是否存在于某个版本

    在我的应用程序中 我使用 git 对一些外部文件进行版本管理 我正在使用类似的命令git show HEAD 1 some file获取文件的某个版本 基于 git 标签 提交哈希或与 HEAD 的关系 当文件不存在时 会输出 致命 消息
  • Git - 包含来自其他存储库的文件

    对于 Git 我想包含一些常见的 JS CSS 库和 或实用方法 即来自另一个存储库的特定文件 在我的项目中 我希望它们始终是最新的 我真的不想要整个远程存储库 如果我可以处理远程文件的 本地副本 并将更改推送回来 那就太好了 一个有点类似

随机推荐