[PATCH 03 of 10 shelve-ext v3] shelve: move node-pruning functionality to be member of shelvedstate

Sean Farley sean at farley.io
Mon Feb 13 14:58:25 EST 2017


Kostia Balytskyi <ikostia at fb.com> writes:

> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1484740179 28800
> #      Wed Jan 18 03:49:39 2017 -0800
> # Node ID 249273f6db8bf0fdfbbf36bcbd9e3553e5715212
> # Parent  155f97b77a4866075fa709daa3bef6dac9108e81
> shelve: move node-pruning functionality to be member of shelvedstate
>
> Node-pruning can be node stripping or marker creation, depending on
> whether shelve is traditional or obs-based. Thus it makes sense to
> move it to a separate function. Also, since we already have
> shelvedstate object and this functionality operates on that object,
> it makes sense to make it a method.
>
> Having shelvedstate object contain repo and ui as members allows for
> calling 'state.prunenodes()' instead of 'state.prunenodes(repo, ui)'
> which is better IMO.

I don't know if it's better, strictly speaking, but it is a common
pattern throughout the code base. Usually, 'ui' is the first argument
(which could be different than repo.ui), then 'repo' is the following
argument.


More information about the Mercurial-devel mailing list