如何保持水银图“平坦"? [英] How to keep mercurial graph "flat"

查看:94
本文介绍了如何保持水银图“平坦"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主"存储库,我将其克隆并在克隆中进行一些更改.同时,"main"中还有其他更改,因此我将其拉出并合并到克隆中.我在克隆中进行了更多更改,并合并了"main"中的所有其他新更改.这给了我这张图:

I have a "main" repository, I clone it and make some changes in the clone. In the meantime, there are other changes in "main", so I pull them and merge them in my clone. I make more changes in the clone, and merge any other new changes from "main". This gives me this graph:

当我完成克隆中的工作时,我将推送到主存储库,现在"main"中的图形如下所示:

When I finish my work in the clone, I push to the main repository and now the graph in "main" looks like this:

我知道它们在拓扑上是相同的,但是对我来说第一个更清晰(这是一个非常简单的情况,但是事情可能会变得更加复杂).

I know they're topologically the same, but to me the first one is clearer (this one is a very simple case, but things could get more complicated).

有什么办法可以防止这种情况发生?我发现了此问题有关事后对图形进行重新排序的问题,但我当时想我的工作流程中可能有问题或我可以更改一些以防止发生这种情况.

Is there any way to prevent this? I've found this question about reordering the graph after the fact, but I was thinking maybe there's a problem in my workflow or something I could change to prevent it.

推荐答案

问题是图形是按修订号而不是修订日期排序的.这实际上是按照修订在当前存储库中出现的日期/时间进行排序的. thg项目中存在一个悬而未决的问题,即允许按修订日期对列表进行排序,但一位开发人员表示,此更改将需要隐藏图形,因为他认为重写该绘图仪太复杂了,收益太少(问题是此处).

The problem is that the graph is sorted by the revision number, not by the revision date. This is effectively sorting by the date/time that the revisions appeared in the current repository. There is an outstanding issue on the thg project to allow sorting of the list by revision date but one of the developers said that this change would need to involve hiding the graph as he thinks that the re-write of the grapher would be too complicated for too little gain (the issue is here).

我不知道要解决的涉及合并的工作流程,因为如果对多个存储库执行工作,则修订将永远不会在不同存储库上以相同的顺序进行.

There is no workflow involving merge that I know of to fix it because the revisions will never be in the same order on different repositories if work is carried out on more than one repo.

修饰树的一种方法是在拉出更改后使用rebase而不是merge.这将导致没有分支的单个分支,因为它会重写历史记录,以使其看起来就像您在刚刚执行的更改之后实现了draft修订版一样.如果您想在rebase上阅读,则该信息为此处.

One way to neaten up the tree would be to use rebase instead of merge after pulling your changes. This would result in a single branch with no merges as it re-writes history to make it appear as though your draft revisions were implemented after the changes that you just pulled. If you want to read up on rebase, that info is here.

这篇关于如何保持水银图“平坦"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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