grep: use set instead of dict with dummy value
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 18 Jan 2019 11:10:30 -0800
changeset 41368 609d6d8646db
parent 41367 b44f1703b28c
child 41369 5079242abef9
grep: use set instead of dict with dummy value Differential Revision: https://phab.mercurial-scm.org/D5633
mercurial/commands.py
--- a/mercurial/commands.py	Thu Sep 06 15:56:53 2018 -0700
+++ b/mercurial/commands.py	Fri Jan 18 11:10:30 2019 -0800
@@ -2925,7 +2925,7 @@
             fm.data(matched=False)
         fm.end()
 
-    skip = {}
+    skip = set()
     revfiles = {}
     match = scmutil.match(repo[None], pats, opts)
     found = False
@@ -2954,7 +2954,7 @@
                 if copy:
                     copies.setdefault(rev, {})[fn] = copy
                     if fn in skip:
-                        skip[copy] = True
+                        skip.add(copy)
             if fn in skip:
                 continue
             files.append(fn)
@@ -2984,16 +2984,16 @@
             copy = copies.get(rev, {}).get(fn)
             if fn in skip:
                 if copy:
-                    skip[copy] = True
+                    skip.add(copy)
                 continue
             pstates = matches.get(parent, {}).get(copy or fn, [])
             if pstates or states:
                 r = display(fm, fn, ctx, pstates, states)
                 found = found or r
                 if r and not diff and not all_files:
-                    skip[fn] = True
+                    skip.add(fn)
                     if copy:
-                        skip[copy] = True
+                        skip.add(copy)
         del revfiles[rev]
         # We will keep the matches dict for the duration of the window
         # clear the matches dict once the window is over