本文介绍了为什么默认情况下,"hg mv"(Mercurial)不移动文件的历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道怎么做,我只是不明白为什么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,考虑到存储库本身,失去历史记录就没有意义了by default .应该是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)不移动文件的历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 11:22