cloning subrepos doesnt set default in hgrc

Johannes Totz jtotz at imperial.ac.uk
Fri Feb 5 14:46:28 CST 2010


Johannes Totz wrote:

> 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).

I still haven't got around to actually test that patch. But I believe it
went into 1.4.2?

That particular feature of 1.4.2 doesn't work for me though. A
default-path entry is added in the subrepo's hgrc but it's empty. I've
tried various combinations of relative and absolute paths in .hgsub but
that didn't change anything...




More information about the Mercurial mailing list