[PATCH] add: only retrieve from dirstate.walk files that were not removed
benoit.boissinot at ens-lyon.org
Mon Dec 14 11:11:56 CST 2009
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()? Or that walk() should
differentiate files that exists vs. file that existed (removed/missing).
In that case the keyword should probably be something else than
> @@ -637,8 +637,12 @@
> """return the ancestor context of self and c2"""
> return self._parents.ancestor(c2) # punt on two parents for now
> - def walk(self, match):
> - return sorted(self._repo.dirstate.walk(match, True, False))
> + def walk(self, match, removed=True):
> + files = self._repo.dirstate.walk(match, True, False)
> + if removed:
> + return sorted(files)
> + else:
> + return sorted(k for k,v in files.iteritems() if v is not None)
nitpick: we usually put a space after ','
> diff --git a/tests/test-rename b/tests/test-rename
> --- a/tests/test-rename
> +++ b/tests/test-rename
Is it actually related to rename? why not test-add or something similar?
More information about the Mercurial-devel