Understanding hg log history after renames

Harvey Chapman hchapman-hg at 3gfp.com
Tue Apr 6 22:14:35 CDT 2010


I have two files, A & B. I delete A and then rename B to A with commits after each step. I kind of understand why "hg log A" shows the revision history of the original A even though it's not the same file. But if it's going to do that, why not show the history of B, too (without needing -f), since that actually is the same file?

harveybook:hg_mv_test hchapman$ ./mv_test.sh 
Mercurial Distributed SCM (version 1.5+20100307)

Copyright (C) 2005-2010 Matt Mackall <mpm at selenic.com> and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ test5
+ create_and_use_new_repo test5
+ echo '****************************************'
****************************************
+ echo ' New repo: test5 '
 New repo: test5 
+ hg init test5
+ cd test5
+ create_a_and_b
+ echo a
+ hg add a
+ hg com -m 'a -- added'
+ echo b
+ hg add b
+ hg com -m 'b -- added'
+ update_a_and_b
+ echo a
+ hg com -m 'a -- updated'
+ echo b
+ hg com -m 'b -- updated'
+ remove_and_move_files a b
+ hg rm a
+ hg com -m 'rm a'
+ hg mv b a
+ hg com -m 'b->a'
+ show_log b a
+ echo ======================================
======================================
+ echo 'Log for a: (should be for b)'
Log for a: (should be for b)
+ hg log -f a
changeset:   5:bf7b6a7e0311
tag:         tip
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:24 2010 -0400
summary:     b->a

changeset:   3:8e1b87abc4e9
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:23 2010 -0400
summary:     b -- updated

changeset:   2:8889b11a7f4a
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:23 2010 -0400
summary:     a -- updated

changeset:   1:7e2c5325d351
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:23 2010 -0400
summary:     b -- added

changeset:   0:5dc37469aca6
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:22 2010 -0400
summary:     a -- added

+ hg log a
changeset:   5:bf7b6a7e0311
tag:         tip
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:24 2010 -0400
summary:     b->a

changeset:   2:8889b11a7f4a
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:23 2010 -0400
summary:     a -- updated

changeset:   0:5dc37469aca6
user:        Harvey Chapman <hchapman>
date:        Tue Apr 06 23:13:22 2010 -0400
summary:     a -- added

+ cd ..
harveybook:hg_mv_test hchapman$ 



More information about the Mercurial mailing list