command.revert(rev=rev, all=True) has timing dependent results after former commit

Peer Stritzinger peerst at
Wed Oct 26 12:54:17 CDT 2011

On Wed, Oct 26, 2011 at 12:25 AM, Greg Ward <greg-hg at> wrote:
> On Tue, Oct 25, 2011 at 5:52 PM, Peer Stritzinger <peerst at> wrote:
> What I learned from that epic fix (it took me something like eight
> months to produce a 10-line patch, working sporadically!) is that you
> can't rule out bugs in dirstate when something timing-dependent is
> going on. Yeah, that's a gross generalization, and it's much more
> likely to be a bug in your extension (sorry).

Actually its a problem caused by commands.revert when used in the very
general case hg collapse does.  See my submitted patch from just now.

> Incidentally, the bug we fixed in 1.9 was this:
>  * two commits in the same process (and same repo lock)
>  * happening within the same second
>  * modifying the same file
>  * where the second commit leaves the file size unchanged
> ... would make the second commit not happen, i.e. Mercurial thought
> "nothing changed". So keep in mind that those are the sort of
> circumstances that indicate a possible dirstate bug. I hope we don't
> have another one!

There is a timing dependent behaviour in commands.revert because it
handles files that have undefined timestamp in dirstate like modified
files.  I had to call it with the 'no_backup' option from hgcollapse
because it sometimes created backups of files it had to remove and
sometimes not (even after I apply the above mentioned patch)

> Oh yeah: you might also try it with the current tip of stable, since
> Mercurial 2.0 is coming out in a few days.

The problem was also with the tip of stable.

BTW: I was extending hgcollapse to massage a repo that I converted
with your cvs2hg in order to automatically collapse cvs commits that
were made in a short time (similar to hg convert but also when  the
message changed, since we had 10 years of single file commits with
message per file in the CVS)

Now I can convert this over to hg at last!

Thanks for your helpfull info and for cvs2hg!
-- Peer

More information about the Mercurial-devel mailing list