hg reporting files as modified when they are not

Remy Blank remy.blank at pobox.com
Wed Sep 17 17:45:15 CDT 2008


Can someone explain why the following script ends up with a repository 
where "hg st" reports a modified file, but "hg di" doesn't show anything?

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
hg debugstate
hg up -r 0
hg debugstate
sleep 2
hg up -r 0
hg debugstate
hg st
hg di

In words: the script creates a repository with two revisions. While at 
revision 1, the content of file is set to the value it had at revision 
0. This is followed by an update to revision 0, which doesn't report any 
changes.

Here's the output of a run:

n   0         -1 unset               file
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
n 664         15 2008-09-18 00:35:58 file
n 664         15 2008-09-18 00:35:58 file
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
n 664         15 2008-09-18 00:35:58 file
M file

It seems that the dirstate of file remains at the state it had at 
revision 1, even though the repository was updated to revision 0.

If I remove the "sleep 2", the problem sometimes happens, sometimes not. 
I suspect that the commit and update must not happen at the same second 
for the problem to occur.

If I remove the "hg up" after the "sleep 2", the problem doesn't occur, 
as the state of file remains "unset".

I bumped into this problem by using Mercurial to manage patches over an 
SVN working copy using hgsvn. When updating to a given revision using 
SVN, then updating to the same revision using hg, I get into this state 
where files are flagged as modified, when the really are not.

Using:
$ hg --version
Mercurial Distributed SCM (version 1.0.1)

Thanks.
-- 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://selenic.com/pipermail/mercurial/attachments/20080918/37d51aab/attachment.pgp 


More information about the Mercurial mailing list