Patchwork [2,of,2,STABLE] phases: drop dead code in `newheads`

login
register
mail settings
Submitter Boris Feld
Date Aug. 21, 2018, 11:35 a.m.
Message ID <72bcdb7b477e2195c0c4.1534851327@FB-lair>
Download mbox | patch
Permalink /patch/33932/
State Accepted
Headers show

Comments

Boris Feld - Aug. 21, 2018, 11:35 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1534580697 -7200
#      Sat Aug 18 10:24:57 2018 +0200
# Branch stable
# Node ID 72bcdb7b477e2195c0c41c3eb5ff9104d5306b89
# Parent  9c019032b49e561cefe8350cdcb51f6ab633caac
# EXP-Topic perf-phases
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 72bcdb7b477e
phases: drop dead code in `newheads`

There are new code earlier in the function achieving the same result.

Spotted by Yuya Nishihara.

Patch

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -678,8 +678,6 @@  def newheads(repo, heads, roots):
     # The logic operated on revisions, convert arguments early for convenience
     new_heads = set(rev(n) for n in heads if n != nullid)
     roots = [rev(n) for n in roots]
-    if not heads or not roots:
-        return heads
     # compute the area we need to remove
     affected_zone = repo.revs("(%ld::%ld)", roots, new_heads)
     # heads in the area are no longer heads