Patchwork [05,of,11] revset: use `subset &` in `divergent`

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 23, 2014, 10:47 p.m.
Message ID <f740a9975e010f826868.1411512471@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5937/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 23, 2014, 10:47 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1410976719 25200
#      Wed Sep 17 10:58:39 2014 -0700
# Node ID f740a9975e010f8268684d08872b190fe0d59de5
# Parent  a29e99d8280b35694255f0b70d88206c0ff56bba
revset: use `subset &` in `divergent`

This take advantage of the `fullreposet` smartness

revset #0: divergent()
0) wall 0.002047 comb 0.000000 user 0.000000 sys 0.000000 (best of 813)
1) wall 0.000052 comb 0.000000 user 0.000000 sys 0.000000 (best of 22757)

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -732,11 +732,11 @@  def divergent(repo, subset, x):
     Final successors of changesets with an alternative set of final successors.
     """
     # i18n: "divergent" is a keyword
     getargs(x, 0, 0, _("divergent takes no arguments"))
     divergent = obsmod.getrevs(repo, 'divergent')
-    return subset.filter(divergent.__contains__)
+    return subset & divergent
 
 def draft(repo, subset, x):
     """``draft()``
     Changeset in draft phase."""
     # i18n: "draft" is a keyword