[PATCH] dirstate: fix generator/list error when using python 2.7

Durham Goode durham at fb.com
Sun Feb 10 14:44:36 CST 2013


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1360527819 28800
# Node ID 9c384e0ef7f5c860ea774bbdc5e0c30e3e7421e8
# Parent  013fcd112f13f31a35ea6a40d8cd1c6923cdaf20
dirstate: fix generator/list error when using python 2.7

util.statfiles returns a generator on python 2.7 with c extensions disabled.
This caused util.statfiles(...) [0] to break in tests. Since we're only
stat'ing one file, I just changed it to call lstat directly.

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -687,7 +687,11 @@
                     # Report ignored items in the dmap as long as they are not
                     # under a symlink directory.
                     if ignore(nf) and audit_path.check(nf):
-                        results[nf] = util.statfiles([join(nf)])[0]
+                        try:
+                            results[nf] = lstat(join(nf))
+                        except OSError:
+                            # file doesn't exist
+                            results[nf] = None
                     else:
                         # It's either missing or under a symlink directory
                         results[nf] = None


More information about the Mercurial-devel mailing list