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

login
register
mail settings
Submitter Eric Sumner
Date April 14, 2015, 8:32 p.m.
Message ID <b30cb32ea6821e165aab.1429043548@waste.org>
Download mbox | patch
Permalink /patch/8668/
State Not Applicable
Headers show

Comments

Eric Sumner - April 14, 2015, 8:32 p.m.
# HG changeset patch
# User Eric Sumner <ericsumner@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.
Eric Sumner - April 14, 2015, 8:35 p.m.
Please ignore this second iteration of this patch; it's identical to the
previous email.  (pushgate user error)

  -- Eric

On 4/14/15, 4:32 PM, "Eric Sumner" <ericsumner@fb.com> wrote:

># HG changeset patch
># User Eric Sumner <ericsumner@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
>_______________________________________________
>Mercurial-devel mailing list
>Mercurial-devel@selenic.com
>http://selenic.com/mailman/listinfo/mercurial-devel

Patch

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