[PATCH 2 of 4] revset: implemented discard method on lazy classes

Matt Mackall mpm at selenic.com
Fri Feb 21 18:58:33 CST 2014

On Fri, 2014-02-21 at 16:35 -0800, Lucas Moscovicz wrote:
> # HG changeset patch
> # User Lucas Moscovicz <lmoscovicz at fb.com>
> # Date 1392395021 28800
> #      Fri Feb 14 08:23:41 2014 -0800
> # Node ID c21e05d37daa1689935d83f10213f9faba4493ad
> # Parent  857bff65281118fee59b3d636835409925cabafc
> revset: implemented discard method on lazy classes
> Implemented this method to duck type set when used in cmdutil.

Same question: what uses discard and have you considered changing it to
not use discard? Since old-style revset list objects didn't even have a
discard method, something is a little weird here.

If the answer is "walkchangerevs", remember that one of the goals here
is to kill that function and most of its friends, at which point this
code will be orphaned. So it's better to do a hack inside walkchangerevs
so that we can kill everything altogether.

> +    def discard(self, x):
> +        self._hiddenrevs.add(x)

This is almost certainly wrong. This is a reference, not a copy, so
changing it will have an impact on everything that checks hidden revs.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list