hg reporting files as modified when they are not

Remy Blank remy.blank at pobox.com
Thu Sep 18 07:00:03 UTC 2008


Peter Hosey wrote:
> The modification that hg st is reporting is that the commit will  
> create a new head. If you do commit r2, it'll say “created new  
> head”, and the log will look like this:

I understand the concept of parents and branches, but my point is that 
the output of "hg st" is inconsistent (I may not have explained this 
clearly in my first post, sorry).

Here's the script again:

hg init test
cd test
echo "start" >file
hg add file
hg ci -m "Contains start"
echo "longer content" >file
hg ci -m "Contains longer content"
hg debugstate
sleep 2
hg up
hg debugstate
echo "start" >file      <-- Note this line
hg debugstate
hg up -r 0
hg debugstate
hg st
hg di

(The script in my initial post had a second update to revision 0 which 
was actually unnecessary; this is the short version.)

Note the line where I revert the content of file to the content it had 
in revision 0 "manually" *before* updating to revision 0. When this line 
is present, "hg st" reports that file has been modified, but "hg di" 
doesn't show anything. When I comment out this line, "hg st" reports no 
changes, as does "hg di".

My guess is that in the former case, the dirstate is not updated 
correctly. Indeed, the reason why "hg st" reports file as modified is 
because its size doesn't match the size stored in the dirstate:

n 664         15 2008-09-18 00:35:58 file
               ^
Note that "start\n" is 6 chars, not 15 as stored in the dirstate.

> The modification that hg st is reporting is that the commit will  
> create a new head.

I seems that this is not consistently the case. If I just plain "hg up" 
to revision 0, no changes are reported by "hg st". If I modify a file to 
its content at the revision I will update to before updating, that file 
is reported as modified. But in both cases, the real state of the 
repository is exactly the same.

-- Remy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20080918/52c5a389/attachment-0001.asc>


More information about the Mercurial mailing list