D5633: grep: use set instead of dict with dummy value

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jan 25 15:04:16 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG64bd6611e18e: grep: use set instead of dict with dummy value (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5633?vs=13326&id=13456

REVISION DETAIL
  https://phab.mercurial-scm.org/D5633

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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)
                         continue
             files.append(fn)
 
@@ -2983,16 +2983,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



To: martinvonz, #hg-reviewers
Cc: lothiraldan, mercurial-devel


More information about the Mercurial-devel mailing list