Patchwork [V2] dagwalker: drop an useless intermediate variable

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 15, 2014, 8:13 p.m.
Message ID <374b51d2d4a050eec3db.1413404002@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6302/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 15, 2014, 8:13 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1412761431 25200
#      Wed Oct 08 02:43:51 2014 -0700
# Node ID 374b51d2d4a050eec3dbacf79a41fe21a9ac571a
# Parent  75d0edb68b417964110e3fcd69187c867f31a119
dagwalker: drop an useless intermediate variable

The variable used to contains revs.set() but as the `.set()` have been removed
it is now useless.
Augie Fackler - Oct. 17, 2014, 2:25 p.m.
On Wed, Oct 15, 2014 at 01:13:22PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1412761431 25200
> #      Wed Oct 08 02:43:51 2014 -0700
> # Node ID 374b51d2d4a050eec3dbacf79a41fe21a9ac571a
> # Parent  75d0edb68b417964110e3fcd69187c867f31a119
> dagwalker: drop an useless intermediate variable

queued, thanks

>
> The variable used to contains revs.set() but as the `.set()` have been removed
> it is now useless.
>
> diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
> --- a/mercurial/graphmod.py
> +++ b/mercurial/graphmod.py
> @@ -35,15 +35,14 @@ def dagwalker(repo, revs):
>
>      cl = repo.changelog
>      lowestrev = revs.min()
>      gpcache = {}
>
> -    knownrevs = revs
>      for rev in revs:
>          ctx = repo[rev]
>          parents = sorted(set([p.rev() for p in ctx.parents()
> -                              if p.rev() in knownrevs]))
> +                              if p.rev() in revs]))
>          mpars = [p.rev() for p in ctx.parents() if
>                   p.rev() != nullrev and p.rev() not in parents]
>
>          for mpar in mpars:
>              gp = gpcache.get(mpar)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -35,15 +35,14 @@  def dagwalker(repo, revs):
 
     cl = repo.changelog
     lowestrev = revs.min()
     gpcache = {}
 
-    knownrevs = revs
     for rev in revs:
         ctx = repo[rev]
         parents = sorted(set([p.rev() for p in ctx.parents()
-                              if p.rev() in knownrevs]))
+                              if p.rev() in revs]))
         mpars = [p.rev() for p in ctx.parents() if
                  p.rev() != nullrev and p.rev() not in parents]
 
         for mpar in mpars:
             gp = gpcache.get(mpar)