在Mercurial中,汞嫁接和汞变基有何区别 [英] In Mercurial what's the difference between hg graft and hg rebase

查看:73
本文介绍了在Mercurial中,汞嫁接和汞变基有何区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 Rebase 是一个(捆绑的)扩展名,而

I know Rebase is a (bundled) extension, while Graft is a core feature (that replaced the Transplant (bundled) extension).

graft 记录为:

graft is documented as:

将其他分支的更改复制到当前分支

copy changes from other branches onto the current branch

此命令使用Mercurial的合并逻辑来复制其他分支中的单个更改,而无需合并历史图中的分支.有时称为反向移植"或采摘樱桃".

This command uses Mercurial's merge logic to copy individual changes from other branches without merging branches in the history graph. This is sometimes known as 'backporting' or 'cherry-picking'.

rebase 记录为:

rebase is documented as:

Rebase允许在Mercurial的历史中移动提交(使用一系列内部合并).这有很多用途:

Rebase allows moving commits around in Mercurial's history (using a series of internal merges). This has many uses:

  • 在分支之间移动变更集
  • 线性化"历史记录
  • 重新排列变更集
  • 将多个更改合为一个更改集
  • moving changesets between branches
  • "linearizing" history
  • reordering changesets
  • collapsing multiple changes into one changeset

两者似乎都使用合并在分支之间移动或复制变更集.

Both seem to use merging to move or copy changesets between branches.

嫁接副本.调整动作.但是rebase --keep复制.

Graft copies. Rebase moves. But rebase --keep copies.

通常,我似乎可以实现以任何一种方式复制变更集的目标. 我使用哪一个无关紧要?我什么时候比另一个更喜欢?

So often it seems I can accomplish my goal of copying a changeset either way. Does it matter which one I use? When should I prefer one over the other?

例如仅在复制到另一个名为 的分支时才应使用嫁接吗?或仅在只有一个变更集的情况下?

E.g. should graft only be used when copying to a different named branch? Or only when there's just a single changeset?

Edit:可能是rebase是嫁接的潜在不安全超集,但只能在开发过程中与draft变更集一起使用以编辑本地历史记录,而嫁接是可以与维护期间用于后向移植的变更集?

Could it be that rebase is a potentially unsafe superset of graft, but can only be used with draft changesets during development for editing local history, while graft is a safe subset of rebase that can be used with public changesets during maintenance for backporting?

推荐答案

hg graft允许樱桃采摘".例如,您可以运行hg graft -D "2085::2093 and not 2091"从其他版本仅复制一些更改.相比之下,hg rebase(带有或不带有--keep)将获取您指定的任何更改集以及其后代更改的所有 .

hg graft allows "cherry-picking," as you noted in your question. For example, you can run hg graft -D "2085::2093 and not 2091" to copy only some changes from another revision. By comparison, hg rebase (with or without --keep) will grab whatever changeset you specify and all of its decendant changes.

此外,rebase还允许您折叠变更集(使用--collapse).据我所知,graft没有.

Also, rebase allows you to collapse changesets (with --collapse). As far as I can tell, graft does not.

我注意到的另一个区别是:hg graft --edit 123使您可以将123版移植到工作目录并编辑提交消息.我找不到hg rebase等效项.不过,我应该指出,hg histedit还允许在重新设置基准时编辑提交消息.

One more difference I have noticed: hg graft --edit 123 lets you graft revision 123 to the working directory and edit the commit message. I can't find an hg rebase equivalent. I should point out, though, that hg histedit also allows for editing the commit message while rebasing.

我可能没有想到其他差异. SO社区:请随时在评论中指出这些问题,我会很乐意修改此答案以使其更加完整.

There are probably other differences that I am not thinking of. SO community: feel free to point those out in the comments, and I will happily revise this answer to make it more complete.

请参见 graft文档

See the graft documentation and the Rebase Extension documentation for more details.

这篇关于在Mercurial中,汞嫁接和汞变基有何区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆