Patchwork [1,of,4,V2] repoview: use set for blockers

login
register
mail settings
Submitter David Soria Parra
Date Aug. 13, 2014, 9:43 p.m.
Message ID <eeafc9cb22a894e4c76c.1407966238@dev544.prn1.facebook.com>
Download mbox | patch
Permalink /patch/5376/
State Accepted
Headers show

Comments

David Soria Parra - Aug. 13, 2014, 9:43 p.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1407886944 25200
#      Tue Aug 12 16:42:24 2014 -0700
# Node ID eeafc9cb22a894e4c76ca464f5b5bfd37fd37f05
# Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
repoview: use set for blockers

Blockers should be unique but tags and bookmarks could point to the same rev,
therefore use a set to ensure that we don't have duplicates.
Pierre-Yves David - Aug. 14, 2014, 12:44 a.m.
On 08/13/2014 02:43 PM, David Soria Parra wrote:
> # HG changeset patch
> # User David Soria Parra <davidsp@fb.com>
> # Date 1407886944 25200
> #      Tue Aug 12 16:42:24 2014 -0700
> # Node ID eeafc9cb22a894e4c76ca464f5b5bfd37fd37f05
> # Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
> repoview: use set for blockers

These patches, fails to applies.

I've pull a rebased version and I'm about to review it.

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -33,15 +33,15 @@ 
         revs = cl.revs(start=firsthideable)
         tofilter = repo.revs(
             '(%ld) and children(%ld)', list(revs), list(hideable))
-        blockers = [r for r in tofilter if r not in hideable]
+        blockers = set([r for r in tofilter if r not in hideable])
         for par in repo[None].parents():
-            blockers.append(par.rev())
+            blockers.add(par.rev())
         for bm in repo._bookmarks.values():
-            blockers.append(cl.rev(bm))
+            blockers.add(cl.rev(bm))
         tags = {}
         tagsmod.readlocaltags(repo.ui, repo, tags, {})
         if tags:
-            blockers.extend(cl.rev(t[0]) for t in tags.values())
+            blockers.update(cl.rev(t[0]) for t in tags.values())
     return blockers
 
 def computehidden(repo):