[PATCH] add: only retrieve from dirstate.walk files that were not removed

Benoit Boissinot benoit.boissinot at ens-lyon.org
Tue Dec 15 02:19:53 CST 2009


On Mon, Dec 14, 2009 at 11:49:20AM -0600, Matt Mackall wrote:
> On Mon, 2009-12-14 at 18:11 +0100, Benoit Boissinot wrote:
> > On Mon, Dec 14, 2009 at 07:00:43PM +0900, Nicolas Dumazet wrote:
> > > # HG changeset patch
> > > # User Nicolas Dumazet <nicdumz.commits at gmail.com>
> > > # Date 1260498662 -32400
> > > # Node ID c13f2fd2afb5fb0c461ded5dbcd00cf9280d6ce9
> > > # Parent  fd6729805f44c0686abf0a4d59449284b2ff7dd6
> > > add: only retrieve from dirstate.walk files that were not removed
> > > 
> > > It does not make sense to match removed files in this context.
> > > It should suppress a bogus hg add warning when adding a directory over
> > > a removed file.
> > 
> > Sorry for the delay, I just had a look at this patch.
> > 
> > Isn't the real problem the use of m.exact()?
> 
> No. The problem is:
> 
> hg mv a b
> mkdir a
> touch a/a
> hg add a  # should succeed
> 
> Because 'a' is in state 'removed', it gets returned by walk(), even
> though it's not relevant.
> 
> >  Or that walk() should
> > differentiate files that exists vs. file that existed (removed/missing).
> 
> No, compare:
> 
> rm a  # spurious unrecorded deletion of a
> mkdir a
> touch a/a
> hg add a  # should complain loudly
> 
> walk() should definitely return a here as it is still relevant.

Is 'a' relevant?

'a/a' definitely is (and will be rightly yielded by walk).

But passing 'a' to localrepo.add() isn't the right thing to do in my
opinion (directories aren't tracked).
localrepo.add() will loudly complains when we will try to add 'a/a'.

regards,

Benoit

-- 
:wq


More information about the Mercurial-devel mailing list