[PATCH] mark files as normal in the dirstate after a successful lookup

Matt Mackall mpm at selenic.com
Tue Nov 8 23:55:37 UTC 2005


On Tue, Nov 08, 2005 at 02:53:08PM -0800, Matt Mackall wrote:
> On Tue, Nov 08, 2005 at 02:18:39PM -0800, Bryan O'Sullivan wrote:
> > On Tue, 2005-11-08 at 22:41 +0100, Benoit Boissinot wrote:
> > 
> > > reset mtime when two files are equal
> > 
> > This brings to my attention the fact that most of the dirstate
> > management is done without acquiring a repository lock, which means that
> > most commands that write the dirstate can potentially corrupt it.
> 
> Indeed.
> 
> This means adding a separate working directory lock, to prevent
> possibly conflicting add, removes, checkouts, etc.
> 
> It also means establishing a locking order so that we don't deadlock.
> 
> And for the above case, we probably want to make a distinction between
> readers and writers. 

Straw man design:

Add a working dir lock that nests in the repository write lock

Access is via localrepository.wlock()

This lock is only taken when we expect that we're going to write to dirstate

Writers atomically replace the dirstate file on write so that readers can
remain lockless

Taking the lock reloads the dirstate

Releasing the lock writes the dirstate

Status, in particular, upgrades from reader to writer if it decides it
wants to update mtimes, otherwise it remains lockless

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list