Patchwork exchange: drop dead code

login
register
mail settings
Submitter Pierre-Yves David
Date May 27, 2014, 12:20 a.m.
Message ID <c90a258f614b4c65c667.1401150053@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4867/
State Accepted
Commit e303b8ea84b3f93b5b9e9d09eedb2a37f701c308
Headers show

Comments

Pierre-Yves David - May 27, 2014, 12:20 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1400801236 25200
#      Thu May 22 16:27:16 2014 -0700
# Node ID c90a258f614b4c65c667c42b141eb3fe9ec1d19c
# Parent  c5346e482b1f7b33fcddce131b8f44b3fe98a396
exchange: drop dead code

This code have been factorised and moved in its own function by 7d0bbb6dd730. We
actually read the result of this other computation in the very line before the
deleted block.  I somehow forgot to remove the original code, but it is now
dead. Good bye duplicated computation.
Matt Mackall - May 27, 2014, 12:33 a.m.
On Mon, 2014-05-26 at 17:20 -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1400801236 25200
> #      Thu May 22 16:27:16 2014 -0700
> # Node ID c90a258f614b4c65c667c42b141eb3fe9ec1d19c
> # Parent  c5346e482b1f7b33fcddce131b8f44b3fe98a396
> exchange: drop dead code

These are queued for default, thanks.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -328,41 +328,10 @@  def _pushcomputecommonheads(pushop):
 
 def _pushsyncphase(pushop):
     """synchronise phase information locally and remotely"""
     unfi = pushop.repo.unfiltered()
     cheads = pushop.commonheads
-    if pushop.ret:
-        # push succeed, synchronize target of the push
-        cheads = pushop.outgoing.missingheads
-    elif pushop.revs is None:
-        # All out push fails. synchronize all common
-        cheads = pushop.outgoing.commonheads
-    else:
-        # I want cheads = heads(::missingheads and ::commonheads)
-        # (missingheads is revs with secret changeset filtered out)
-        #
-        # This can be expressed as:
-        #     cheads = ( (missingheads and ::commonheads)
-        #              + (commonheads and ::missingheads))"
-        #              )
-        #
-        # while trying to push we already computed the following:
-        #     common = (::commonheads)
-        #     missing = ((commonheads::missingheads) - commonheads)
-        #
-        # We can pick:
-        # * missingheads part of common (::commonheads)
-        common = set(pushop.outgoing.common)
-        nm = pushop.repo.changelog.nodemap
-        cheads = [node for node in pushop.revs if nm[node] in common]
-        # and
-        # * commonheads parents on missing
-        revset = unfi.set('%ln and parents(roots(%ln))',
-                         pushop.outgoing.commonheads,
-                         pushop.outgoing.missing)
-        cheads.extend(c.node() for c in revset)
-    pushop.commonheads = cheads
     # even when we don't push, exchanging phase data is useful
     remotephases = pushop.remote.listkeys('phases')
     if (pushop.ui.configbool('ui', '_usedassubrepo', False)
         and remotephases    # server supports phases
         and pushop.ret is None # nothing was pushed