[PATCH] exchange: allow fallbackheads to use lazy set behavior

Durham Goode durham at fb.com
Tue Sep 8 00:13:09 UTC 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1441670915 25200
#      Mon Sep 07 17:08:35 2015 -0700
# Node ID c595696df8614f58194e210f8b3b1d4c1a25926e
# Parent  d72ff051c6c6dee945690b0e5554a0450820e93e
exchange: allow fallbackheads to use lazy set behavior

The common ancestor set implementation was made lazy a couple years ago, but
this piece of code still required processing the entire repo by putting set()
around the lazy set. The code was introduced in 5653f2d166ea, a year before the
lazy ancestor set was added.

Dropping the set() shaves 3.5 seconds off of 'push -r' in repos with hundreds of
thousands of commits.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -147,7 +147,7 @@ class pushoperation(object):
         #
         # We can pick:
         # * missingheads part of common (::commonheads)
-        common = set(self.outgoing.common)
+        common = self.outgoing.common
         nm = self.repo.changelog.nodemap
         cheads = [node for node in self.revs if nm[node] in common]
         # and


More information about the Mercurial-devel mailing list