Patchwork discovery: don't compute allfuturecommon when it won't be used

login
register
mail settings
Submitter Michael O'Connor
Date April 13, 2015, 2:41 p.m.
Message ID <0b544ac4295f50bb6fd1.1428936102@tot-qws-u37085a.delacy.com>
Download mbox | patch
Permalink /patch/8631/
State Accepted
Headers show

Comments

Michael O'Connor - April 13, 2015, 2:41 p.m.
# HG changeset patch
# User Michael O'Connor <moconnor@janestreet.com>
# Date 1428933276 14400
#      Mon Apr 13 09:54:36 2015 -0400
# Node ID 0b544ac4295f50bb6fd142fee0600819331079bd
# Parent  52ff737c63d2b2cb41185549aa9c35bc47317032
discovery: don't compute allfuturecommon when it won't be used

In repos with many changesets, the computation of allfuturecommon
can take a significant amount of time.  Since it's only used if
there's an obsstore, don't compute it otherwise.
Pierre-Yves David - April 13, 2015, 5:19 p.m.
On 04/13/2015 10:41 AM, Michael O'Connor wrote:
> # HG changeset patch
> # User Michael O'Connor <moconnor@janestreet.com>
> # Date 1428933276 14400
> #      Mon Apr 13 09:54:36 2015 -0400
> # Node ID 0b544ac4295f50bb6fd142fee0600819331079bd
> # Parent  52ff737c63d2b2cb41185549aa9c35bc47317032
> discovery: don't compute allfuturecommon when it won't be used

Pushed to the clowncopter thanks

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -272,9 +272,13 @@ 
     # If there are more heads after the push than before, a suitable
     # error message, depending on unsynced status, is displayed.
     error = None
-    allmissing = set(outgoing.missing)
-    allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common))
-    allfuturecommon.update(allmissing)
+    # If there is no obsstore, allfuturecommon won't be used, so no
+    # need to compute it.
+    if repo.obsstore:
+        allmissing = set(outgoing.missing)
+        allfuturecommon = set(c.node()
+                              for c in repo.set('%ld', outgoing.common))
+        allfuturecommon.update(allmissing)
     for branch, heads in sorted(headssum.iteritems()):
         remoteheads, newheads, unsyncedheads = heads
         candidate_newhs = set(newheads)