Patchwork [08,of,11] revset: use `subset &` in `origin`

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 23, 2014, 10:47 p.m.
Message ID <becb27aa41249d70db42.1411512474@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5940/
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 1411008754 25200
#      Wed Sep 17 19:52:34 2014 -0700
# Node ID becb27aa41249d70db42517bfced03100115b005
# Parent  248f0c8c29fd8c341845c187cb19fcfceeef5e3d
revset: use `subset &` in `origin`

This take advantage of the `fullreposet` smartness.

revset #0: origin(tip)
0) wall 0.005353 comb 0.000000 user 0.000000 sys 0.000000 (best of 354)
1) wall 0.003080 comb 0.000000 user 0.000000 sys 0.000000 (best of 446)

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1165,11 +1165,11 @@  def origin(repo, subset, x):
                 return src
             src = prev
 
     o = set([_firstsrc(r) for r in args])
     o -= set([None])
-    return subset.filter(o.__contains__)
+    return subset & o
 
 def outgoing(repo, subset, x):
     """``outgoing([path])``
     Changesets not found in the specified destination repository, or the
     default push location.