Patchwork rebase: make "successors" a set in _computeobsoletenotrebased()

login
register
mail settings
Submitter Denis Laxalde
Date Feb. 10, 2018, 6:33 p.m.
Message ID <fd7d3104bc3e199c7894.1518287625@marimba>
Download mbox | patch
Permalink /patch/27519/
State Accepted
Headers show

Comments

Denis Laxalde - Feb. 10, 2018, 6:33 p.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1518287599 -3600
#      Sat Feb 10 19:33:19 2018 +0100
# Node ID fd7d3104bc3e199c7894ebed5413a86d4825ca11
# Parent  de0666564bde7c67c4d40a44dcf50515fef2f367
# EXP-Topic issue5782
rebase: make "successors" a set in _computeobsoletenotrebased()

There's no apparent reason for this variable to be a list and this
avoids converting it to a set when needed.
Yuya Nishihara - Feb. 11, 2018, 3:12 a.m.
On Sat, 10 Feb 2018 19:33:45 +0100, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis@laxalde.org>
> # Date 1518287599 -3600
> #      Sat Feb 10 19:33:19 2018 +0100
> # Node ID fd7d3104bc3e199c7894ebed5413a86d4825ca11
> # Parent  de0666564bde7c67c4d40a44dcf50515fef2f367
> # EXP-Topic issue5782
> rebase: make "successors" a set in _computeobsoletenotrebased()

Queued, thanks.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1805,10 +1805,10 @@  def _computeobsoletenotrebased(repo, reb
         srcnode = cl.node(srcrev)
         destnode = cl.node(destmap[srcrev])
         # XXX: more advanced APIs are required to handle split correctly
-        successors = list(obsutil.allsuccessors(repo.obsstore, [srcnode]))
+        successors = set(obsutil.allsuccessors(repo.obsstore, [srcnode]))
         # obsutil.allsuccessors includes node itself
         successors.remove(srcnode)
-        if set(successors).issubset(extinctnodes):
+        if successors.issubset(extinctnodes):
             # all successors are extinct
             obsoleteextinctsuccessors.add(srcrev)
         if not successors: