[PATCH 1 of 2] obsstore: pass a UI object reference

Eric Sumner ericsumner at fb.com
Tue Apr 14 15:32:28 CDT 2015


# HG changeset patch
# User Eric Sumner <ericsumner at fb.com>
# Date 1429037848 14400
#      Tue Apr 14 14:57:28 2015 -0400
# Node ID b30cb32ea6821e165aab65051767aa810fdb8464
# Parent  c560d8c687916cb70a6d54c2c9ddcb5c9e457be2
obsstore: pass a UI object reference

The obsstore object currently has no channel to output messages to the user;
this diff passes one in at construction so that it's available.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -567,5 +567,5 @@
 
     Result is the number of markers in the repo."""
     timer, fm = gettimer(ui)
-    timer(lambda: len(obsolete.obsstore(repo.svfs)))
+    timer(lambda: len(obsolete.obsstore(repo.svfs, ui=ui)))
     fm.end()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -425,7 +425,7 @@
         if defaultformat is not None:
             kwargs['defaultformat'] = defaultformat
         readonly = not obsolete.isenabled(self, obsolete.createmarkersopt)
-        store = obsolete.obsstore(self.svfs, readonly=readonly,
+        store = obsolete.obsstore(self.svfs, ui=self.ui, readonly=readonly,
                                   **kwargs)
         if store and readonly:
             self.ui.warn(
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -517,11 +517,12 @@
     # parents: (tuple of nodeid) or None, parents of precursors
     #          None is used when no data has been recorded
 
-    def __init__(self, sopener, defaultformat=_fm1version, readonly=False):
+    def __init__(self, sopener, ui=None, defaultformat=_fm1version, readonly=False):
         # caches for various obsolescence related cache
         self.caches = {}
         self._all = []
         self.sopener = sopener
+        self.ui = ui
         data = sopener.tryread('obsstore')
         self._version = defaultformat
         self._readonly = readonly


More information about the Mercurial-devel mailing list