Patchwork [1,of,6,v7] rebase: pass repo, ui and opts objects to the RR class constructor

login
register
mail settings
Submitter Kostia Balytskyi
Date June 21, 2016, 2:28 p.m.
Message ID <cecea9a2281c8690db5a.1466519307@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/15559/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Kostia Balytskyi - June 21, 2016, 2:28 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1466518969 25200
#      Tue Jun 21 07:22:49 2016 -0700
# Node ID cecea9a2281c8690db5aa26d086a5b7a624e2754
# Parent  aa1d56003872cba207d908706da059141dd901a5
rebase: pass repo, ui and opts objects to the RR class constructor
Yuya Nishihara - June 24, 2016, 2:48 p.m.
On Tue, 21 Jun 2016 07:28:27 -0700, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia@fb.com>
> # Date 1466518969 25200
> #      Tue Jun 21 07:22:49 2016 -0700
> # Node ID cecea9a2281c8690db5aa26d086a5b7a624e2754
> # Parent  aa1d56003872cba207d908706da059141dd901a5
> rebase: pass repo, ui and opts objects to the RR class constructor

The series looks good to me. Queued, thanks!

> +++ b/hgext/rebase.py
> @@ -121,7 +121,13 @@ def _revsetdestrebase(repo, subset, x):
>  
>  class rebaseruntime(object):
>      """This class is a container for rebase runtime state"""
> -    def __init__(self):
> +    def __init__(self, repo, ui, opts=None):
> +        if opts is None:
> +            opts = {}
> +
> +        self.repo = repo
> +        self.ui = ui
> +        self.opts = opts

Nit: perhaps self.opts is redundant because opts are copied to dedicated
variables in __init__().

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -121,7 +121,13 @@  def _revsetdestrebase(repo, subset, x):
 
 class rebaseruntime(object):
     """This class is a container for rebase runtime state"""
-    def __init__(self):
+    def __init__(self, repo, ui, opts=None):
+        if opts is None:
+            opts = {}
+
+        self.repo = repo
+        self.ui = ui
+        self.opts = opts
         self.originalwd = None
         self.external = nullrev
         # Mapping between the old revision id and either what is the new rebased
@@ -243,7 +249,7 @@  def rebase(ui, repo, **opts):
     unresolved conflicts.
 
     """
-    rbsrt = rebaseruntime()
+    rbsrt = rebaseruntime(repo, ui, opts)
 
     lock = wlock = None
     try: