Patchwork [3,of,4] revset: added lazyset implementation to divergent revset

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 12, 2014, 6:02 p.m.
Message ID <90e180dce71d252f438f.1392228154@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3615/
State Accepted
Headers show

Comments

Lucas Moscovicz - Feb. 12, 2014, 6:02 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1391704530 28800
#      Thu Feb 06 08:35:30 2014 -0800
# Node ID 90e180dce71d252f438f9dc9405e3c69687bb48e
# Parent  1a774d348ff2593d39c063b3fcf5d63987044a4a
revset: added lazyset implementation to divergent revset
Matt Mackall - Feb. 12, 2014, 11:39 p.m.
On Wed, 2014-02-12 at 10:02 -0800, Lucas Moscovicz wrote:
> # HG changeset patch
> # User Lucas Moscovicz <lmoscovicz@fb.com>
> # Date 1391704530 28800
> #      Thu Feb 06 08:35:30 2014 -0800
> # Node ID 90e180dce71d252f438f9dc9405e3c69687bb48e
> # Parent  1a774d348ff2593d39c063b3fcf5d63987044a4a
> revset: added lazyset implementation to divergent revset
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -664,7 +664,7 @@
>      # i18n: "divergent" is a keyword
>      getargs(x, 0, 0, _("divergent takes no arguments"))
>      divergent = obsmod.getrevs(repo, 'divergent')

I think significant amounts of work happen in here, so this one isn't
successfully lazy. I've queued the other 3 from this set, thanks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -664,7 +664,7 @@ 
     # i18n: "divergent" is a keyword
     getargs(x, 0, 0, _("divergent takes no arguments"))
     divergent = obsmod.getrevs(repo, 'divergent')
-    return baseset([r for r in subset if r in divergent])
+    return lazyset(subset, lambda r: r in divergent)
 
 def draft(repo, subset, x):
     """``draft()``