Patchwork [3,of,9] subrepo: reset 'self.ui' to the subrepo copy of 'ui' in the hgsubrepo class

login
register
mail settings
Submitter Matt Harbison
Date Dec. 15, 2014, 1:12 a.m.
Message ID <43c4974be91f73e5f2d5.1418605960@Envy>
Download mbox | patch
Permalink /patch/7104/
State Accepted
Headers show

Comments

Matt Harbison - Dec. 15, 2014, 1:12 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1418521381 18000
#      Sat Dec 13 20:43:01 2014 -0500
# Node ID 43c4974be91f73e5f2d52f9a87e29ab62cc2711f
# Parent  f51f778ce078dc8038aa4ad38c420ca5d2fd83e5
subrepo: reset 'self.ui' to the subrepo copy of 'ui' in the hgsubrepo class

Creation of the subrepo's '_repo' object creates a new 'ui' by combining the
parent repo's 'baseui' and reading in the subrepo's hgrc file.  This simply
avoids 'self.ui' and 'self._repo.ui' pointing to different objects, which seems
like a potential source of bugs.

Git and Svn subrepos are unchanged, because they don't have their own ui, and
have always used their parent's for their configuration.

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -523,6 +523,7 @@ 
         root = r.wjoin(path)
         create = not r.wvfs.exists('%s/.hg' % path)
         self._repo = hg.repository(r.baseui, root, create=create)
+        self.ui = self._repo.ui
         for s, k in [('ui', 'commitsubrepos')]:
             v = r.ui.config(s, k)
             if v: