[PATCH 2 of 3] dirstate: add getfstime() to get current time to filesystem resolution

Greg Ward greg at gerg.ca
Wed Mar 16 07:58:27 CDT 2011


On 15 March 2011, Matt Mackall said:
> On Tue, 2011-03-15 at 21:39 -0400, Greg Ward wrote:
> > # HG changeset patch
> > # User Greg Ward <greg at gerg.ca>
> > # Date 1300238571 14400
> > # Node ID a32697a387d0ff0b7327cb993b700c1eb0310326
> > # Parent  c5fa123f60a63af19057e873106c532ee2c553fa
> > dirstate: add getfstime() to get current time to filesystem resolution.
> > 
> > Based on code already in write(). Will be needed by
> > localrepository.commit() to call dirstate.maybelookup().
> 
> And this tempfile is needed because we don't have a handy file around
> that we're already writing to?

Correct.  dirstate.write() does, of course, which is why maybelookup()
takes 'now' as an arg.  But localrepository.commit() does not
necessarily.

I suspect your suggestion to move most of this into dirstate would
maybe getfstime() irrelevant, or at least private.

No, I'm not particularly thrilled with the overhead of creating a file
just to figure out the current time.  But 1) I couldn't think of a
better way, and 2) as the patch series stands, it only happens when we
do multiple commits in the same process, which is an uncommon case.

        Greg


More information about the Mercurial-devel mailing list