Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
565 views
in Technique[技术] by (71.8m points)

version control - Why 'hg mv' (mercurial) doesn't move a file's history by default?

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.

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.

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.

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can can change the default behaviour of log: in your ~/.hgrc (or somewhere/Mercurial.ini), add

[alias] 
log = log -f 

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...