# HG changeset patch
# User Mads Kiilerich <mads@kiilerich.com>
# Date 1282092225 -7200
#      Wed Aug 18 02:43:45 2010 +0200
# Branch stable
# Node ID 77f1f206e1355a770e811cda32f78b22e82b3c19
# Parent  df95b31bbdd73bd6b41a833f42237977afdf59e9
mq: don't inherit default and default-push paths with --mq (issue2333)

Configuration from the outer repo is inherited to the patches repo when --mq is
used.

In case the patches repo only has paths.default configured but the outer repo
has paths.default-push then the inherited default-push will win. Very
confusing.

Inheriting the default paths is however wrong in all sane cases, so now we
explicitly remove them.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1487,8 +1487,11 @@
             return True
 
     def qrepo(self, create=False):
+        ui = self.ui.copy()
+        ui.setconfig('paths', 'default', '', overlay=False)
+        ui.setconfig('paths', 'default-push', '', overlay=False)
         if create or os.path.isdir(self.join(".hg")):
-            return hg.repository(self.ui, path=self.path, create=create)
+            return hg.repository(ui, path=self.path, create=create)
 
     def restore(self, repo, rev, delete=None, qupdate=None):
         desc = repo[rev].description().strip()
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -121,9 +121,11 @@
         self._trustusers.update(self.configlist('trusted', 'users'))
         self._trustgroups.update(self.configlist('trusted', 'groups'))
 
-    def setconfig(self, section, name, value):
-        for cfg in (self._ocfg, self._tcfg, self._ucfg):
-            cfg.set(section, name, value)
+    def setconfig(self, section, name, value, overlay=True):
+        if overlay:
+            self._ocfg.set(section, name, value)
+        self._tcfg.set(section, name, value)
+        self._ucfg.set(section, name, value)
         self.fixconfig()
 
     def _data(self, untrusted):