[PATCH 2 of 3] revset: add an undocumented _missingancestors function

Durham Goode durham at fb.com
Fri Feb 14 12:55:50 CST 2014


On 2/13/14 2:10 PM, "Siddharth Agarwal" <sid0 at fb.com> wrote:

># HG changeset patch
># User Siddharth Agarwal <sid0 at fb.com>
># Date 1392328485 28800
>#      Thu Feb 13 13:54:45 2014 -0800
># Node ID b23315bb97257c5a8c2a6810990b19f5aa1dd2c7
># Parent  36f133144674e0f91b4c16d3ca49c01b3046f572
>revset: add an undocumented _missingancestors function
>
>This will be used in an upcoming patch to optimize expressions of the form
>(::x - ::y).
>
>diff --git a/mercurial/revset.py b/mercurial/revset.py
>--- a/mercurial/revset.py
>+++ b/mercurial/revset.py
>@@ -1021,6 +1021,16 @@
>             return baseset([m])
>     return baseset([])
> 
>+def _missingancestors(repo, subset, x):
>+    # i18n: "_missingancestors" is a keyword
>+    revs, bases = getargs(x, 2, 2,
>+                          _("_missingancestors requires two arguments"))
>+    rs = baseset(repo)
>+    revs = getset(repo, rs, revs)
>+    bases = getset(repo, rs, bases)
>+    missing = set(repo.changelog.findmissingrevs(bases, revs))
>+    return baseset([r for r in subset if r in missing])
>+

You could use the new 'lazyset' class for the return value here, so we
don't have to iterate over the entire subset immediately.



More information about the Mercurial-devel mailing list