Patchwork D6144: discovery: prevent recomputing info about server and outgoing changesets

login
register
mail settings
Submitter phabricator
Date March 27, 2019, 7:36 p.m.
Message ID <41b5fcb4bd3c58320d87d9425f9ac0fc@localhost.localdomain>
Download mbox | patch
Permalink /patch/39402/
State Not Applicable
Headers show

Comments

phabricator - March 27, 2019, 7:36 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG98908e36d58a: discovery: prevent recomputing info about server and outgoing changesets (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6144?vs=14536&id=14599

REVISION DETAIL
  https://phab.mercurial-scm.org/D6144

AFFECTED FILES
  mercurial/discovery.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -201,19 +201,24 @@ 
     outgoing = pushop.outgoing
     cl = repo.changelog
     headssum = {}
+    missingctx = set()
     # A. Create set of branches involved in the push.
-    branches = set(repo[n].branch() for n in outgoing.missing)
+    branches = set()
+    for n in outgoing.missing:
+        ctx = repo[n]
+        missingctx.add(ctx)
+        branches.add(ctx.branch())
+    nbranches = branches.copy()
 
     with remote.commandexecutor() as e:
         remotemap = e.callcommand('branchmap', {}).result()
 
-    newbranches = branches - set(remotemap)
+    remotebranches = set(remotemap)
+    newbranches = branches - remotebranches
     branches.difference_update(newbranches)
 
     # A. register remote heads
-    remotebranches = set()
     for branch, heads in remotemap.iteritems():
-        remotebranches.add(branch)
         known = []
         unsynced = []
         knownnode = cl.hasnode # do not use nodemap until it is filtered
@@ -224,16 +229,12 @@ 
                 unsynced.append(h)
         headssum[branch] = (known, list(known), unsynced)
     # B. add new branch data
-    missingctx = list(repo[n] for n in outgoing.missing)
-    touchedbranches = set()
-    for ctx in missingctx:
-        branch = ctx.branch()
-        touchedbranches.add(branch)
+    for branch in nbranches:
         if branch not in headssum:
             headssum[branch] = (None, [], [])
 
     # C drop data about untouched branches:
-    for branch in remotebranches - touchedbranches:
+    for branch in remotebranches - nbranches:
         del headssum[branch]
 
     # D. Update newmap with outgoing changes.