Extension does not work if repository hgrc file contains %include directive

Issue #4 new
Julien Baron
created an issue

If repository hgrc file contains a %include directive, the remotebarnches extension fails. Default is due to mercurial core modification (https://selenic.com/hg/rev/3182965b3971) which seems to be present only since version 3.5 of mercurial.

The problem seems to be located in _activepath function. If rc file exists, then rc is parsed by mercurial config library using the parse method. This method has a include parameters used to specify the way to handle %include directive. For the moment, %include directive is not handled. Due to mercurial modification, an exception is now raised if %include directive is found and include parameter is not set (before, it was just ignored).

I see two ways to fix it :

  • Set the include parameter
  • Use config.read() instead of config.parse() method (I haven't look when config.read() has been introduced in mercurial)
@@ -128,8 +129,9 @@ def reposetup(ui, repo):
             rc = self.join('hgrc')
             if os.path.exists(rc):
                 fp = open(rc)
-                conf.parse('.hgrc', fp.read())
+                conf.parse(rc, fp.read(), include=conf.read)
                 fp.close()
             realpath = ''
             if 'paths' in conf:
                 for path, uri in conf['paths'].items():

Comments (1)

  1. Log in to comment