cloning subrepos doesnt set default in hgrc

Johannes Totz jtotz at imperial.ac.uk
Sat Dec 12 18:55:45 CST 2009


Matt Mackall wrote:

> On Thu, 2009-12-10 at 20:37 +0000, Johannes Totz wrote:
>> Hi!
>> 
>> Cloning a repo that has subrepos does not set the default path inside
>> the subrepo's hgrc.
>> It would be nice if it did though! E.g. set its value to what is
>> specified in .hgsub as its URL.
>> 
>> Is there any reason why this might be a bad idea?
>
> Nope. Try this:
>
> diff -r 359c56728257 mercurial/subrepo.py
> --- a/mercurial/subrepo.py	Thu Dec 10 17:01:21 2009 -0600
> +++ b/mercurial/subrepo.py	Thu Dec 10 19:48:39 2009 -0600
> @@ -175,6 +175,9 @@
>          else:
>              util.makedirs(root)
>              self._repo = hg.repository(r.ui, root, create=True)
> +            f = file(os.path.join(root, '.hg', 'hgrc'), 'w')
> +            f.write('[paths]\ndefault = %s\n' % state[0])
> +            f.close()
>          self._repo._subparent = r
>          self._repo._subsource = state[0]

Thanks! I'll give it a try soon (I have the all-binary TortoiseHG
installation only, at the moment).




More information about the Mercurial mailing list