为什么默认情况下“hg mv"(mercurial)不移动文件的历史记录? [英] Why 'hg mv' (mercurial) doesn't move a file's history by default?
问题描述
我知道怎么做它,我只是不明白为什么 hg mv
默认情况下也不移动文件的历史记录.
I know how to do it, I just can't understand why hg mv
doesn't move the file's history as well by default.
让我在 hg mv
之前运行 hg log --follow
真的很愚蠢.这让我想起了使用 cvs 时,您需要使用两种不同的操作删除和添加文件并以相同的方式丢失历史记录.
It really seems silly to be obligated me to run hg log --follow
before hg mv
. This remembers me the times with cvs when you needed to remove and add a file using two different operations and losing history in the same way.
恕我直言,如果我只是使用内置的 mv 可以丢失历史记录,但我正在使用 hg mv
,并且,考虑存储库本身,没有意义丢失历史默认
.应该有 hg mv --no-follow
而不是相反.
IMHO, if I were just using builtin mv that would be ok to lose history, but I'm using hg mv
, and, thinking about the repository itself, it doesn't make sense to lose the history by default
. There should be hg mv --no-follow
and not the other way round.
这不直观.这里有人对这种行为有合理的解释吗?这是设计错误,还是真的有充分的理由?使用 hg mv
时是否可以默认执行此 --follow
?
This isn't intuitive. Anyone here has a sane explanation about this behavior? Is this an error by design, or there's really a good reason for it? Is it possible to do this --follow
by default someway when using hg mv
?
推荐答案
您可以更改日志的默认行为:在您的 ~/.hgrc(或某处/Mercurial.ini)中,添加
You can can change the default behaviour of log: in your ~/.hgrc (or somewhere/Mercurial.ini), add
[alias]
log = log -f
我已经阅读了日志的外观是出于速度原因.在 Mercurial 中,Move 并不是真正的第一级"操作.这是一个复制 + 删除(这与 Bazaar 相比,在 Bazaar 中移动/重命名是第一级"操作,但没有保存历史记录的副本).
I've read the appearance of the log is for speed reason. Move isn't truly a "first level" operation in Mercurial. It's a copy + delete (this compared to Bazaar where the move/rename is a "first level" operation but that doesn't have a copy with history preservation).
这篇关于为什么默认情况下“hg mv"(mercurial)不移动文件的历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!