Force warnings about crossing branches when running Update using TortoiseHg

非 Y 不嫁゛ 提交于 2020-01-06 03:08:26

问题


When getting the latest code from a Mercurial repo on the command line, if there are changesets that need to be merged Mercurial raises a warning:

hg up
abort: crosses branches (merge branches or use --check to force update)

This is what I expect, and from the Mercurial book it says "Mercurial is telling us that the hg update command won't do a merge; it won't update the working directory when it thinks we might want to do a merge, unless we force it to do so." At this point I know I need to merge.

How can I get the same behaviour using TortoiseHg? When I hit "Update", it happily updates me to the most recent changeset. Is there a way to warn me that a merge is probably needed? The "Always merge (when possible)" option seems to only apply when you have uncommitted changes.


回答1:


The reason you get an error from hg update on the command-line is that it doesn't know which revision to pick. There are 2 divergent default heads.

If you were to execute hg update -r <specific rev>, the command completes without error.

When using TortoiseHg, you update by:

  1. right-clicking a specific changeset
  2. selecting Update...

This translates to hg update -r <rev>, so there is no error.

Using TortoiseHg, you always have the revision graph in front of you. The graph shows when newly pulled changesets create a new head.




回答2:


The Mercurial abort you are seeing is occurring because you have outstanding (ie: non-committed) changes in your working directory, are trying to perform an update, and Mercurial has decided that you should probably perform a merge instead.

TortoiseHg should also warn you about this, but it will do so in a different way. It will spawn a dialogue that asks if you want to Discard, Merge, or Shelve your outstanding changes. This is what it looks like in TortoiseHg v2.X.X, but it should be similar in v1.1.X:

If you're not seeing this in TortoiseHg, you may not have any outstanding changes. Try it again - are you seeing these options?



来源:https://stackoverflow.com/questions/5982368/force-warnings-about-crossing-branches-when-running-update-using-tortoisehg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!