Patchwork [3,of,6] pushbookmark: stop unrolling ancestors

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 18, 2014, 9:50 p.m.
Message ID <032e5a4ffd4341b22f21.1408398601@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5473/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 18, 2014, 9:50 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1408145466 25200
#      Fri Aug 15 16:31:06 2014 -0700
# Node ID 032e5a4ffd4341b22f2135d26cd8172e64cabfb6
# Parent  45f5b72530ad0be0c6ae2af17af70f461274c9e4
pushbookmark: stop unrolling ancestors

Now that ancestors has the same boolean property as list, we can stop unrolling
the set of ancestors. This should provide significant speedup to this step as
ancestors object are smart and lazy.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -616,11 +616,11 @@  def _pushbookmark(pushop):
     ui = pushop.ui
     repo = pushop.repo.unfiltered()
     remote = pushop.remote
     ui.debug("checking for updated bookmarks\n")
     revnums = map(repo.changelog.rev, pushop.revs or [])
-    ancestors = [a for a in repo.changelog.ancestors(revnums, inclusive=True)]
+    ancestors = repo.changelog.ancestors(revnums, inclusive=True)
     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
      ) = bookmarks.compare(repo, repo._bookmarks, remote.listkeys('bookmarks'),
                            srchex=hex)
 
     for b, scid, dcid in advsrc: