[PATCH 5 of 7 v6] rebase: move revset-defining local variables to the RR class
Yuya Nishihara
yuya at tcha.org
Thu Jun 16 10:58:07 EDT 2016
On Mon, 13 Jun 2016 23:03:50 +0100, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1465854200 -3600
> # Mon Jun 13 22:43:20 2016 +0100
> # Node ID ad8e1710d3337924368905bdb1601c0bbc150e15
> # Parent 5403815281a1e78e26992bf3180c527727c9463c
> rebase: move revset-defining local variables to the RR class
>
> This commit moves:
> -destf
> -srcf
> -basef
> -revf
> to be fields of the previously introduced rebaseruntime class.
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -121,7 +121,7 @@ def _revsetdestrebase(repo, subset, x):
>
> class rebaseruntime(object):
> """This class is a container for rebase runtime state"""
> - def __init__(self):
> + def __init__(self, opts):
> self.originalwd = None
> self.external = nullrev
> # Mapping between the old revision id and either what is the new rebased
> @@ -133,6 +133,12 @@ class rebaseruntime(object):
> self.skipped = set()
> self.targetancestors = set()
>
> + # Validate input and define rebasing points
> + self.destf = opts.get('dest', None)
> + self.srcf = opts.get('source', None)
> + self.basef = opts.get('base', None)
> + self.revf = opts.get('rev', [])
These variables are only used for calculating the rebase destination and the
source set, and they are consumed by _definesets(). I think _definesets() is
the stage to prepare new rebaseruntime environment.
IMHO, moving many variables to the RR class won't reduce complexity.
Any thoughts?
More information about the Mercurial-devel
mailing list