[PATCH 1 of 7] subrepo: isolate configuration between each repositories in subrepo tree

Simon Heimberg simohe at besonet.ch
Wed Oct 24 17:41:13 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1348917084 -32400
# Node ID b290e0a80a3a630a8f4941b51b504d87468dfd53
# Parent  854f39aced2a19ceb13aa1a2e4060b62100995f5
subrepo: isolate configuration between each repositories in subrepo tree

Before this patch, repository local configurations are not isolated
between repositories in subrepo tree, because "localrepository"
objects for each subrepositories are created with "ui" instance of the
parent of each ones.

So, local configuration of the parent or higher repositories are
visible also in children or lower ones.

This patch uses "baseui" instead of "ui" to create repository object:
the former contains only global configuration.

This patch also copies 'ui.commitsubrepos' configuration to commit
recursively in subrepo tree, because it may be set in not
"repo.baseui" but "repo.ui".

diff -r 854f39aced2a -r b290e0a80a3a mercurial/subrepo.py
--- a/mercurial/subrepo.py	Don Okt 04 19:46:42 2012 +0200
+++ b/mercurial/subrepo.py	Sam Sep 29 20:11:24 2012 +0900
@@ -395,7 +395,11 @@
         if not os.path.exists(os.path.join(root, '.hg')):
             create = True
             util.makedirs(root)
-        self._repo = hg.repository(r.ui, root, create=create)
+        self._repo = hg.repository(r.baseui, root, create=create)
+        for s, k in [('ui', 'commitsubrepos')]:
+            v = r.ui.config(s, k)
+            if v:
+                self._repo.ui.setconfig(s, k, v)
         self._initrepo(r, state[0], create)
 
     def _initrepo(self, parentrepo, source, create):


More information about the Mercurial-devel mailing list