[PATCH 5 of 7 v4] rebase: move revset-defining local variables to the RRS class

Yuya Nishihara yuya at tcha.org
Mon Jun 13 09:39:11 EDT 2016


On Sun, 5 Jun 2016 18:46:19 +0100, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1465135652 -3600
> #      Sun Jun 05 15:07:32 2016 +0100
> # Node ID d55ee8750f35e50a4005cf2cc160a22035217d2a
> # Parent  f77b84882afcf7e12afc520db6e758ca302a97b2
> rebase: move revset-defining local variables to the RRS class
> 
> This commit moves:
>  -destf
>  -srcf
>  -basef
>  -revf
> to be fields of the previously introduced RebaseRuntimeState 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 RebaseRuntimeState(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 RebaseRuntimeState(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', [])

Are we going to move everything under the RRS class?

I think it will be nice if we can separate the command processing from the
rebase logic. I have no idea how difficult it will be, though.


More information about the Mercurial-devel mailing list