changeset 1024:8feff33e387d

layouts: make ui object available to layout instances
author David Schleimer <dschleimer@fb.com>
date Tue, 21 May 2013 15:49:07 -0700
parents 7a262ecae4f3
children 2bf860f327e2
files hgsubversion/layouts/__init__.py hgsubversion/layouts/base.py hgsubversion/svnmeta.py
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/layouts/__init__.py
+++ b/hgsubversion/layouts/__init__.py
@@ -31,7 +31,7 @@ NAME_TO_CLASS = {
 }
 
 
-def layout_from_name(name):
+def layout_from_name(name, ui):
     """Returns a layout module given the layout name
 
     You should use one of the layout.detect.* functions to get the
@@ -41,4 +41,4 @@ def layout_from_name(name):
 
     if name not in NAME_TO_CLASS:
         raise hgutil.Abort('Unknown hgsubversion layout: %s' %name)
-    return NAME_TO_CLASS[name]()
+    return NAME_TO_CLASS[name](ui)
--- a/hgsubversion/layouts/base.py
+++ b/hgsubversion/layouts/base.py
@@ -9,6 +9,9 @@ from mercurial import util as hgutil
 
 class BaseLayout(object):
 
+    def __init__(self, ui):
+        self.ui = ui
+
     def __unimplemented(self, method_name):
         raise NotImplementedError(
             "Incomplete layout implementation: %s.%s doesn't implement %s" %
--- a/hgsubversion/svnmeta.py
+++ b/hgsubversion/svnmeta.py
@@ -111,7 +111,7 @@ class SVNMeta(object):
     @property
     def layoutobj(self):
         if not self._layoutobj:
-            self._layoutobj = layouts.layout_from_name(self.layout)
+            self._layoutobj = layouts.layout_from_name(self.layout, self.ui)
         return self._layoutobj
 
     @property