Patchwork [2,of,3] graphmod: stop building a list out of branchgroupiter

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 27, 2015, 7:25 p.m.
Message ID <df0a203aa014a3afe3e4.1440703527@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10299/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 27, 2015, 7:25 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1440198205 25200
#      Fri Aug 21 16:03:25 2015 -0700
# Node ID df0a203aa014a3afe3e4c4aa5fc9033e65fcb8c9
# Parent  c8a380090773ed60d31d8f8b4e01bbac797688b0
graphmod: stop building a list out of branchgroupiter

Not only this defeat the purpose of having `branchgroupiter` an iterable, but
this also makes revs something else than a smartset preventing to use revs.min()
in the call to reachablerevs.

Patch

diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
--- a/mercurial/graphmod.py
+++ b/mercurial/graphmod.py
@@ -245,11 +245,12 @@  def dagwalker(repo, revs):
         firstbranchrevset = repo.ui.config(
             'experimental', 'graph-group-branches.firstbranch', '')
         if firstbranchrevset:
             firstbranch = repo.revs(firstbranchrevset)
         parentrevs = repo.changelog.parentrevs
-        revs = list(groupbranchiter(revs, parentrevs, firstbranch))
+        revs = groupbranchiter(revs, parentrevs, firstbranch)
+        revs = revset.generatorset(revs)
 
     for rev in revs:
         ctx = repo[rev]
         parents = sorted(set([p.rev() for p in ctx.parents()
                               if p.rev() in revs]))