在Mercurial中合并方向重要吗? [英] Does merge direction matter in Mercurial?

查看:71
本文介绍了在Mercurial中合并方向重要吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

举个简单的例子:我正在处理默认分支,在本地提交了一些变更集,然后从主存储库中提取了一些变更集.我已经在隔离的本地存储库中工作了几天,因此,在将结果推回主数据库之前,需要进行很多更改以进行合并.

Take a simple example: I'm working on the default branch, have some changesets committed locally, and I pulled a few more from the master repository. I've been working for a few days in my isolated local repository, so there's quite a few changes to merge before I can push my results back into master.

default ---o-o-o-o-o-o-o-o-o-o-o  (pulled stuff)
            \
             o----o------------o  (my stuff)

我现在可以做两件事.

选项1:

hg pull
hg merge

结果1:

default ---o-o-o-o-o-o-o-o-o-o-o
            \                   \
             o----o------------o-O

选项2:

hg pull
hg update
hg merge

结果2:

default ---o-o-o-o-o-o-o-o-o-o-o-O
            \                   /
             o----o------------o

这两个结果对我来说是同构的,但是实际上,选项#2导致变更集的方式更小(因为它仅将我的少量更改应用于主线,而不是将所有主线更改应用于我的线).

These two results look isomorphic to me, but in practice it seems that option #2 results in way smaller changesets (because it only applies my few changes to the mainline instead of applying all the mainline changes to my few).

我的问题是:这有关系吗?我应该关心合并的方向吗?如果这样做,是否可以节省空间? (合并后执行hg log --patch --rev tip则建议这样做.)

My question is: does this matter? Should I care about the direction of my merges? Am I saving space if I do this? (Doing hg log --patch --rev tip after the merge suggests so.)

推荐答案

(有效)相同.您会看到hg log --patch --rev X输出大小的差异,因为log会显示结果的差异以及(任意)其左"父项(正式为p1),但这并不是它的存储方式(Mercurial具有二进制diff存储格式,它不是"t基于补丁/差异),现在是它的计算方式(都使用了p1,p2和mostest-common-祖先).

They're (effectively) identical. You see a difference in the hg log --patch --rev X output size because log shows the diff of the result and (arbitrarily) its 'left' parent (officially p1), but that's not how it's stored (Mercurial has a binary diff storage format that isn't patch/diff based) and it's now how it's computed (p1, p2, and most-recent-common-ancestor are all used).

唯一的区别是,如果使用命名分支,则分支名称将是左父级的分支名称.

The only real difference is, if you're using named branches, the branch name will be that of the left parent.

这篇关于在Mercurial中合并方向重要吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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