[PATCH 5 of 8] subrepo: store the ui object in the base class

Matt Harbison matt_harbison at yahoo.com
Wed Nov 26 19:12:18 CST 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1417036418 18000
#      Wed Nov 26 16:13:38 2014 -0500
# Node ID b851277485af5f480d6aba05ed2a056ba7eadf1b
# Parent  7bb194b9451bfc35667ae64d675af1178ec274ef
subrepo: store the ui object in the base class

This will be used in the next patch to print a warning from the base class.  It
seems better than having to explicitly pass it to a new method, since a lot of
existing methods also require it.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -372,6 +372,9 @@
 
 class abstractsubrepo(object):
 
+    def __init__(self, ui):
+        self._ui = ui
+
     def storeclean(self, path):
         """
         returns true if the repository has not changed since it was last
@@ -508,6 +511,7 @@
 
 class hgsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
+        abstractsubrepo.__init__(self, ctx._repo.ui)
         self._path = path
         self._state = state
         r = ctx._repo
@@ -878,6 +882,7 @@
 
 class svnsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
+        abstractsubrepo.__init__(self, ctx._repo.ui)
         self._path = path
         self._state = state
         self._ctx = ctx
@@ -1108,6 +1113,7 @@
 
 class gitsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
+        abstractsubrepo.__init__(self, ctx._repo.ui)
         self._state = state
         self._ctx = ctx
         self._path = path


More information about the Mercurial-devel mailing list