Understanding dirstate.granularity

Adrian Buehlmann adrian at cadifra.com
Thu Sep 24 15:53:55 CDT 2009


On 24.09.2009 21:02, Greg Ward wrote:
>>From reading the code, I've just stumbled across the
> dirstate.granularity config setting.  Great: setting granularity = 0
> fixes a test case I'm working on for the bfiles extension (which uses
> its own private dirstate) so it behaves deterministically.  But the
> documentation is a bit scant.  Adrian posted a patch back in May
> (http://www.selenic.com/pipermail/mercurial-devel/2009-May/012594.html)
> that would improve the matter, but it's still not entirely clear to
> me.

Ah. Thanks for reminding me that this patch was abandoned.

I just wanted to look it up in hgrc.5 was surprised that
it isn't there :)

> So... what is the purpose of dirstate.granularity?  When would you set
> it, what would you set it to, and why?  Is setting it to 0 to
> workaround a racy-looking test case appropriate?

See Matt's response.

In practice, setting it to anything else than 1 sec
doesn't make much sense.

Setting it to 0 is in fact dangerous and reintroduces the
problem for what this setting was invented in the first
place.

The granularity of mercurial's time entries in the
dirstate is 1 second anyway.

FAT rounds its time down to the next even second, which
isn't entirely correctly handled in the current mercurial
code. But no one seems to be hurt by any relevant use cases.

BTW, it might make sense to support an alternate higher
resolution in .hg/dirstate in the future. But we probably
have more pressing features...


More information about the Mercurial-devel mailing list