Preserving timestamps

Steve Borho steve at ageia.com
Tue Aug 7 18:45:49 CDT 2007


On Tuesday 07 August 2007 5:47:12 pm Henryk Gerlach wrote:
> > Instead of making .timestamps a file, you could make it a directory
> > which mirrors the structure of your repository.  To signify a file
> > you wish to preserve timestamps, you add an empty placeholder:
> > mkdir -p $(hg root)/.timestamps/foo/bar
> > touch $(hg root)/.timestamps/foo/bar/baz.py
> >
> > So now your hooks do the equivelent of:
> > touch -r $(hg root)/foo/bar/baz.py $(hg
> > root)/.timestamps/foo/bar/baz.py <modify baz.py>
> > touch -r $(hg root)/.timestamps/foo/bar/baz.py $(hg
> > root)/foo/bar/baz.py
>
> Well, but mercurial won't manage the timestamps of (hg
> root)/.timestamps/* either, so all your timstamps would still be lost

Erp.  I was only considering keeping the timestamps coherent on your 
local machine, so I assumed .timestamps/ wasn't being revisioned.

> ... unless you use tar (or some other timestamp aware packer) to pack
> the whole directory before commit. This should be doable, but I see
> no real advantage over my approach, except that you don't depend on
> python (which we all do anyway).

Yep, you're right, you don't gain much if you need to maintain the 
timestamps as part of the commit.  Bryan O'Sullivan also made a good 
point that your flat file approach would be much less abusive, 
performance wise, than having to do a directory lookup for each file 
operation.

> OK, the .timestamps/* structure might also be more accessable than
> the pickle-file. But then i would prefer a human-readable .timestamp
> file, just containing the human readable timestamps, which you can
> apply using touch -d.

I would prefer a human editable file, unless commands were provided to 
manage it.  But then again, I don't need persistent timestamps myself 
so you can take my advice with large grain of salt :)

Cheers,

-- 
Steve Borho (steve at ageia.com)
http://www.borho.org/~steve/steveAgeia.asc
Key fingerprint = 3D9C 67D5 F426 4322 075B  0795 C9B2 C3A0 97D0 C090


More information about the Mercurial mailing list