Technical question about dirstate.statwalk
Benoit Boissinot
bboissin at gmail.com
Tue May 20 09:56:40 UTC 2008
On Tue, May 20, 2008 at 10:15 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> I'm trying to puzzle out dirstate.statwalk (from crew). Specifically,
> in the loop
>
> for ff in files:
> nf = normpath(ff)
> f = _join(ff)
> [...]
> else:
> if nf in known:
> continue
> known[nf] = 1
> if match(nf):
> if supported(ff, st.st_mode, verbose=True):
> yield 'f', nf, st
> elif ff in dc:
> yield 'm', nf, st
>
I think there is a bug and it should test if nf is in dc instead,
while looking at the code I've (and Adrian) found a couple more bugs.
Can someone review the following ?
And it would be great to have more tests for this.
regards,
Benoit
diff -r 170818dad56b mercurial/dirstate.py
--- a/mercurial/dirstate.py Mon May 19 10:23:47 2008 +0200
+++ b/mercurial/dirstate.py Tue May 20 11:55:42 2008 +0200
@@ -435,7 +435,7 @@
'''
def fwarn(f, msg):
- self._ui.warn('%s: %s\n' % (self.pathto(ff), msg))
+ self._ui.warn('%s: %s\n' % (self.pathto(f), msg))
return False
badfn = fwarn
if hasattr(match, 'bad'):
@@ -543,7 +543,7 @@
if inst.errno != errno.ENOENT:
fwarn(ff, inst.strerror)
elif badfn(ff, inst.strerror) and imatch(nf):
- yield 'f', ff, None
+ yield 'f', nf, None
continue
if s_isdir(st.st_mode):
if not dirignore(nf):
@@ -556,7 +556,7 @@
if match(nf):
if supported(ff, st.st_mode, verbose=True):
yield 'f', nf, st
- elif ff in dc:
+ elif nf in dc:
yield 'm', nf, st
# step two run through anything left in the dc hash and yield
More information about the Mercurial-devel
mailing list