mercurial/commands.py
changeset 5168 64888ff907f4
parent 5123 f94dbc6c7eaf
child 5170 de7c772751b4
child 5236 cbe6e263357b
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1204,9 +1204,9 @@ def grep(ui, repo, pattern, *pats, **opt
             for fn in fns:
                 if fn in skip:
                     continue
-                fstate.setdefault(fn, {})
                 try:
                     grepbody(fn, rev, getfile(fn).read(mf[fn]))
+                    fstate.setdefault(fn, [])
                     if follow:
                         copied = getfile(fn).renamed(mf[fn])
                         if copied: