[issue1687] Empty dirstate files are no longer allowed while they can exist

Patrick Mézard mercurial-bugs at selenic.com
Thu Jun 4 12:11:47 UTC 2009


New submission from Patrick Mézard <pmezard at gmail.com>:

8536119f2f94 makes dirstate.py checks that .hg/dirstate is either missing or has
at least 40 bytes (2 parent identifiers). Unfortunately there is one corner case
when we can generate empty dirstates. It looks like localrepo.transactions()
creates an empty journal.dirstate, which is renamed as undo.dirstate. When
rollbacked, the empty file is renamed again as dirstate. The following script
reproduces the issue:

"""
#!/bin/sh

cat >> $HGRCPATH <<EOF
[extensions]
convert=
EOF

hg init repo
cd repo
echo a > a
echo b > b
hg ci -Am addab
echo b > c
hg ci -Am addc
hg mv c b
# This change makes b appear in the manifest but does not
# change anything once the filemap is applied. This will trigger
# a rollback in convert at the end of the run
hg mv --force c b
echo a >> a
hg ci -Am changeab
cd ..

cat > filemap <<EOF
include b
EOF

hg -v convert --filemap filemap repo repo-hg
hg -R repo-hg st
"""

We can fix journal.dirstate to contain nullid*2, or we can tolerate empty
dirstates file as 2*nullid in dirstate._pl. I think the latter is more friendly.

I will let mpm chose what to do.

----------
messages: 9458
nosy: mpm, pmezard
priority: bug
status: unread
title: Empty dirstate files are no longer allowed while they can exist
topic: regression, status

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1687>
____________________________________________________



More information about the Mercurial-devel mailing list